summaryrefslogtreecommitdiffstats
path: root/java/sca-contrib/demos
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-05 07:55:03 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-05 07:55:03 +0000
commitebb89430400c2cb1d1c74ca18927375ff41601cc (patch)
tree64b8495da5bc316b6711834f604c2490f556901b /java/sca-contrib/demos
parent7e3c616f4404088bfdd5b2aefe30291c12486ddd (diff)
Move the contrib folder out of the sca trunk build as discussed on the ML
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@741038 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca-contrib/demos')
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/LICENSE205
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/NOTICE6
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/README82
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/alert-aggregator.pngbin0 -> 36819 bytes
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/alert-aggregator.svg627
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/build-dojo.xml92
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/build.xml148
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/pom.xml345
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java339
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java106
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java40
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java126
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java69
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java183
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java74
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java55
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java30
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java91
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java536
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl88
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd80
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl124
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite49
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/alerts.composite85
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/sources.xml34
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html330
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml26
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml37
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/pop.pngbin0 -> 244 bytes
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/rss.pngbin0 -> 689 bytes
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/service.smd1
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/sources.smd1
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/style.css176
-rw-r--r--java/sca-contrib/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java97
-rw-r--r--java/sca-contrib/demos/bigbank-account/LICENSE205
-rw-r--r--java/sca-contrib/demos/bigbank-account/NOTICE6
-rw-r--r--java/sca-contrib/demos/bigbank-account/README4
-rw-r--r--java/sca-contrib/demos/bigbank-account/bigbank.pngbin0 -> 100070 bytes
-rw-r--r--java/sca-contrib/demos/bigbank-account/bigbank.svg537
-rw-r--r--java/sca-contrib/demos/bigbank-account/build-dojo.xml92
-rw-r--r--java/sca-contrib/demos/bigbank-account/build.xml85
-rw-r--r--java/sca-contrib/demos/bigbank-account/pom.xml76
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java50
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java37
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java66
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java52
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java35
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java66
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java54
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java48
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java90
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java46
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java79
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java75
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java67
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java72
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java68
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java36
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java60
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/CheckingsAccount.composite35
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml42
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler20
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/SavingsAccount.composite34
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/StockAccount.composite34
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/definitions.xml58
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/web/AccountJSON.html92
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/web/style.css22
-rw-r--r--java/sca-contrib/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl91
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/LICENSE205
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/NOTICE6
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/README2
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/build.xml68
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/pom.xml78
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/AddService.java25
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java34
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java72
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/DivideService.java25
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java25
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java25
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java44
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/resources/Calculator.composite55
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js22
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy22
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py21
-rw-r--r--java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb22
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/LICENSE205
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/NOTICE6
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/README4
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/build.xml67
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/pom.xml85
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java47
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java38
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java30
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java42
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/resources/StockQuote.composite33
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/resources/definitions.xml49
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/resources/security.properties20
-rw-r--r--java/sca-contrib/demos/bigbank-stockquote/src/main/resources/stockQuote.jksbin0 -> 1986 bytes
-rw-r--r--java/sca-contrib/demos/bigbank/LICENSE205
-rw-r--r--java/sca-contrib/demos/bigbank/NOTICE6
-rw-r--r--java/sca-contrib/demos/bigbank/README127
-rw-r--r--java/sca-contrib/demos/bigbank/bigbank.pngbin0 -> 100070 bytes
-rw-r--r--java/sca-contrib/demos/bigbank/bigbank.svg537
-rw-r--r--java/sca-contrib/demos/bigbank/build-dojo.xml92
-rw-r--r--java/sca-contrib/demos/bigbank/build.xml84
-rw-r--r--java/sca-contrib/demos/bigbank/pom.xml201
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/AccountService.java32
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java99
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java70
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java50
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java130
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java51
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/calculator/CalculatorService.java34
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/java/stockquote/StockQuoteService.java29
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/BigBank.composite85
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml36
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/bigbank.jksbin0 -> 1986 bytes
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/definitions.xml64
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/security.properties20
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/web/AccountJSON.html92
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/web/style.css22
-rw-r--r--java/sca-contrib/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl91
-rw-r--r--java/sca-contrib/demos/bigbank/src/test/java/test/BigBankTestCase.java33
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/LICENSE205
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/NOTICE6
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/README76
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/build-tomcat.xml96
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/build.xml125
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/pom.xml349
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/java/client/LaunchClient.java57
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/java/domain/LaunchDomain.java33
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldImpl.java35
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldServiceClient.java42
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/java/org/apache/tuscany/sca/demos/loadbalancer/rule/RoundRobinRule.java96
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/resources/client-contribution/helloworldwsclient.composite33
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite32
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/WEB-INF/web.xml37
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/httpd.conf28
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/workers.properties18
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml391
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/webapps/balancer/WEB-INF/config/rules.xml26
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml391
-rw-r--r--java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml391
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/LICENSE205
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/NOTICE6
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/README6
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/build.xml66
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/pom.xml75
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java26
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java34
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java40
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite37
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl81
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml37
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/LICENSE205
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/NOTICE6
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/README60
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/build.xml66
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.jpgbin0 -> 73610 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.pngbin0 -> 51153 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.jpgbin0 -> 162536 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.pngbin0 -> 58247 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpgbin0 -> 145053 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.pngbin0 -> 93773 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpgbin0 -> 181317 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.pngbin0 -> 113404 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpgbin0 -> 180240 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.pngbin0 -> 106656 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.jpgbin0 -> 343699 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.pngbin0 -> 288351 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_diagrams.docbin0 -> 81920 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.jpgbin0 -> 181031 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.pngbin0 -> 34939 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.jpgbin0 -> 110930 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.pngbin0 -> 58993 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.jpgbin0 -> 225690 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.pngbin0 -> 106791 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/mortgage_assembly.pngbin0 -> 106656 bytes
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/pom.xml83
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java29
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java34
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java76
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java23
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java42
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java27
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java84
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java29
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java38
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java44
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java27
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java38
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite48
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite57
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType27
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js25
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl81
-rw-r--r--java/sca-contrib/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java56
-rw-r--r--java/sca-contrib/demos/pom.xml52
-rw-r--r--java/sca-contrib/demos/workpool-distributed/LICENSE205
-rw-r--r--java/sca-contrib/demos/workpool-distributed/NOTICE6
-rw-r--r--java/sca-contrib/demos/workpool-distributed/build.xml446
-rw-r--r--java/sca-contrib/demos/workpool-distributed/pom.xml148
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNode.java57
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNodeDaemon.java79
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/node/TestJob.java82
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolDaemon.java271
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolNode.java179
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/node/workerRules1.drl13
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MetaComponentWorker.java85
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MyWorker.java46
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/NullJob.java43
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/ResultJob.java54
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/Trigger.java29
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManager.java31
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManagerImpl.java213
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerService.java56
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceCallback.java27
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceImpl.java171
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBean.java162
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBeanListener.java25
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolEvent.java71
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManager.java48
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java555
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java91
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java416
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite47
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite38
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite38
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite38
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite38
-rw-r--r--java/sca-contrib/demos/workpool-distributed/src/test/java/workpool/AComponent.java25
-rw-r--r--java/sca-contrib/demos/workpool-distributed/workerRules.drl9
-rw-r--r--java/sca-contrib/demos/workpool-distributed/workerRules1.drl9
-rw-r--r--java/sca-contrib/demos/workpool-distributed/workerRules2.drl8
-rw-r--r--java/sca-contrib/demos/workpool-distributed/workerRules3.drl14
-rw-r--r--java/sca-contrib/demos/xml-bigbank/LICENSE205
-rw-r--r--java/sca-contrib/demos/xml-bigbank/NOTICE6
-rw-r--r--java/sca-contrib/demos/xml-bigbank/README46
-rw-r--r--java/sca-contrib/demos/xml-bigbank/build.xml63
-rw-r--r--java/sca-contrib/demos/xml-bigbank/pom.xml115
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountData.java36
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java48
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountService.java32
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java84
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java35
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java40
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java36
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java32
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java84
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java38
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/StockValue.java38
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/resources/BigBank.composite51
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/resources/accounts.xml29
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/resources/customer.xsd46
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/resources/stock.xq52
-rw-r--r--java/sca-contrib/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl23
-rw-r--r--java/sca-contrib/demos/xml-bigbank/xml-bigbank.pngbin0 -> 30396 bytes
-rw-r--r--java/sca-contrib/demos/xml-bigbank/xml-bigbank.svg447
269 files changed, 20357 insertions, 0 deletions
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/LICENSE b/java/sca-contrib/demos/alert-aggregator-webapp/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/NOTICE b/java/sca-contrib/demos/alert-aggregator-webapp/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/README b/java/sca-contrib/demos/alert-aggregator-webapp/README
new file mode 100644
index 0000000000..3ec27ef65f
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/alert-aggregator.png b/java/sca-contrib/demos/alert-aggregator-webapp/alert-aggregator.png
new file mode 100644
index 0000000000..ae429cca94
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/alert-aggregator.png
Binary files differ
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/alert-aggregator.svg b/java/sca-contrib/demos/alert-aggregator-webapp/alert-aggregator.svg
new file mode 100644
index 0000000000..807416135e
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/build-dojo.xml b/java/sca-contrib/demos/alert-aggregator-webapp/build-dojo.xml
new file mode 100644
index 0000000000..c31c9adee8
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/build.xml b/java/sca-contrib/demos/alert-aggregator-webapp/build.xml
new file mode 100644
index 0000000000..b75842d08c
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/build.xml
@@ -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.
+-->
+<!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>
+ </target>
+
+ <target name="package" depends="compile">
+ <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="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/pom.xml b/java/sca-contrib/demos/alert-aggregator-webapp/pom.xml
new file mode 100644
index 0000000000..71139b0863
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/pom.xml
@@ -0,0 +1,345 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>demo-alert-aggregator-webapp</artifactId>
+ <packaging>war</packaging>
+ <version>2.0-SNAPSHOT</version>
+ <name>Apache Tuscany SCA Alert Aggregator Demo</name>
+ <url>http://cwiki.apache.org/TUSCANY</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</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>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </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.1.1</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>
+ <version>1.0-alpha-5</version>
+ <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>8085</cargo.servlet.port>
+ </properties>
+ <deployables>
+ <deployable>
+ <location>
+ ${project.build.directory}/${project.build.finalName}.${project.packaging}
+ </location>
+ <pingURL>http://localhost:8085/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>2.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <buildDependencyFileOnly>true</buildDependencyFileOnly>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java
new file mode 100644
index 0000000000..cf2f906388
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.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://tuscany.apache.org");
+
+ // 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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java
new file mode 100644
index 0000000000..8797349640
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java
new file mode 100644
index 0000000000..569d9b7f6f
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java
new file mode 100644
index 0000000000..f61c307120
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java
new file mode 100644
index 0000000000..38e7ba31a6
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java
new file mode 100644
index 0000000000..549abbf602
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.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.demos.aggregator;
+
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+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 {
+ // lastchecktimestamp comes from sources.xml configuration.
+ // That origin requires ISO 8601 date input (yyyy-MM-dd hh:mm:ss).
+ DateFormat configDateFormatter = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss");
+ Date timestamp = configDateFormatter.parse(lastchecktimestamp);
+ // Turn feed dates into something we can process.
+ DateFormat feedDateFormatter = DateFormat.getDateTimeInstance();
+
+ // 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;
+
+ // System.err.println( "Entry pubdate=" + syndEntry.getPublishedDate() );
+ 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(feedDateFormatter.format(syndEntry.getPublishedDate()));
+ newAlert.setId(rssaddress);
+ newAlert.setUnread(true);
+
+ returnAlertList.add(newAlert);
+ }
+ }
+
+ } catch(Exception ex) {
+ ex.printStackTrace( System.err );
+ System.err.println("Exception " + ex.toString());
+ }
+
+ return returnAlerts;
+ }
+
+}
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl
new file mode 100644
index 0000000000..8b376240c8
--- /dev/null
+++ b/java/sca-contrib/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:8085/services/AlertsServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd
new file mode 100644
index 0000000000..f0ec561ad8
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl
new file mode 100644
index 0000000000..d5642a32d1
--- /dev/null
+++ b/java/sca-contrib/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:8085/services/AlertsSourcesServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite
new file mode 100644
index 0000000000..49f44f9da8
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/alerts.composite b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/alerts.composite
new file mode 100644
index 0000000000..c359b275be
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/sources.xml b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/sources.xml
new file mode 100644
index 0000000000..e45250eddb
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/resources/sources.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.
+-->
+<!-- Note: the demo expects LastChecked date in ISO 8601 format (yyyy-MM-dd hh:mm:ss). -->
+<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>2008-06-20 12:00:00</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>2008-06-20 12:00:00</ns0:LastChecked>
+ <ns0:FeedAddress>http://www.engadget.com/rss.xml</ns0:FeedAddress>
+</ns0:Source>
+</ns0:Config>
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html
new file mode 100644
index 0000000000..8b472fd0fa
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..0bc67c4c98
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000000..bd31898e3b
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.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.
+-->
+<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>2.0-SNAPSHOT</d:version>
+ <d:type>war</d:type>
+ </d:moduleId>
+ <!-- TUSCANY-2622 -->
+ <d:hidden-classes>
+ <d:filter>org.apache.axiom</d:filter>
+ <d:filter>org.apache.axis2</d:filter>
+ <d:filter>org.apache.commons</d:filter>
+ <d:filter>org.jdom</d:filter>
+ </d:hidden-classes>
+ </d:environment>
+</web-app>
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..a81165e1b4
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/pop.png b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/pop.png
new file mode 100644
index 0000000000..1cf1df24a7
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/pop.png
Binary files differ
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/rss.png b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/rss.png
new file mode 100644
index 0000000000..b3c949d224
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/rss.png
Binary files differ
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/service.smd b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/service.smd
new file mode 100644
index 0000000000..3c6b6c9b12
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/service.smd
@@ -0,0 +1 @@
+{"SMDVersion":".1","objectName":"AlertsService","serviceType":"JSON-RPC","serviceURL":"http://localhost:8085/sample-feed-aggregator/services/AlertsServiceJSONRPC","methods":[{"name":"getAllNewAlerts","parameters":[{"name":"param0","type":"STRING"}]}]}
diff --git a/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/sources.smd b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/sources.smd
new file mode 100644
index 0000000000..b5f1824363
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/style.css b/java/sca-contrib/demos/alert-aggregator-webapp/src/main/webapp/style.css
new file mode 100644
index 0000000000..f5bbf23379
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java b/java/sca-contrib/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java
new file mode 100644
index 0000000000..f0cb9ecfcb
--- /dev/null
+++ b/java/sca-contrib/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.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.demos.aggregator;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.Assert;
+
+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:8085/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:8085/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:8085/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/java/sca-contrib/demos/bigbank-account/LICENSE b/java/sca-contrib/demos/bigbank-account/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/NOTICE b/java/sca-contrib/demos/bigbank-account/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-account/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/bigbank-account/README b/java/sca-contrib/demos/bigbank-account/README
new file mode 100644
index 0000000000..5c0d850c5e
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/bigbank.png b/java/sca-contrib/demos/bigbank-account/bigbank.png
new file mode 100644
index 0000000000..985cc6bd05
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-account/bigbank.png
Binary files differ
diff --git a/java/sca-contrib/demos/bigbank-account/bigbank.svg b/java/sca-contrib/demos/bigbank-account/bigbank.svg
new file mode 100644
index 0000000000..0650075d48
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/build-dojo.xml b/java/sca-contrib/demos/bigbank-account/build-dojo.xml
new file mode 100644
index 0000000000..0e029c6335
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/build.xml b/java/sca-contrib/demos/bigbank-account/build.xml
new file mode 100644
index 0000000000..f7ebe32968
--- /dev/null
+++ b/java/sca-contrib/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.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-binding-jsonrpc-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-binding-rmi-1.4-SNAPSHOT.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/java/sca-contrib/demos/bigbank-account/pom.xml b/java/sca-contrib/demos/bigbank-account/pom.xml
new file mode 100644
index 0000000000..12421e3788
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-account/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-demos</artifactId>
+ <version>2.0-SNAPSHOT</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>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>2.0-SNAPSHOT</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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
new file mode 100644
index 0000000000..57c1adcba0
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java
new file mode 100644
index 0000000000..c984700efc
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+import org.oasisopen.sca.annotation.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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
new file mode 100644
index 0000000000..d79cf373ee
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java
new file mode 100644
index 0000000000..cc9023da60
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java
new file mode 100644
index 0000000000..4a28b3f90b
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java
new file mode 100644
index 0000000000..d93007279c
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java
new file mode 100644
index 0000000000..579b4ee64b
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java
new file mode 100644
index 0000000000..5c64e11d10
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java
new file mode 100644
index 0000000000..c98dcacbf3
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java
new file mode 100644
index 0000000000..121ee9a3f8
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
new file mode 100644
index 0000000000..1d565f7ca1
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
@@ -0,0 +1,79 @@
+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;
+import org.apache.tuscany.sca.policy.SecurityUtil;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Policy handler to handle PolicySet related to Logging with the QName
+ * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
+ */
+public class CheckingsDeptAuthPolicyInterceptor implements Interceptor {
+ private Invoker next;
+
+ public CheckingsDeptAuthPolicyInterceptor(String context, Operation operation, PolicySet policySet) {
+ super();
+ init();
+ }
+
+ private final void init() {
+ }
+
+ public Message invoke(Message msg) {
+ Object msgBody = msg.getBody();
+ if (msgBody instanceof Object[]) {
+ Object args[] = (Object[])msg.getBody();
+ Principal principal = SecurityUtil.getPrincipal(msg);
+ if (principal != null){
+ BigbankCheckingsAcl.authorize(principal,
+ (String)args[0]);
+ }
+ }
+
+ Message responseMsg = null;
+ try {
+ responseMsg = getNext().invoke(msg);
+ return responseMsg;
+ } catch (RuntimeException e) {
+ throw e;
+ }
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+}
diff --git a/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java
new file mode 100644
index 0000000000..5fecef691e
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
new file mode 100644
index 0000000000..6667a4ba53
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.security;
+
+import java.security.Principal;
+
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.SecurityUtil;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * @version $Rev$ $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();
+ Principal principal = SecurityUtil.getPrincipal(msg);
+ if (principal != null){
+ BigbankCheckingsAcl.authorize(principal,
+ (String)args[0]);
+ }
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return this.applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet policySet) {
+ this.applicablePolicySet = policySet;
+ }
+
+ public void setUp(Object... arg0) {
+
+ }
+
+}
diff --git a/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java
new file mode 100644
index 0000000000..da1b6e1d06
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java
new file mode 100644
index 0000000000..1473436000
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java
new file mode 100644
index 0000000000..da2e7940ca
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface StockAccountService {
+
+ public StockAccountDetails getAccountDetails(String customerID);
+
+ public StockAccountDetails buy(String accountNo, String symbol, int quantity);
+
+ public StockAccountDetails sell(String accountNo, String symbol, int quantity);
+
+
+}
diff --git a/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java b/java/sca-contrib/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java
new file mode 100644
index 0000000000..c3474a554f
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/bigbank-account/src/main/resources/CheckingsAccount.composite b/java/sca-contrib/demos/bigbank-account/src/main/resources/CheckingsAccount.composite
new file mode 100644
index 0000000000..cc76e30a75
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml b/java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..c5532b879d
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/java/sca-contrib/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/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/SavingsAccount.composite b/java/sca-contrib/demos/bigbank-account/src/main/resources/SavingsAccount.composite
new file mode 100644
index 0000000000..696b96d6e6
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/StockAccount.composite b/java/sca-contrib/demos/bigbank-account/src/main/resources/StockAccount.composite
new file mode 100644
index 0000000000..62c0b63003
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/definitions.xml b/java/sca-contrib/demos/bigbank-account/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..31a8798f8b
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/web/AccountJSON.html b/java/sca-contrib/demos/bigbank-account/src/main/resources/web/AccountJSON.html
new file mode 100644
index 0000000000..1609bf4b43
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/web/style.css b/java/sca-contrib/demos/bigbank-account/src/main/resources/web/style.css
new file mode 100644
index 0000000000..1071583264
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl b/java/sca-contrib/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..ac4d987a57
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/LICENSE b/java/sca-contrib/demos/bigbank-calculator/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/NOTICE b/java/sca-contrib/demos/bigbank-calculator/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-calculator/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/bigbank-calculator/README b/java/sca-contrib/demos/bigbank-calculator/README
new file mode 100644
index 0000000000..e8ff28fc0f
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/build.xml b/java/sca-contrib/demos/bigbank-calculator/build.xml
new file mode 100644
index 0000000000..a06f0806df
--- /dev/null
+++ b/java/sca-contrib/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.4-SNAPSHOT.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/java/sca-contrib/demos/bigbank-calculator/pom.xml b/java/sca-contrib/demos/bigbank-calculator/pom.xml
new file mode 100644
index 0000000000..982fdb7e2a
--- /dev/null
+++ b/java/sca-contrib/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>2.0-SNAPSHOT</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>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/AddService.java b/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..4eeb30a9c2
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java b/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..0b42a6ab1f
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Service(CalculatorService.class)
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.err.println("Multiply");
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/DivideService.java b/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..131c5a8014
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java b/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..a917896aeb
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java b/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..e328f024ea
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java b/java/sca-contrib/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java
new file mode 100644
index 0000000000..b1861daafc
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/resources/Calculator.composite b/java/sca-contrib/demos/bigbank-calculator/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..851813d31f
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js b/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js
new file mode 100644
index 0000000000..1d4d221364
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy b/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy
new file mode 100644
index 0000000000..c31c1e8fd6
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py b/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py
new file mode 100644
index 0000000000..dd56af0ad8
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb b/java/sca-contrib/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb
new file mode 100644
index 0000000000..08fa310f46
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/LICENSE b/java/sca-contrib/demos/bigbank-stockquote/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/NOTICE b/java/sca-contrib/demos/bigbank-stockquote/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-stockquote/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/bigbank-stockquote/README b/java/sca-contrib/demos/bigbank-stockquote/README
new file mode 100644
index 0000000000..2ea98d020c
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/build.xml b/java/sca-contrib/demos/bigbank-stockquote/build.xml
new file mode 100644
index 0000000000..145c158ac2
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/pom.xml b/java/sca-contrib/demos/bigbank-stockquote/pom.xml
new file mode 100644
index 0000000000..97586917cc
--- /dev/null
+++ b/java/sca-contrib/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>2.0-SNAPSHOT</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>2.0-SNAPSHOT</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>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java b/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java
new file mode 100644
index 0000000000..2d7821171d
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java b/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java
new file mode 100644
index 0000000000..63c31bd116
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Service;
+
+/**
+ * This class implements the StockQuote service.
+ */
+@Service(StockQuoteService.class)
+public class StockQuoteImpl implements StockQuoteService {
+
+ public double getQuote(String symbol) {
+ double price = 104.0 + Math.random();
+ price = ((int)(price * 100)) / 100.0;
+
+ System.out.println("Getting stock quote for: " + symbol + ", value: "+ price);
+
+ return price;
+ }
+
+}
diff --git a/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java b/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..a20f4e46dd
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+
+ public double getQuote(String symbol);
+}
diff --git a/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java b/java/sca-contrib/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java
new file mode 100644
index 0000000000..04ed762602
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/StockQuote.composite b/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/StockQuote.composite
new file mode 100644
index 0000000000..aaad92c861
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/definitions.xml b/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..7e1f51304e
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/security.properties b/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/security.properties
new file mode 100644
index 0000000000..a5b889c269
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/stockQuote.jks b/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/stockQuote.jks
new file mode 100644
index 0000000000..d53d32c4ef
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank-stockquote/src/main/resources/stockQuote.jks
Binary files differ
diff --git a/java/sca-contrib/demos/bigbank/LICENSE b/java/sca-contrib/demos/bigbank/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/NOTICE b/java/sca-contrib/demos/bigbank/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/bigbank/README b/java/sca-contrib/demos/bigbank/README
new file mode 100644
index 0000000000..5ec796db60
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/bigbank.png b/java/sca-contrib/demos/bigbank/bigbank.png
new file mode 100644
index 0000000000..985cc6bd05
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank/bigbank.png
Binary files differ
diff --git a/java/sca-contrib/demos/bigbank/bigbank.svg b/java/sca-contrib/demos/bigbank/bigbank.svg
new file mode 100644
index 0000000000..30aa0eab6d
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/build-dojo.xml b/java/sca-contrib/demos/bigbank/build-dojo.xml
new file mode 100644
index 0000000000..9d282c2dd2
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/build.xml b/java/sca-contrib/demos/bigbank/build.xml
new file mode 100644
index 0000000000..046aadd228
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/pom.xml b/java/sca-contrib/demos/bigbank/pom.xml
new file mode 100644
index 0000000000..d9946b0a09
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank/pom.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * 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>2.0-SNAPSHOT</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>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>2.0-SNAPSHOT</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>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</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/java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/AccountService.java b/java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..951cd175d3
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+
+@Remotable
+public interface AccountService {
+
+ public double getAccountReport(String customerID);
+
+}
diff --git a/java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..4cff2b7966
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.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/java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java b/java/sca-contrib/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java
new file mode 100644
index 0000000000..b8aff2a3b1
--- /dev/null
+++ b/java/sca-contrib/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.data.collection.Collection;
+import org.apache.tuscany.sca.data.collection.Entry;
+import org.apache.tuscany.sca.data.collection.NotFoundException;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+import bigbank.account.AccountService;
+
+/**
+ * @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/java/sca-contrib/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java b/java/sca-contrib/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java
new file mode 100644
index 0000000000..a7fa5ecc22
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java b/java/sca-contrib/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java
new file mode 100644
index 0000000000..05360e07a5
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java b/java/sca-contrib/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java
new file mode 100644
index 0000000000..6d3b547939
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/java/calculator/CalculatorService.java b/java/sca-contrib/demos/bigbank/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/java/stockquote/StockQuoteService.java b/java/sca-contrib/demos/bigbank/src/main/java/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..5d3366ae00
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+ public double getQuote(String symbol);
+}
diff --git a/java/sca-contrib/demos/bigbank/src/main/resources/BigBank.composite b/java/sca-contrib/demos/bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..11591308b4
--- /dev/null
+++ b/java/sca-contrib/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="http://localhost:8085/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="http://localhost:8085/rss"/>
+ <tuscany:binding.atom uri="http://localhost:8085/atom"/>
+ </service>
+ <reference name="accountService" target="AccountServiceComponent"/>
+ </component>
+
+ <component name="WebResourceComponent">
+ <tuscany:implementation.resource location="web"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="http://localhost:8085/"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml b/java/sca-contrib/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..154992c843
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/resources/bigbank.jks b/java/sca-contrib/demos/bigbank/src/main/resources/bigbank.jks
new file mode 100644
index 0000000000..e6294d85f7
--- /dev/null
+++ b/java/sca-contrib/demos/bigbank/src/main/resources/bigbank.jks
Binary files differ
diff --git a/java/sca-contrib/demos/bigbank/src/main/resources/definitions.xml b/java/sca-contrib/demos/bigbank/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..8654151d82
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/resources/security.properties b/java/sca-contrib/demos/bigbank/src/main/resources/security.properties
new file mode 100644
index 0000000000..d1b489acbb
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/resources/web/AccountJSON.html b/java/sca-contrib/demos/bigbank/src/main/resources/web/AccountJSON.html
new file mode 100644
index 0000000000..9f4368443f
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/resources/web/style.css b/java/sca-contrib/demos/bigbank/src/main/resources/web/style.css
new file mode 100644
index 0000000000..1071583264
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl b/java/sca-contrib/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..ac4d987a57
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/bigbank/src/test/java/test/BigBankTestCase.java b/java/sca-contrib/demos/bigbank/src/test/java/test/BigBankTestCase.java
new file mode 100644
index 0000000000..3b7c5ef2ad
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/load-balancing-webapp/LICENSE b/java/sca-contrib/demos/load-balancing-webapp/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-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/java/sca-contrib/demos/load-balancing-webapp/NOTICE b/java/sca-contrib/demos/load-balancing-webapp/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/load-balancing-webapp/README b/java/sca-contrib/demos/load-balancing-webapp/README
new file mode 100644
index 0000000000..b7bbb64b1a
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/README
@@ -0,0 +1,76 @@
+WebApp Load Balancing Demo
+===========================
+
+Demonstrates balancing load acoss SCA services by deploying an SCA composite
+to two tomcat servers in a cluster. The tomcat servers sit behind an Apache
+server which directs load to one or other tomcat server based on a set of rules.
+
+The mvn pom distributed with this sample will download, install and configure
+two Tomcat servers automatically to act as workers. You need to install the
+Apache web server and configure it manually.
+
+1 - Install and configure the Tomcat workers
+
+mvn
+
+This results in two tomcat servers at
+
+target/tomcat-8085
+target/tomcat-8086
+
+2 - Install and configure the Apache server to balance load
+
+In this case we've chosen to use the native JK connector. There are several
+resources that tell you how to configure Apache for load balancing Tomcat with
+the JK connector. For example,
+
+http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
+http://www.crazysquirrel.com/computing/debian/servers/tomcat55.jspx
+
+Here is a high level summary
+
+Download the latest version of Apache 2.2 (this demo was built with Apache 2.2.6)
+ http://httpd.apache.org/
+ Install in a local director called, say, apache
+
+Download the mod_jk module (in binary form if you can)
+ http://tomcat.apache.org/download-connectors.cgi
+ Install it in apache/modules
+
+Configure the mod_jk module
+ Copy src/test/resources/apache-80/conf/workers.properties to apache/conf
+ Append the contents of src/test/resources/apache-80/conf/httpd.conf to apache/conf/httpf.conf
+
+3 - Start the apache and tomcat servers
+
+In three command prompts
+
+cd target/tomcat-8085
+bin/catalina run
+
+cd target/tomcat-8086
+bin/catalina run
+
+cd apache
+bin/httpd
+
+4 - Run the client
+
+run the LanchClient program - TBD - need a script
+
+5 - Result
+
+The client will make 10 calls to the SCA service described in the helloworldws.composite that
+is part of the webapp deployed to the tomcat servers. You will see the result of this
+service call reported at the client in the form
+
+Called getGreetings
+Hello World 6
+
+If you look at the Tomcat consoles you will see that each server deals with half the requests
+as the load is balanced equally between the two of them.
+
+
+
+
+
diff --git a/java/sca-contrib/demos/load-balancing-webapp/build-tomcat.xml b/java/sca-contrib/demos/load-balancing-webapp/build-tomcat.xml
new file mode 100644
index 0000000000..7e1dc4b0e9
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/build-tomcat.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 name="TomcatZipInstaller">
+
+ <!--property name="tomcat.series" value="6"/>
+ <property name="tomcat.version" value="6.0.16"/-->
+ <property name="tomcat.series" value="5"/>
+ <property name="tomcat.version" value="5.5.26"/>
+ <property name="unpack.location" value="${basedir}/target/tomcat"/>
+ <property name="repo.location" value="${basedir}/target/repo"/>
+
+ <target name="check-tomcat-downloaded">
+ <condition property="already.downloaded" >
+ <available file="${repo.location}/apache-tomcat-${tomcat.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="download-tomcat" depends="check-tomcat-downloaded" unless="already.downloaded">
+ <mkdir dir="${repo.location}"/>
+ <get src="http://www.apache.org/dist/jakarta/tomcat-${tomcat.series}/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip"
+ dest="${repo.location}/apache-tomcat-${tomcat.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ </target>
+
+ <target name="check-tomcat-unpacked">
+ <condition property="already.unpacked" >
+ <available file="${unpack.location}-${port}"/>
+ </condition>
+ </target>
+
+ <target name="unpack-tomcat" depends="check-tomcat-downloaded, check-tomcat-unpacked" unless="already.unpacked">
+ <fail message="tomcat zip file not downloaded" unless="already.downloaded"/>
+ <mkdir dir="${unpack.location}-${port}/"/>
+ <unzip src="${repo.location}/apache-tomcat-${tomcat.version}.zip"
+ dest="."
+ overwrite="false">
+ </unzip>
+ <move file="apache-tomcat-${tomcat.version}"
+ tofile="${unpack.location}-${port}/"
+ overwrite="false"
+ verbose="false"/>
+ <delete dir="apache-tomcat-${tomcat.version}"/>
+ </target>
+
+ <target name="configure-tomcat" depends="check-tomcat-downloaded, check-tomcat-unpacked">
+ <fail message="tomcat zip file not downloaded" unless="already.downloaded"/>
+ <fail message="tomcat zip file not unpacked" unless="already.unpacked"/>
+ <copy todir="${unpack.location}-${port}/"
+ overwrite="true"
+ verbose="false">
+ <fileset dir="${basedir}/src/test/resources/tomcat-${port}"/>
+ </copy>
+ <mkdir dir="${unpack.location}-${port}/webapps/balancer/WEB-INF/classes/org"/>
+ <copy todir="${unpack.location}-${port}/webapps/balancer/WEB-INF/classes/org"
+ overwrite="true"
+ verbose="false">
+ <fileset dir="${basedir}/target/classes/org"/>
+ </copy>
+
+ </target>
+
+ <target name="copy-webapp" depends="check-tomcat-downloaded, check-tomcat-unpacked">
+ <fail message="tomcat zip file not downloaded" unless="already.downloaded"/>
+ <fail message="tomcat zip file not unpacked" unless="already.unpacked"/>
+ <copy file="${basedir}/target/demo-load-balancing-webapp.war"
+ todir="${unpack.location}-${port}/webapps/"
+ overwrite="true"
+ verbose="false">
+ </copy>
+ </target>
+
+</project>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/build.xml b/java/sca-contrib/demos/load-balancing-webapp/build.xml
new file mode 100644
index 0000000000..b84f85616e
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/build.xml
@@ -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.
+-->
+<project name="calculator" >
+ <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.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.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.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target-->
+
+ <target name="runClient">
+ <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.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run8085">
+ <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.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run8086">
+ <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.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run8087">
+ <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.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+
+</project>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/pom.xml b/java/sca-contrib/demos/load-balancing-webapp/pom.xml
new file mode 100644
index 0000000000..cdd6727460
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/pom.xml
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * 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>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-load-balancing-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA WebApp Load Balancing Demo</name>
+ <description>A sample SCA application that is deployed as a webapp to a cluster of tomcat servers</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>tomcat</groupId>
+ <artifactId>catalina-balancer</artifactId>
+ <version>5.5.12</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>
+
+ </dependencies>
+
+ <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>
+ <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>download-tomcat</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="download-tomcat">
+
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <!--execution>
+ <id>unpack-tomcat-8085</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="unpack-tomcat">
+ <property name="port" value="8085" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution-->
+ <execution>
+ <id>unpack-tomcat-8086</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="unpack-tomcat">
+ <property name="port" value="8086" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>unpack-tomcat-8087</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="unpack-tomcat">
+ <property name="port" value="8087" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <!--execution>
+ <id>configure-tomcat-8085</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="configure-tomcat">
+ <property name="port" value="8085" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution-->
+ <execution>
+ <id>configure-tomcat-8086</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="configure-tomcat">
+ <property name="port" value="8086" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>configure-tomcat-8087</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="configure-tomcat">
+ <property name="port" value="8087" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>copy-webapp-8086</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="copy-webapp">
+ <property name="port" value="8086" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-webapp-8087</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-tomcat.xml" target="copy-webapp">
+ <property name="port" value="8087" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!--plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-web-junit</artifactId>
+ <version>2.0-SNAPSHOT</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>runtime</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>8085</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-->
+
+
+
+ <!--plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tomcat-execution</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>tomcat5x</containerId>
+ <log>${project.build.directory}/tomcat-8085/cargo.log</log>
+ <zipUrlInstaller>
+ <url>http://www.apache.org/dist/jakarta/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip</url>
+ <installDir>${project.build.directory}/tomcat-8085</installDir>
+ </zipUrlInstaller>
+ </container>
+ <configuration>
+ <home>${project.build.directory}/tomcat-8085/container</home>
+ <properties>
+ <cargo.servlet.port>8085</cargo.servlet.port>
+ <cargo.logging>high</cargo.logging>
+ </properties>
+ </configuration>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin-->
+ </plugins>
+ </build>
+
+</project>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/java/client/LaunchClient.java b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/client/LaunchClient.java
new file mode 100644
index 0000000000..872893945e
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/client/LaunchClient.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 client;
+
+import java.io.File;
+
+import helloworld.HelloWorldService;
+
+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.oasisopen.sca.ServiceRuntimeException;
+
+public class LaunchClient {
+ public static void main(String[] args) throws Exception {
+
+ SCANode2 node = null;
+ try {
+
+ SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/client-contribution/helloworldwsclient.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/client-contribution").toURL().toString()));
+
+ node.start();
+ HelloWorldService helloWorldService = ((SCAClient)node).getService(HelloWorldService.class, "HelloWorldClientComponent");
+
+
+ for (int i=0; i < 10; i++){
+ System.out.println(helloWorldService.getGreetings("World " + i));
+ }
+
+ node.stop();
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+}
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/java/domain/LaunchDomain.java b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/domain/LaunchDomain.java
new file mode 100644
index 0000000000..33c37869a3
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/domain/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 domain;
+
+//import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher;
+
+/**
+ * This server program that loads a composite to provide simple registry function.
+ * This server can be replaced with any registry that is appropriate but the components
+ * in each node that talk to the registry should be replaced also.
+ */
+public class LaunchDomain {
+ public static void main(String[] args) throws Exception {
+ // DomainManagerLauncher.main(args);
+ }
+
+}
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldImpl.java b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..23beb7f933
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ String message = "Hello " + name;
+ System.err.println(message);
+ return message;
+ }
+
+}
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldService.java b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..513c2e3129
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldServiceClient.java b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldServiceClient.java
new file mode 100644
index 0000000000..f3d2fdb2ed
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldServiceClient.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 HelloWorldServiceClient implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/java/org/apache/tuscany/sca/demos/loadbalancer/rule/RoundRobinRule.java b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/org/apache/tuscany/sca/demos/loadbalancer/rule/RoundRobinRule.java
new file mode 100644
index 0000000000..5dc1b6671b
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/main/java/org/apache/tuscany/sca/demos/loadbalancer/rule/RoundRobinRule.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.demos.loadbalancer.rule;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.webapp.balancer.rules.BaseRule;
+
+
+public class RoundRobinRule extends BaseRule {
+ /**
+ * The number of worker nodes that load will
+ * be balanced across
+ */
+ private int workerCount;
+
+ private int currentCount = 1;
+
+
+ /**
+ * Sets the worker count.
+ *
+ * @param workerCount The worker count
+ */
+ public void setWorkerCount(int workerCount) {
+ if (workerCount == 0) {
+ throw new IllegalArgumentException(
+ "worker count cannot be 0.");
+ } else {
+ this.workerCount = workerCount;
+ }
+ }
+
+ /**
+ * Returns the worker count.
+ *
+ * @return int The worker count
+ */
+ protected int getWorkerCount() {
+ return workerCount;
+ }
+
+
+
+ /**
+ * @see org.apache.webapp.balancer.Rule#matches(HttpServletRequest)
+ */
+ public boolean matches(HttpServletRequest request) {
+
+ if (currentCount == workerCount){
+ currentCount = 1;
+ return true;
+ } else {
+ currentCount++;
+ return false;
+ }
+ }
+
+ /**
+ * Returns a String representation of this object.
+ *
+ * @return String
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[");
+ buffer.append(getClass().getName());
+ buffer.append(": ");
+
+ buffer.append("Worker count: ");
+ buffer.append(getWorkerCount());
+ buffer.append(" / ");
+
+ buffer.append("Redirect URL: ");
+ buffer.append(getRedirectUrl());
+
+ buffer.append("]");
+
+ return buffer.toString();
+ }
+}
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/resources/client-contribution/helloworldwsclient.composite b/java/sca-contrib/demos/load-balancing-webapp/src/main/resources/client-contribution/helloworldwsclient.composite
new file mode 100644
index 0000000000..9b6052741e
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/main/resources/client-contribution/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:hw="http://helloworld"
+ name="helloworldwsclient">
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="helloworld.HelloWorldServiceClient"/>
+ <reference name="helloWorldService">
+ <binding.ws uri="http://localhost/demo-load-balancing-webapp/HelloWorldServiceComponent"/>
+ </reference>
+ </component>
+
+
+</composite>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..11347004f9
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-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://helloworld"
+ xmlns:credit="http://helloworld">
+ <deployable composite="tns:helloworldws"/>
+</contribution> \ No newline at end of file
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite b/java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite
new file mode 100644
index 0000000000..1ab78d802d
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <binding.ws/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca-contrib/demos/load-balancing-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..8d47ae2207
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/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 Load Balancing 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/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/httpd.conf b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/httpd.conf
new file mode 100644
index 0000000000..37cf284d35
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/httpd.conf
@@ -0,0 +1,28 @@
+# Load mod_jk module
+# Update this path to match your modules location
+LoadModule jk_module modules/mod_jk.so
+
+# Declare the module for <IfModule directive> (remove this line on Apache 2.x)
+# AddModule mod_jk.c
+# Where to find workers.properties
+# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
+JkWorkersFile conf/workers.properties
+
+# Where to put jk shared memory
+# Update this path to match your local state directory or logs directory
+JkShmFile logs/mod_jk.shm
+
+# Where to put jk logs
+# Update this path to match your logs directory location (put mod_jk.log next to access_log)
+JkLogFile logs/mod_jk.log
+
+# Set the jk log level [debug/error/info]
+JkLogLevel info
+
+# Select the timestamp log format
+JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
+
+# Send everything for context /examples to worker named worker1 (ajp13)
+# JkMount /examples/* worker1
+# Send everything for context /* to the router
+JkMount /* router
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/workers.properties b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/workers.properties
new file mode 100644
index 0000000000..9228c4fd8e
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/apache-80/conf/workers.properties
@@ -0,0 +1,18 @@
+ # Load balancer looks after the workers
+ worker.list=router
+
+ # The load balacer
+ worker.router.type=lb
+ worker.router.balance_workers=worker1,worker2
+
+ # Set properties for worker1 (ajp13)
+ worker.worker1.type=ajp13
+ worker.worker1.host=localhost
+ worker.worker1.port=8010
+ worker.worker1.lbfactor=1
+
+ # Set properties for worker1 (ajp13)
+ worker.worker2.type=ajp13
+ worker.worker2.host=localhost
+ worker.worker2.port=8011
+ worker.worker2.lbfactor=1
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml
new file mode 100644
index 0000000000..920fa7b037
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- Example Server Configuration File -->
+<!-- Note that component elements are nested corresponding to their
+ parent-child relationships with each other -->
+
+<!-- A "Server" is a singleton element that represents the entire JVM,
+ which may contain one or more "Service" instances. The Server
+ listens for a shutdown command on the indicated port.
+
+ Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+<Server port="8005" shutdown="SHUTDOWN">
+
+ <!-- Comment these entries out to disable JMX MBeans support used for the
+ administration web application -->
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+ <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
+
+ <!-- Global JNDI resources -->
+ <GlobalNamingResources>
+
+ <!-- Test entry for demonstration purposes -->
+ <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
+
+ <!-- Editable user database that can also be used by
+ UserDatabaseRealm to authenticate users -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+
+ </GlobalNamingResources>
+
+ <!-- A "Service" is a collection of one or more "Connectors" that share
+ a single "Container" (and therefore the web applications visible
+ within that Container). Normally, that Container is an "Engine",
+ but this is not required.
+
+ Note: A "Service" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+ <!-- Define the Tomcat Stand-Alone Service -->
+ <Service name="Catalina">
+
+ <!-- A "Connector" represents an endpoint by which requests are received
+ and responses are returned. Each Connector passes requests on to the
+ associated "Container" (normally an Engine) for processing.
+
+ By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
+ You can also enable an SSL HTTP/1.1 Connector on port 8443 by
+ following the instructions below and uncommenting the second Connector
+ entry. SSL support requires the following steps (see the SSL Config
+ HOWTO in the Tomcat 5 documentation bundle for more detailed
+ instructions):
+ * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
+ later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
+ * Execute:
+ %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
+ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
+ with a password value of "changeit" for both the certificate and
+ the keystore itself.
+
+ By default, DNS lookups are enabled when a web application calls
+ request.getRemoteHost(). This can have an adverse impact on
+ performance, so you can disable it by setting the
+ "enableLookups" attribute to "false". When DNS lookups are disabled,
+ request.getRemoteHost() will return the String version of the
+ IP address of the remote client.
+ -->
+
+ <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
+ <Connector port="8085" maxHttpHeaderSize="8192"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" redirectPort="8443" acceptCount="100"
+ connectionTimeout="20000" disableUploadTimeout="true" />
+ <!-- Note : To disable connection timeouts, set connectionTimeout value
+ to 0 -->
+
+ <!-- Note : To use gzip compression you could set the following properties :
+
+ compression="on"
+ compressionMinSize="2048"
+ noCompressionUserAgents="gozilla, traviata"
+ compressableMimeType="text/html,text/xml"
+ -->
+
+ <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
+ <!--
+ <Connector port="8443" maxHttpHeaderSize="8192"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" disableUploadTimeout="true"
+ acceptCount="100" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS" />
+ -->
+
+ <!-- Define an AJP 1.3 Connector on port 8009 -->
+ <Connector port="8009"
+ enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
+
+ <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
+ <!-- See proxy documentation for more information about using this. -->
+ <!--
+ <Connector port="8082"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" acceptCount="100" connectionTimeout="20000"
+ proxyPort="80" disableUploadTimeout="true" />
+ -->
+
+ <!-- An Engine represents the entry point (within Catalina) that processes
+ every request. The Engine implementation for Tomcat stand alone
+ analyzes the HTTP headers included with the request, and passes them
+ on to the appropriate Host (virtual host). -->
+
+ <!-- You should set jvmRoute to support load-balancing via AJP ie :
+ <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
+ -->
+
+ <!-- Define the top level container in our container hierarchy -->
+ <Engine name="Catalina" defaultHost="localhost">
+
+ <!-- The request dumper valve dumps useful debugging information about
+ the request headers and cookies that were received, and the response
+ headers and cookies that were sent, for all requests received by
+ this instance of Tomcat. If you care only about requests to a
+ particular virtual host, or a particular application, nest this
+ element inside the corresponding <Host> or <Context> entry instead.
+
+ For a similar mechanism that is portable to all Servlet 2.4
+ containers, check out the "RequestDumperFilter" Filter in the
+ example application (the source for this filter may be found in
+ "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
+
+ Note that this Valve uses the platform's default character encoding.
+ This may cause problems for developers in another encoding, e.g.
+ UTF-8. Use the RequestDumperFilter instead.
+
+ Also note that enabling this Valve will write a ton of stuff to your
+ logs. They are likely to grow quite large. This extensive log writing
+ will definitely slow down your server.
+
+ Request dumping is disabled by default. Uncomment the following
+ element to enable it. -->
+ <!--
+ <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
+ -->
+
+ <!-- Because this Realm is here, an instance will be shared globally -->
+
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
+ resources under the key "UserDatabase". Any edits
+ that are performed against this UserDatabase are immediately
+ available for use by the Realm. -->
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ resourceName="UserDatabase"/>
+
+ <!-- Comment out the old realm but leave here for now in case we
+ need to go back quickly -->
+ <!--
+ <Realm className="org.apache.catalina.realm.MemoryRealm" />
+ -->
+
+ <!-- Replace the above Realm with one of the following to get a Realm
+ stored in a database and accessed via JDBC -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="org.gjt.mm.mysql.Driver"
+ connectionURL="jdbc:mysql://localhost/authority"
+ connectionName="test" connectionPassword="test"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="oracle.jdbc.driver.OracleDriver"
+ connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
+ connectionName="scott" connectionPassword="tiger"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="sun.jdbc.odbc.JdbcOdbcDriver"
+ connectionURL="jdbc:odbc:CATALINA"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!-- Define the default virtual host
+ Note: XML Schema validation will not work with Xerces 2.2.
+ -->
+ <Host name="localhost" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <!-- Defines a cluster for this node,
+ By defining this element, means that every manager will be changed.
+ So when running a cluster, only make sure that you have webapps in there
+ that need to be clustered and remove the other ones.
+ A cluster has the following parameters:
+
+ className = the fully qualified name of the cluster class
+
+ clusterName = a descriptive name for your cluster, can be anything
+
+ mcastAddr = the multicast address, has to be the same for all the nodes
+
+ mcastPort = the multicast port, has to be the same for all the nodes
+
+ mcastBindAddress = bind the multicast socket to a specific address
+
+ mcastTTL = the multicast TTL if you want to limit your broadcast
+
+ mcastSoTimeout = the multicast readtimeout
+
+ mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
+
+ mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
+
+ tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
+
+ tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
+ in case of multiple ethernet cards.
+ auto means that address becomes
+ InetAddress.getLocalHost().getHostAddress()
+
+ tcpListenPort = the tcp listen port
+
+ tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
+ has a wakup bug in java.nio. Set to 0 for no timeout
+
+ printToScreen = true means that managers will also print to std.out
+
+ expireSessionsOnShutdown = true means that
+
+ useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
+ false means to replicate the session after each request.
+ false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
+ <%
+ HashMap map = (HashMap)session.getAttribute("map");
+ map.put("key","value");
+ %>
+ replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
+ * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
+ * Synchronous means that the thread that executes the request, is also the
+ thread the replicates the data to the other nodes, and will not return until all
+ nodes have received the information.
+ * Asynchronous means that there is a specific 'sender' thread for each cluster node,
+ so the request thread will queue the replication request into a "smart" queue,
+ and then return to the client.
+ The "smart" queue is a queue where when a session is added to the queue, and the same session
+ already exists in the queue from a previous request, that session will be replaced
+ in the queue instead of replicating two requests. This almost never happens, unless there is a
+ large network delay.
+ -->
+ <!--
+ When configuring for clustering, you also add in a valve to catch all the requests
+ coming in, at the end of the request, the session may or may not be replicated.
+ A session is replicated if and only if all the conditions are met:
+ 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
+ 2. a session exists (has been created)
+ 3. the request is not trapped by the "filter" attribute
+
+ The filter attribute is to filter out requests that could not modify the session,
+ hence we don't replicate the session after the end of this request.
+ The filter is negative, ie, anything you put in the filter, you mean to filter out,
+ ie, no replication will be done on requests that match one of the filters.
+ The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
+
+ filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
+ ending with .gif and .js are intercepted.
+
+ The deployer element can be used to deploy apps cluster wide.
+ Currently the deployment only deploys/undeploys to working members in the cluster
+ so no WARs are copied upons startup of a broken node.
+ The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
+ When a new war file is added the war gets deployed to the local instance,
+ and then deployed to the other instances in the cluster.
+ When a war file is deleted from the watchDir the war is undeployed locally
+ and cluster wide
+ -->
+
+ <!--
+ <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
+ managerClassName="org.apache.catalina.cluster.session.DeltaManager"
+ expireSessionsOnShutdown="false"
+ useDirtyFlag="true"
+ notifyListenersOnReplication="true">
+
+ <Membership
+ className="org.apache.catalina.cluster.mcast.McastService"
+ mcastAddr="228.0.0.4"
+ mcastPort="45564"
+ mcastFrequency="500"
+ mcastDropTime="3000"/>
+
+ <Receiver
+ className="org.apache.catalina.cluster.tcp.ReplicationListener"
+ tcpListenAddress="auto"
+ tcpListenPort="4001"
+ tcpSelectorTimeout="100"
+ tcpThreadCount="6"/>
+
+ <Sender
+ className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
+ replicationMode="pooled"
+ ackTimeout="15000"
+ waitForAck="true"/>
+
+ <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
+ filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
+
+ <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
+ tempDir="/tmp/war-temp/"
+ deployDir="/tmp/war-deploy/"
+ watchDir="/tmp/war-listen/"
+ watchEnabled="false"/>
+
+ <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
+ </Cluster>
+ -->
+
+
+
+ <!-- Normally, users must authenticate themselves to each web app
+ individually. Uncomment the following entry if you would like
+ a user to be authenticated the first time they encounter a
+ resource protected by a security constraint, and then have that
+ user identity maintained across *all* web applications contained
+ in this virtual host. -->
+ <!--
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ This access log implementation is optimized for maximum performance,
+ but is hardcoded to support only the "common" and "combined" patterns.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ </Host>
+
+ </Engine>
+
+ </Service>
+
+</Server>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/webapps/balancer/WEB-INF/config/rules.xml b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/webapps/balancer/WEB-INF/config/rules.xml
new file mode 100644
index 0000000000..7486dc8148
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8085/webapps/balancer/WEB-INF/config/rules.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.
+-->
+<rules>
+ <rule className="org.apache.tuscany.sca.demos.loadbalancer.rule.RoundRobinRule"
+ workerCount="2"
+ redirectUrl="http://localhost:8086" />
+
+ <rule className="org.apache.tuscany.sca.demos.loadbalancer.rule.RoundRobinRule"
+ workerCount="1"
+ redirectUrl="http://localhost:8087" />
+</rules>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml
new file mode 100644
index 0000000000..5ecb8fe5c4
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- Example Server Configuration File -->
+<!-- Note that component elements are nested corresponding to their
+ parent-child relationships with each other -->
+
+<!-- A "Server" is a singleton element that represents the entire JVM,
+ which may contain one or more "Service" instances. The Server
+ listens for a shutdown command on the indicated port.
+
+ Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+<Server port="8006" shutdown="SHUTDOWN">
+
+ <!-- Comment these entries out to disable JMX MBeans support used for the
+ administration web application -->
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+ <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
+
+ <!-- Global JNDI resources -->
+ <GlobalNamingResources>
+
+ <!-- Test entry for demonstration purposes -->
+ <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
+
+ <!-- Editable user database that can also be used by
+ UserDatabaseRealm to authenticate users -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+
+ </GlobalNamingResources>
+
+ <!-- A "Service" is a collection of one or more "Connectors" that share
+ a single "Container" (and therefore the web applications visible
+ within that Container). Normally, that Container is an "Engine",
+ but this is not required.
+
+ Note: A "Service" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+ <!-- Define the Tomcat Stand-Alone Service -->
+ <Service name="Catalina">
+
+ <!-- A "Connector" represents an endpoint by which requests are received
+ and responses are returned. Each Connector passes requests on to the
+ associated "Container" (normally an Engine) for processing.
+
+ By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
+ You can also enable an SSL HTTP/1.1 Connector on port 8443 by
+ following the instructions below and uncommenting the second Connector
+ entry. SSL support requires the following steps (see the SSL Config
+ HOWTO in the Tomcat 5 documentation bundle for more detailed
+ instructions):
+ * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
+ later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
+ * Execute:
+ %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
+ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
+ with a password value of "changeit" for both the certificate and
+ the keystore itself.
+
+ By default, DNS lookups are enabled when a web application calls
+ request.getRemoteHost(). This can have an adverse impact on
+ performance, so you can disable it by setting the
+ "enableLookups" attribute to "false". When DNS lookups are disabled,
+ request.getRemoteHost() will return the String version of the
+ IP address of the remote client.
+ -->
+
+ <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
+ <Connector port="8086" maxHttpHeaderSize="8192"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" redirectPort="8443" acceptCount="100"
+ connectionTimeout="20000" disableUploadTimeout="true" />
+ <!-- Note : To disable connection timeouts, set connectionTimeout value
+ to 0 -->
+
+ <!-- Note : To use gzip compression you could set the following properties :
+
+ compression="on"
+ compressionMinSize="2048"
+ noCompressionUserAgents="gozilla, traviata"
+ compressableMimeType="text/html,text/xml"
+ -->
+
+ <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
+ <!--
+ <Connector port="8443" maxHttpHeaderSize="8192"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" disableUploadTimeout="true"
+ acceptCount="100" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS" />
+ -->
+
+ <!-- Define an AJP 1.3 Connector on port 8010 -->
+ <Connector port="8010"
+ enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
+
+ <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
+ <!-- See proxy documentation for more information about using this. -->
+ <!--
+ <Connector port="8082"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" acceptCount="100" connectionTimeout="20000"
+ proxyPort="80" disableUploadTimeout="true" />
+ -->
+
+ <!-- An Engine represents the entry point (within Catalina) that processes
+ every request. The Engine implementation for Tomcat stand alone
+ analyzes the HTTP headers included with the request, and passes them
+ on to the appropriate Host (virtual host). -->
+
+ <!-- You should set jvmRoute to support load-balancing via AJP ie :
+ <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
+ -->
+
+ <!-- Define the top level container in our container hierarchy -->
+ <Engine name="Catalina" defaultHost="localhost">
+
+ <!-- The request dumper valve dumps useful debugging information about
+ the request headers and cookies that were received, and the response
+ headers and cookies that were sent, for all requests received by
+ this instance of Tomcat. If you care only about requests to a
+ particular virtual host, or a particular application, nest this
+ element inside the corresponding <Host> or <Context> entry instead.
+
+ For a similar mechanism that is portable to all Servlet 2.4
+ containers, check out the "RequestDumperFilter" Filter in the
+ example application (the source for this filter may be found in
+ "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
+
+ Note that this Valve uses the platform's default character encoding.
+ This may cause problems for developers in another encoding, e.g.
+ UTF-8. Use the RequestDumperFilter instead.
+
+ Also note that enabling this Valve will write a ton of stuff to your
+ logs. They are likely to grow quite large. This extensive log writing
+ will definitely slow down your server.
+
+ Request dumping is disabled by default. Uncomment the following
+ element to enable it. -->
+ <!--
+ <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
+ -->
+
+ <!-- Because this Realm is here, an instance will be shared globally -->
+
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
+ resources under the key "UserDatabase". Any edits
+ that are performed against this UserDatabase are immediately
+ available for use by the Realm. -->
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ resourceName="UserDatabase"/>
+
+ <!-- Comment out the old realm but leave here for now in case we
+ need to go back quickly -->
+ <!--
+ <Realm className="org.apache.catalina.realm.MemoryRealm" />
+ -->
+
+ <!-- Replace the above Realm with one of the following to get a Realm
+ stored in a database and accessed via JDBC -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="org.gjt.mm.mysql.Driver"
+ connectionURL="jdbc:mysql://localhost/authority"
+ connectionName="test" connectionPassword="test"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="oracle.jdbc.driver.OracleDriver"
+ connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
+ connectionName="scott" connectionPassword="tiger"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="sun.jdbc.odbc.JdbcOdbcDriver"
+ connectionURL="jdbc:odbc:CATALINA"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!-- Define the default virtual host
+ Note: XML Schema validation will not work with Xerces 2.2.
+ -->
+ <Host name="localhost" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <!-- Defines a cluster for this node,
+ By defining this element, means that every manager will be changed.
+ So when running a cluster, only make sure that you have webapps in there
+ that need to be clustered and remove the other ones.
+ A cluster has the following parameters:
+
+ className = the fully qualified name of the cluster class
+
+ clusterName = a descriptive name for your cluster, can be anything
+
+ mcastAddr = the multicast address, has to be the same for all the nodes
+
+ mcastPort = the multicast port, has to be the same for all the nodes
+
+ mcastBindAddress = bind the multicast socket to a specific address
+
+ mcastTTL = the multicast TTL if you want to limit your broadcast
+
+ mcastSoTimeout = the multicast readtimeout
+
+ mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
+
+ mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
+
+ tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
+
+ tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
+ in case of multiple ethernet cards.
+ auto means that address becomes
+ InetAddress.getLocalHost().getHostAddress()
+
+ tcpListenPort = the tcp listen port
+
+ tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
+ has a wakup bug in java.nio. Set to 0 for no timeout
+
+ printToScreen = true means that managers will also print to std.out
+
+ expireSessionsOnShutdown = true means that
+
+ useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
+ false means to replicate the session after each request.
+ false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
+ <%
+ HashMap map = (HashMap)session.getAttribute("map");
+ map.put("key","value");
+ %>
+ replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
+ * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
+ * Synchronous means that the thread that executes the request, is also the
+ thread the replicates the data to the other nodes, and will not return until all
+ nodes have received the information.
+ * Asynchronous means that there is a specific 'sender' thread for each cluster node,
+ so the request thread will queue the replication request into a "smart" queue,
+ and then return to the client.
+ The "smart" queue is a queue where when a session is added to the queue, and the same session
+ already exists in the queue from a previous request, that session will be replaced
+ in the queue instead of replicating two requests. This almost never happens, unless there is a
+ large network delay.
+ -->
+ <!--
+ When configuring for clustering, you also add in a valve to catch all the requests
+ coming in, at the end of the request, the session may or may not be replicated.
+ A session is replicated if and only if all the conditions are met:
+ 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
+ 2. a session exists (has been created)
+ 3. the request is not trapped by the "filter" attribute
+
+ The filter attribute is to filter out requests that could not modify the session,
+ hence we don't replicate the session after the end of this request.
+ The filter is negative, ie, anything you put in the filter, you mean to filter out,
+ ie, no replication will be done on requests that match one of the filters.
+ The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
+
+ filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
+ ending with .gif and .js are intercepted.
+
+ The deployer element can be used to deploy apps cluster wide.
+ Currently the deployment only deploys/undeploys to working members in the cluster
+ so no WARs are copied upons startup of a broken node.
+ The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
+ When a new war file is added the war gets deployed to the local instance,
+ and then deployed to the other instances in the cluster.
+ When a war file is deleted from the watchDir the war is undeployed locally
+ and cluster wide
+ -->
+
+ <!--
+ <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
+ managerClassName="org.apache.catalina.cluster.session.DeltaManager"
+ expireSessionsOnShutdown="false"
+ useDirtyFlag="true"
+ notifyListenersOnReplication="true">
+
+ <Membership
+ className="org.apache.catalina.cluster.mcast.McastService"
+ mcastAddr="228.0.0.4"
+ mcastPort="45564"
+ mcastFrequency="500"
+ mcastDropTime="3000"/>
+
+ <Receiver
+ className="org.apache.catalina.cluster.tcp.ReplicationListener"
+ tcpListenAddress="auto"
+ tcpListenPort="4001"
+ tcpSelectorTimeout="100"
+ tcpThreadCount="6"/>
+
+ <Sender
+ className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
+ replicationMode="pooled"
+ ackTimeout="15000"
+ waitForAck="true"/>
+
+ <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
+ filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
+
+ <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
+ tempDir="/tmp/war-temp/"
+ deployDir="/tmp/war-deploy/"
+ watchDir="/tmp/war-listen/"
+ watchEnabled="false"/>
+
+ <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
+ </Cluster>
+ -->
+
+
+
+ <!-- Normally, users must authenticate themselves to each web app
+ individually. Uncomment the following entry if you would like
+ a user to be authenticated the first time they encounter a
+ resource protected by a security constraint, and then have that
+ user identity maintained across *all* web applications contained
+ in this virtual host. -->
+ <!--
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ This access log implementation is optimized for maximum performance,
+ but is hardcoded to support only the "common" and "combined" patterns.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ </Host>
+
+ </Engine>
+
+ </Service>
+
+</Server>
diff --git a/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml
new file mode 100644
index 0000000000..f83c68191c
--- /dev/null
+++ b/java/sca-contrib/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- Example Server Configuration File -->
+<!-- Note that component elements are nested corresponding to their
+ parent-child relationships with each other -->
+
+<!-- A "Server" is a singleton element that represents the entire JVM,
+ which may contain one or more "Service" instances. The Server
+ listens for a shutdown command on the indicated port.
+
+ Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+<Server port="8007" shutdown="SHUTDOWN">
+
+ <!-- Comment these entries out to disable JMX MBeans support used for the
+ administration web application -->
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+ <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
+
+ <!-- Global JNDI resources -->
+ <GlobalNamingResources>
+
+ <!-- Test entry for demonstration purposes -->
+ <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
+
+ <!-- Editable user database that can also be used by
+ UserDatabaseRealm to authenticate users -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+
+ </GlobalNamingResources>
+
+ <!-- A "Service" is a collection of one or more "Connectors" that share
+ a single "Container" (and therefore the web applications visible
+ within that Container). Normally, that Container is an "Engine",
+ but this is not required.
+
+ Note: A "Service" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+ <!-- Define the Tomcat Stand-Alone Service -->
+ <Service name="Catalina">
+
+ <!-- A "Connector" represents an endpoint by which requests are received
+ and responses are returned. Each Connector passes requests on to the
+ associated "Container" (normally an Engine) for processing.
+
+ By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
+ You can also enable an SSL HTTP/1.1 Connector on port 8443 by
+ following the instructions below and uncommenting the second Connector
+ entry. SSL support requires the following steps (see the SSL Config
+ HOWTO in the Tomcat 5 documentation bundle for more detailed
+ instructions):
+ * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
+ later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
+ * Execute:
+ %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
+ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
+ with a password value of "changeit" for both the certificate and
+ the keystore itself.
+
+ By default, DNS lookups are enabled when a web application calls
+ request.getRemoteHost(). This can have an adverse impact on
+ performance, so you can disable it by setting the
+ "enableLookups" attribute to "false". When DNS lookups are disabled,
+ request.getRemoteHost() will return the String version of the
+ IP address of the remote client.
+ -->
+
+ <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
+ <Connector port="8087" maxHttpHeaderSize="8192"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" redirectPort="8443" acceptCount="100"
+ connectionTimeout="20000" disableUploadTimeout="true" />
+ <!-- Note : To disable connection timeouts, set connectionTimeout value
+ to 0 -->
+
+ <!-- Note : To use gzip compression you could set the following properties :
+
+ compression="on"
+ compressionMinSize="2048"
+ noCompressionUserAgents="gozilla, traviata"
+ compressableMimeType="text/html,text/xml"
+ -->
+
+ <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
+ <!--
+ <Connector port="8443" maxHttpHeaderSize="8192"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" disableUploadTimeout="true"
+ acceptCount="100" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS" />
+ -->
+
+ <!-- Define an AJP 1.3 Connector on port 8009 -->
+ <Connector port="8011"
+ enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
+
+ <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
+ <!-- See proxy documentation for more information about using this. -->
+ <!--
+ <Connector port="8082"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" acceptCount="100" connectionTimeout="20000"
+ proxyPort="80" disableUploadTimeout="true" />
+ -->
+
+ <!-- An Engine represents the entry point (within Catalina) that processes
+ every request. The Engine implementation for Tomcat stand alone
+ analyzes the HTTP headers included with the request, and passes them
+ on to the appropriate Host (virtual host). -->
+
+ <!-- You should set jvmRoute to support load-balancing via AJP ie :
+ <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
+ -->
+
+ <!-- Define the top level container in our container hierarchy -->
+ <Engine name="Catalina" defaultHost="localhost">
+
+ <!-- The request dumper valve dumps useful debugging information about
+ the request headers and cookies that were received, and the response
+ headers and cookies that were sent, for all requests received by
+ this instance of Tomcat. If you care only about requests to a
+ particular virtual host, or a particular application, nest this
+ element inside the corresponding <Host> or <Context> entry instead.
+
+ For a similar mechanism that is portable to all Servlet 2.4
+ containers, check out the "RequestDumperFilter" Filter in the
+ example application (the source for this filter may be found in
+ "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
+
+ Note that this Valve uses the platform's default character encoding.
+ This may cause problems for developers in another encoding, e.g.
+ UTF-8. Use the RequestDumperFilter instead.
+
+ Also note that enabling this Valve will write a ton of stuff to your
+ logs. They are likely to grow quite large. This extensive log writing
+ will definitely slow down your server.
+
+ Request dumping is disabled by default. Uncomment the following
+ element to enable it. -->
+ <!--
+ <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
+ -->
+
+ <!-- Because this Realm is here, an instance will be shared globally -->
+
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
+ resources under the key "UserDatabase". Any edits
+ that are performed against this UserDatabase are immediately
+ available for use by the Realm. -->
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ resourceName="UserDatabase"/>
+
+ <!-- Comment out the old realm but leave here for now in case we
+ need to go back quickly -->
+ <!--
+ <Realm className="org.apache.catalina.realm.MemoryRealm" />
+ -->
+
+ <!-- Replace the above Realm with one of the following to get a Realm
+ stored in a database and accessed via JDBC -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="org.gjt.mm.mysql.Driver"
+ connectionURL="jdbc:mysql://localhost/authority"
+ connectionName="test" connectionPassword="test"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="oracle.jdbc.driver.OracleDriver"
+ connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
+ connectionName="scott" connectionPassword="tiger"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm"
+ driverName="sun.jdbc.odbc.JdbcOdbcDriver"
+ connectionURL="jdbc:odbc:CATALINA"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!-- Define the default virtual host
+ Note: XML Schema validation will not work with Xerces 2.2.
+ -->
+ <Host name="localhost" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <!-- Defines a cluster for this node,
+ By defining this element, means that every manager will be changed.
+ So when running a cluster, only make sure that you have webapps in there
+ that need to be clustered and remove the other ones.
+ A cluster has the following parameters:
+
+ className = the fully qualified name of the cluster class
+
+ clusterName = a descriptive name for your cluster, can be anything
+
+ mcastAddr = the multicast address, has to be the same for all the nodes
+
+ mcastPort = the multicast port, has to be the same for all the nodes
+
+ mcastBindAddress = bind the multicast socket to a specific address
+
+ mcastTTL = the multicast TTL if you want to limit your broadcast
+
+ mcastSoTimeout = the multicast readtimeout
+
+ mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
+
+ mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
+
+ tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
+
+ tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
+ in case of multiple ethernet cards.
+ auto means that address becomes
+ InetAddress.getLocalHost().getHostAddress()
+
+ tcpListenPort = the tcp listen port
+
+ tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
+ has a wakup bug in java.nio. Set to 0 for no timeout
+
+ printToScreen = true means that managers will also print to std.out
+
+ expireSessionsOnShutdown = true means that
+
+ useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
+ false means to replicate the session after each request.
+ false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
+ <%
+ HashMap map = (HashMap)session.getAttribute("map");
+ map.put("key","value");
+ %>
+ replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
+ * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
+ * Synchronous means that the thread that executes the request, is also the
+ thread the replicates the data to the other nodes, and will not return until all
+ nodes have received the information.
+ * Asynchronous means that there is a specific 'sender' thread for each cluster node,
+ so the request thread will queue the replication request into a "smart" queue,
+ and then return to the client.
+ The "smart" queue is a queue where when a session is added to the queue, and the same session
+ already exists in the queue from a previous request, that session will be replaced
+ in the queue instead of replicating two requests. This almost never happens, unless there is a
+ large network delay.
+ -->
+ <!--
+ When configuring for clustering, you also add in a valve to catch all the requests
+ coming in, at the end of the request, the session may or may not be replicated.
+ A session is replicated if and only if all the conditions are met:
+ 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
+ 2. a session exists (has been created)
+ 3. the request is not trapped by the "filter" attribute
+
+ The filter attribute is to filter out requests that could not modify the session,
+ hence we don't replicate the session after the end of this request.
+ The filter is negative, ie, anything you put in the filter, you mean to filter out,
+ ie, no replication will be done on requests that match one of the filters.
+ The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
+
+ filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
+ ending with .gif and .js are intercepted.
+
+ The deployer element can be used to deploy apps cluster wide.
+ Currently the deployment only deploys/undeploys to working members in the cluster
+ so no WARs are copied upons startup of a broken node.
+ The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
+ When a new war file is added the war gets deployed to the local instance,
+ and then deployed to the other instances in the cluster.
+ When a war file is deleted from the watchDir the war is undeployed locally
+ and cluster wide
+ -->
+
+ <!--
+ <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
+ managerClassName="org.apache.catalina.cluster.session.DeltaManager"
+ expireSessionsOnShutdown="false"
+ useDirtyFlag="true"
+ notifyListenersOnReplication="true">
+
+ <Membership
+ className="org.apache.catalina.cluster.mcast.McastService"
+ mcastAddr="228.0.0.4"
+ mcastPort="45564"
+ mcastFrequency="500"
+ mcastDropTime="3000"/>
+
+ <Receiver
+ className="org.apache.catalina.cluster.tcp.ReplicationListener"
+ tcpListenAddress="auto"
+ tcpListenPort="4001"
+ tcpSelectorTimeout="100"
+ tcpThreadCount="6"/>
+
+ <Sender
+ className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
+ replicationMode="pooled"
+ ackTimeout="15000"
+ waitForAck="true"/>
+
+ <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
+ filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
+
+ <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
+ tempDir="/tmp/war-temp/"
+ deployDir="/tmp/war-deploy/"
+ watchDir="/tmp/war-listen/"
+ watchEnabled="false"/>
+
+ <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
+ </Cluster>
+ -->
+
+
+
+ <!-- Normally, users must authenticate themselves to each web app
+ individually. Uncomment the following entry if you would like
+ a user to be authenticated the first time they encounter a
+ resource protected by a security constraint, and then have that
+ user identity maintained across *all* web applications contained
+ in this virtual host. -->
+ <!--
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ This access log implementation is optimized for maximum performance,
+ but is hardcoded to support only the "common" and "combined" patterns.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ </Host>
+
+ </Engine>
+
+ </Service>
+
+</Server>
diff --git a/java/sca-contrib/demos/mortgage-creditcheck/LICENSE b/java/sca-contrib/demos/mortgage-creditcheck/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-creditcheck/NOTICE b/java/sca-contrib/demos/mortgage-creditcheck/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-creditcheck/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/mortgage-creditcheck/README b/java/sca-contrib/demos/mortgage-creditcheck/README
new file mode 100644
index 0000000000..b785802920
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-creditcheck/build.xml b/java/sca-contrib/demos/mortgage-creditcheck/build.xml
new file mode 100644
index 0000000000..59f1342276
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-creditcheck/pom.xml b/java/sca-contrib/demos/mortgage-creditcheck/pom.xml
new file mode 100644
index 0000000000..a5e268812b
--- /dev/null
+++ b/java/sca-contrib/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>2.0-SNAPSHOT</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>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+
+</project>
diff --git a/java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java b/java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java
new file mode 100644
index 0000000000..26048de722
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface CreditCheck {
+ int getCreditScore(String ssn);
+}
diff --git a/java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java b/java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java
new file mode 100644
index 0000000000..20a0c5dd7f
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java b/java/sca-contrib/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java
new file mode 100644
index 0000000000..870ea1941d
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite b/java/sca-contrib/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite
new file mode 100644
index 0000000000..5c828f5a39
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl b/java/sca-contrib/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl
new file mode 100644
index 0000000000..9c2acc96d3
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml b/java/sca-contrib/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..aea009292a
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml b/java/sca-contrib/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..d7b2e32dd1
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/LICENSE b/java/sca-contrib/demos/mortgage-loanapproval/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/NOTICE b/java/sca-contrib/demos/mortgage-loanapproval/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/README b/java/sca-contrib/demos/mortgage-loanapproval/README
new file mode 100644
index 0000000000..dbf3829a20
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/build.xml b/java/sca-contrib/demos/mortgage-loanapproval/build.xml
new file mode 100644
index 0000000000..9a0a83bf1d
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.jpg
new file mode 100644
index 0000000000..e28ed63cfb
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.png
new file mode 100644
index 0000000000..0bfce0078d
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/credit_composite.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.jpg
new file mode 100644
index 0000000000..3f00557c7f
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.png
new file mode 100644
index 0000000000..9d5f829fe5
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/loan_approval.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg
new file mode 100644
index 0000000000..515b6ecde7
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.png
new file mode 100644
index 0000000000..4b815a4b82
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly0.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg
new file mode 100644
index 0000000000..01a7c55a14
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.png
new file mode 100644
index 0000000000..07422c4f45
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly1.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg
new file mode 100644
index 0000000000..992c048684
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.png
new file mode 100644
index 0000000000..4667956ed0
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_assembly2.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.jpg
new file mode 100644
index 0000000000..5021f6a317
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.png
new file mode 100644
index 0000000000..1398c50ded
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_composite.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc
new file mode 100644
index 0000000000..32a0b72907
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.jpg
new file mode 100644
index 0000000000..e91c5f1bbd
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.png
new file mode 100644
index 0000000000..db304a4c28
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package1.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.jpg
new file mode 100644
index 0000000000..e8c2865e4a
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.png
new file mode 100644
index 0000000000..502e538e94
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_package2.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg
new file mode 100644
index 0000000000..fccf2e35c3
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.png b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.png
new file mode 100644
index 0000000000..b8f42ad318
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/doc/mortgage_scenario.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/mortgage_assembly.png b/java/sca-contrib/demos/mortgage-loanapproval/mortgage_assembly.png
new file mode 100644
index 0000000000..4667956ed0
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/mortgage_assembly.png
Binary files differ
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/pom.xml b/java/sca-contrib/demos/mortgage-loanapproval/pom.xml
new file mode 100644
index 0000000000..2947a59ee9
--- /dev/null
+++ b/java/sca-contrib/demos/mortgage-loanapproval/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-demos</artifactId>
+ <version>2.0-SNAPSHOT</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.4-SNAPSHOT</property>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java
new file mode 100644
index 0000000000..2d830fdf7a
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+
+/**
+ * CreditCheck interface
+ */
+@Remotable
+public interface CreditCheck {
+ int getCreditScore(String ssn);
+}
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java
new file mode 100644
index 0000000000..8f85bc7d9c
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java
new file mode 100644
index 0000000000..66a486d516
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java
new file mode 100644
index 0000000000..b5bafeb204
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java
new file mode 100644
index 0000000000..e5d7a1f077
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java
new file mode 100644
index 0000000000..dcdad18496
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java
new file mode 100644
index 0000000000..f211e1356c
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java
new file mode 100644
index 0000000000..350b2c24ea
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The Mortgage Calculator service interface.
+ */
+@Remotable
+public interface MortgageCalculator {
+ public double getMonthlyPayment(double principal, int years, float interestRate);
+}
diff --git a/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java
new file mode 100644
index 0000000000..839e9e098c
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java
new file mode 100644
index 0000000000..d69f0a1163
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java
new file mode 100644
index 0000000000..23c9589e85
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java b/java/sca-contrib/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java
new file mode 100644
index 0000000000..0e88093c61
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite b/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite
new file mode 100644
index 0000000000..d1128b9907
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite b/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite
new file mode 100644
index 0000000000..4cad6c7223
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType b/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType
new file mode 100644
index 0000000000..bf7b10e0f7
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js b/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js
new file mode 100644
index 0000000000..b25af1d039
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl b/java/sca-contrib/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl
new file mode 100644
index 0000000000..9c2acc96d3
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java b/java/sca-contrib/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java
new file mode 100644
index 0000000000..285cc72515
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/pom.xml b/java/sca-contrib/demos/pom.xml
new file mode 100644
index 0000000000..9ada7dba1e
--- /dev/null
+++ b/java/sca-contrib/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>2.0-SNAPSHOT</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/java/sca-contrib/demos/workpool-distributed/LICENSE b/java/sca-contrib/demos/workpool-distributed/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/java/sca-contrib/demos/workpool-distributed/NOTICE b/java/sca-contrib/demos/workpool-distributed/NOTICE
new file mode 100644
index 0000000000..25bb89c9b2
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/workpool-distributed/build.xml b/java/sca-contrib/demos/workpool-distributed/build.xml
new file mode 100644
index 0000000000..9e10e8ec91
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/build.xml
@@ -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.
+-->
+<project name="workpool" default="runDomainNode">
+ <property name="node.class" value="node.WorkpoolNode" />
+ <property name="domain.class" value="node.DomainNode" />
+ <property name="test.jar" value="sample-workpool-distributed-dynamic.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>
+ <fileset dir="./rule-engine" id="drools.jar">
+ <include name="*.jar"/>
+ </fileset>
+ <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="${node.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="runDomainNode">
+ <java classname="${domain.class}"
+ fork="true">
+ <classpath>
+ <fileset dir="./rule-engine" id="drools.jar">
+ <include name="*.jar"/>
+ </fileset>
+
+
+ <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>
+<fileset dir="./rule-engine" id="drools.jar">
+ <include name="*.jar"/>
+ </fileset>
+
+
+
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeA"/>
+ <!-- iterations -->
+ <arg value="10"/>
+ <!-- jobs -->
+ <arg value="1024"/>
+ <!-- workers -->
+ <arg value="4" />
+ </java>
+ </target>
+
+ <target name="runNodeB">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+<fileset dir="./rule-engine" id="drools.jar">
+ <include name="*.jar"/>
+ </fileset>
+
+
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeB"/>
+ <!-- iterations -->
+ <arg value="1000000"/>
+ <!-- jobs -->
+ <arg value="1024"/>
+ <!-- workers -->
+ <arg value="4" />
+ </java>
+ </target>
+
+ <target name="runNodeC">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <fileset dir="./rule-engine" id="drools.jar">
+ <include name="*.jar"/>
+ </fileset>
+
+ <pathelement location="${drools.jar}"/>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeC"/>
+ <!-- iterations -->
+ <arg value="1000000"/>
+ <!-- jobs -->
+ <arg value="1024"/>
+ <!-- workers -->
+ <arg value="4" />
+ </java>
+ </target>
+ <target name="runNodeD">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <fileset dir="./rule-engine" id="drools.jar">
+ <include name="*.jar"/>
+ </fileset>
+
+ <pathelement location="${drools.jar}"/>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeD"/>
+ <!-- iterations -->
+ <arg value="1000000"/>
+ <!-- jobs -->
+ <arg value="1024"/>
+ <!-- workers -->
+ <arg value="4" />
+ </java>
+ </target>
+ <target name="runNodeE">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <fileset dir="./rule-engine" id="drools.jar">
+ <include name="*.jar"/>
+ </fileset>
+
+ <pathelement location="${drools.jar}"/>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeE"/>
+ <!-- iterations -->
+ <arg value="1000000"/>
+ <!-- jobs -->
+ <arg value="1024"/>
+ <!-- workers -->
+ <arg value="4" />
+ </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="/var/cache/maven/repo" />
+ <path id="repo.classpath">
+ <pathelement location="target/classes"/>
+ <pathelement location="/var/cache/maven/repo/antlr/antlr/2.7.6/antlr-2.7.6.jar"/>
+ <pathelement location="/var/cache/maven/repo/antlr/stringtemplate/2.3b6/stringtemplate-2.3b6.jar"/>
+ <pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.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}\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}\org\apache\tuscany\sca\tuscany-binding-sca\1.0-incubating\tuscany-binding-sca-1.0-incubating.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-assembly-xml\1.0-incubating\tuscany-assembly-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-trust\1.3\rampart-trust-1.3.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-assembly\1.0-incubating\tuscany-assembly-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.0-incubating\tuscany-interface-wsdl-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.3\axis2-kernel-1.3.jar"/>
+ <pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.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}\org\apache\httpcomponents\httpcore\4.0-alpha5\httpcore-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface\1.0-incubating\tuscany-interface-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.0-incubating\tuscany-policy-xml-1.0-incubating.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-domain-api\1.0-incubating\tuscany-domain-api-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-extension-helper\1.0-incubating\tuscany-extension-helper-1.0-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-binding-jsonrpc\1.0-incubating\tuscany-binding-jsonrpc-1.0-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-interface-java-xml\1.0-incubating\tuscany-interface-java-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\bouncycastle\bcprov-jdk15\136\bcprov-jdk15-136.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}\org\apache\tuscany\sca\tuscany-node\1.0-incubating\tuscany-node-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-adb\1.3\axis2-adb-1.3.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-definitions\1.0-incubating\tuscany-definitions-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-embedded\1.0-incubating\tuscany-host-embedded-1.0-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\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-binding-ws-xml\1.0-incubating\tuscany-binding-ws-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-java\1.0-incubating\tuscany-contribution-java-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain-impl\1.0-incubating\tuscany-domain-impl-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\xalan\xalan\2.7.0\xalan-2.7.0.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-policy-security\1.0-incubating\tuscany-policy-security-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.0-incubating\tuscany-core-spi-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-axis2\1.0-incubating\tuscany-binding-sca-axis2-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\jaxen\jaxen\1.1-beta-9\jaxen-1.1-beta-9.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-sca-api\1.0-incubating\tuscany-sca-api-1.0-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}\com\metaparadigm\json-rpc\1.0\json-rpc-1.0.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-binding-ws\1.0-incubating\tuscany-binding-ws-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-namespace\1.0-incubating\tuscany-contribution-namespace-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy\1.0-incubating\tuscany-policy-1.0-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-xml\1.0-incubating\tuscany-interface-wsdl-xml-1.0-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-core\1.0-incubating\tuscany-core-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain\1.0-incubating\tuscany-domain-1.0-incubating.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}\org\apache\tuscany\sca\tuscany-contribution\1.0-incubating\tuscany-contribution-1.0-incubating.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-node-impl\1.0-incubating\tuscany-node-impl-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\santuario\xmlsec\1.4.0\xmlsec-1.4.0.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-databinding\1.0-incubating\tuscany-databinding-1.0-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\codehaus\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.0-incubating\tuscany-binding-ws-axis2-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-http\1.0-incubating\tuscany-host-http-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.0-incubating\tuscany-databinding-axiom-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.0-incubating\tuscany-contribution-impl-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.0-incubating\tuscany-interface-java-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.2\XmlSchema-1.3.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-binding-sca-xml\1.0-incubating\tuscany-binding-sca-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-databinding\1.0-incubating\tuscany-core-databinding-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca\1.0-incubating\tuscany-binding-sca-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-resource\1.0-incubating\tuscany-implementation-resource-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-trust\1.3\rampart-trust-1.3.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-assembly\1.0-incubating\tuscany-assembly-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.0-incubating\tuscany-policy-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-extension-helper\1.0-incubating\tuscany-extension-helper-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node-api\1.0-incubating\tuscany-node-api-1.0-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-host-tomcat\1.0-incubating\tuscany-host-tomcat-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\opensaml\opensaml\1.1\opensaml-1.1.jar"/>
+ <pathelement location="${m2.repo}\logkit\logkit\1.0.1\logkit-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\bouncycastle\bcprov-jdk15\136\bcprov-jdk15-136.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xsd\1.0-incubating\tuscany-assembly-xsd-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\annogen\annogen\0.1.0\annogen-0.1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-xmlbeans\1.3\axis2-xmlbeans-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-adb\1.3\axis2-adb-1.3.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-binding-http\1.0-incubating\tuscany-binding-http-1.0-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-java\1.0-incubating\tuscany-contribution-java-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain-impl\1.0-incubating\tuscany-domain-impl-1.0-incubating.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-policy-security\1.0-incubating\tuscany-policy-security-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tomcat\catalina\6.0.10\catalina-6.0.10.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.0-incubating\tuscany-core-spi-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-axis2\1.0-incubating\tuscany-binding-sca-axis2-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\jaxen\jaxen\1.1-beta-9\jaxen-1.1-beta-9.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\tuscany\sca\tuscany-contribution-namespace\1.0-incubating\tuscany-contribution-namespace-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-xml\1.0-incubating\tuscany-implementation-java-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl-xml\1.0-incubating\tuscany-interface-wsdl-xml-1.0-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-core\1.0-incubating\tuscany-core-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain\1.0-incubating\tuscany-domain-1.0-incubating.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}\commons-io\commons-io\1.2\commons-io-1.2.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}\org\apache\tuscany\sca\tuscany-host-http\1.0-incubating\tuscany-host-http-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.0-incubating\tuscany-interface-java-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.0-incubating\tuscany-contribution-impl-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.2\XmlSchema-1.3.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-binding-sca-xml\1.0-incubating\tuscany-binding-sca-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.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}\commons-codec\commons-codec\1.3\commons-codec-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\security\wss4j\1.5.3\wss4j-1.5.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\tuscany\sca\tuscany-assembly-xml\1.0-incubating\tuscany-assembly-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.0-incubating\tuscany-interface-wsdl-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.3\axis2-kernel-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}\org\apache\tuscany\sca\tuscany-interface\1.0-incubating\tuscany-interface-1.0-incubating.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-binding-jsonrpc\1.0-incubating\tuscany-binding-jsonrpc-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.0-incubating\tuscany-interface-java-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\commons-fileupload\commons-fileupload\1.1.1\commons-fileupload-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node\1.0-incubating\tuscany-node-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-definitions\1.0-incubating\tuscany-definitions-1.0-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-host-embedded\1.0-incubating\tuscany-host-embedded-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\commons-collections\commons-collections\3.1\commons-collections-3.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-xml\1.0-incubating\tuscany-binding-ws-xml-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-runtime\1.0-incubating\tuscany-implementation-java-runtime-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\xalan\xalan\2.7.0\xalan-2.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-codegen\1.3\axis2-adb-codegen-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-sca-api\1.0-incubating\tuscany-sca-api-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tomcat\coyote\6.0.10\coyote-6.0.10.jar"/>
+ <pathelement location="${m2.repo}\com\metaparadigm\json-rpc\1.0\json-rpc-1.0.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-binding-ws\1.0-incubating\tuscany-binding-ws-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\commons-discovery\commons-discovery\0.2\commons-discovery-0.2.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-policy\1.0-incubating\tuscany-policy-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java\1.0-incubating\tuscany-implementation-java-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution\1.0-incubating\tuscany-contribution-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tomcat\annotations-api\6.0.10\annotations-api-6.0.10.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node-impl\1.0-incubating\tuscany-node-impl-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\santuario\xmlsec\1.4.0\xmlsec-1.4.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tomcat\juli\6.0.10\juli-6.0.10.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding\1.0-incubating\tuscany-databinding-1.0-incubating.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}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.0-incubating\tuscany-binding-ws-axis2-1.0-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.0-incubating\tuscany-databinding-axiom-1.0-incubating.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-core-databinding\1.0-incubating\tuscany-core-databinding-1.0-incubating.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="http://u12:8877/"/>
+ <arg value="nodeA"/>
+ </java>
+ </target>
+
+ <target name="runNodeARepoLoop">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeA"/>
+ <arg value="loop"/>
+ </java>
+ </target>
+
+ <target name="runNodeBRepo">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeB"/>
+ </java>
+ </target>
+
+ <target name="runNodeCRepo">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ <arg value="http://u12:8877/"/>
+ <arg value="nodeC"/>
+ </java>
+ </target>
+
+</project>
diff --git a/java/sca-contrib/demos/workpool-distributed/pom.xml b/java/sca-contrib/demos/workpool-distributed/pom.xml
new file mode 100644
index 0000000000..6d441bdfaf
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-workpool-distributed</artifactId>
+ <name>Apache Tuscany SCA Distributed Job Workpool Demo</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>
+ http://people.apache.org/repo/m2-incubating-repository
+ </url>
+ </repository>
+ <repository>
+ <id>org.drools</id>
+ <url>http://repository.jboss.com/maven2/org/drools/</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools</artifactId>
+ <version>4.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>2.7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-daemon</groupId>
+ <artifactId>commons-daemon</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>antlr</groupId>
+ <artifactId>stringtemplate</artifactId>
+ <version>2.3b6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-job</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-updater</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-xstream</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>2.0-SNAPSHOT</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/java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNode.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNode.java
new file mode 100644
index 0000000000..a278499aae
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNode.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 node;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * 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 DomainNode {
+
+ private static String DEFAULT_DOMAIN_URI = "http://u12:8877";
+ private boolean stopped = true;
+
+ public static void main(String[] args) {
+
+ try {
+
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ SCADomain domain = domainFactory
+ .createSCADomain(DEFAULT_DOMAIN_URI);
+
+ System.out.println("Domain started (press enter to shutdown)");
+ System.in.read();
+ // waitForever();
+ domain.destroy();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("Domain stopped");
+ }
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNodeDaemon.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNodeDaemon.java
new file mode 100644
index 0000000000..9d05761ad6
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/DomainNodeDaemon.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 node;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.commons.daemon.Daemon;
+import org.apache.commons.daemon.DaemonContext;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * 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 DomainNodeDaemon implements Daemon {
+
+ private SCADomain domain;
+ private static String DEFAULT_DOMAIN_URI = "http://u12:8877";
+ private boolean stopped = true;
+
+ private synchronized void waitForever() {
+ while (!stopped) {
+ try {
+ wait();
+ } catch (InterruptedException ex) {
+ stopped = true;
+ return;
+ }
+ }
+
+ }
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init(DaemonContext arg0) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void start() throws Exception {
+
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain = domainFactory.createSCADomain(DEFAULT_DOMAIN_URI);
+
+ System.out.println("Domain started (press enter to shutdown)");
+ waitForever();
+
+ }
+
+ public void stop() throws Exception {
+ // TODO Auto-generated method stub
+ Thread.currentThread().interrupt();
+ domain.destroy();
+ }
+} \ No newline at end of file
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/node/TestJob.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/TestJob.java
new file mode 100644
index 0000000000..f48e647bd6
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/TestJob.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 node;
+
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.databinding.job.JobDataMap;
+import org.apache.tuscany.sca.databinding.job.JobExecutionContext;
+import org.apache.tuscany.sca.databinding.job.RemoteJob;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;
+
+public class TestJob extends RemoteJob<Double> implements java.io.Serializable {
+ private boolean EOS = false;
+ private Double value;
+
+ public TestJob(Double x, long iterations, int[] items) {
+ JobDataMap map = new JobDataMap();
+ map.addJobData("value", x);
+ map.addJobData("iterations", iterations);
+ map.addJobData("items", items);
+ context.setJobData(map);
+ }
+
+ public TestJob(Double i, boolean eos) {
+ value = i;
+ this.EOS = eos;
+ }
+
+ public TestJob(String jsonData) {
+ JobExecutionContext ctxt = new JobExecutionContext();
+ ctxt.storeJSONData(jsonData);
+ }
+
+ public int getType() {
+ return Job.REGULAR_JOB;
+ }
+
+ public void setEOS() {
+ EOS = true;
+ }
+
+ public boolean eos() {
+ return EOS;
+ }
+
+ @Override
+ public Double compute(JobExecutionContext context) {
+ JobDataMap contextMap = context.getJobData();
+ Long iterations = (Long) contextMap.getJobDataObject("iterations");
+ Double value = (Double) contextMap.getJobDataObject("value");
+ double x = value.doubleValue();
+ System.out.println("Computing sinx for " + value + " for "
+ + iterations.intValue() + " times");
+ long computing_start = System.currentTimeMillis();
+ for (long i = 0; i < iterations.longValue(); ++i) {
+ x = Math.sin(x);
+ }
+ long computing_end = System.currentTimeMillis();
+ System.out.println("Computing time= "
+ + (computing_end - computing_start));
+ System.out.println("Send result = " + x);
+ return new Double(x);
+ }
+
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolDaemon.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolDaemon.java
new file mode 100644
index 0000000000..1f2a4d1f9a
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolDaemon.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 node;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.daemon.Daemon;
+import org.apache.commons.daemon.DaemonContext;
+import org.apache.commons.daemon.DaemonController;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.NodeManagerInitService;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.SCANodeImpl;
+import org.apache.tuscany.sca.node.management.SCANodeManagerInitService;
+
+import java.net.URI;
+
+import workpool.WorkerManager;
+import workpool.WorkerManagerImpl;
+import workpool.WorkpoolManager;
+import workpool.WorkpoolService;
+import workpool.WorkpoolServiceImpl;
+
+/**
+ * This client program shows how to run a distributed SCA node. In this case a
+ * calculator node has been constructed specifically for running the calculator
+ * composite. Internally it creates a representation of a node and associates a
+ * distributed domain with the node. This separation is made different
+ * implementations of the distributed domain can be provided.
+ */
+public class WorkpoolDaemon implements Daemon, Runnable {
+ private String domainName;
+ private String nodeName;
+ private long iterations;
+ private long jobsNo;
+ private long workerNo;
+ private SCANode node;
+ private boolean stopped = false;
+ private DaemonController controller = null;
+ private Thread thread = null;
+ private String ruleFile = "workerRules.drl";
+
+ /*
+ * public static void main(String[] args) throws Exception {
+ * // Check that the correct arguments have been provided if (null == args ||
+ * args.length < 4) { System.err.println("Usage: java WorkpoolNode
+ * domainname nodename iterTest workerNo"); System.exit(1); }
+ *
+ * try { String domainName = args[0]; String nodeName = args[1]; long
+ * iterations = Long.parseLong(args[2]); long jobsNo =
+ * Long.parseLong(args[3]); long workerNo = Long.parseLong(args[4]);
+ * ClassLoader cl = WorkpoolDaemon.class.getClassLoader();
+ *
+ * SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); node =
+ * nodeFactory.createSCANode(null, domainName);
+ * node.addContribution(nodeName, cl.getResource(nodeName + "/"));
+ * node.addToDomainLevelComposite(new QName("http://sample", "Workpool"));
+ * node.start(); // nodeA is the head node and runs some tests while all
+ * other nodes // simply listen for incoming messages
+ *
+ * FileReader rules = new FileReader("workerRules.drl"); StringBuffer buffer =
+ * new StringBuffer();
+ *
+ * BufferedReader br = new BufferedReader(rules); String ruleString; do {
+ * ruleString = br.readLine(); if (ruleString!=null) {
+ * buffer.append(ruleString);} } while (ruleString!=null);
+ *
+ * if ( nodeName.equals("nodeA") ) { // do some application stuff
+ * WorkpoolService workpoolService =
+ * node.getDomain().getService(WorkpoolService.class,
+ * "WorkpoolServiceComponent"); workpoolService.start();
+ * NodeManagerInitService nodeInit =
+ * node.getDomain().getService(NodeManagerInitService.class,
+ * "WorkpoolManagerComponent/NodeManagerInitService");
+ * nodeInit.setNode(node); WorkpoolManager workpoolManager =
+ * node.getDomain().getService(WorkpoolManager.class,
+ * "WorkpoolManagerComponent/WorkpoolManager");
+ * workpoolManager.setWorkpoolReference(node.getDomain().getServiceReference(WorkpoolService.class,
+ * "WorkpoolServiceComponent"));
+ * workpoolManager.acceptRules(buffer.toString()); workpoolManager.start();
+ * int items[] = {3,4,5,6,3,6,3,5,9,5,6};
+ *
+ * double x = 398349; for (int i = 0; i < jobsNo; ++i)
+ * workpoolService.submit(new TestJob(x,iterations,items));
+ *
+ * TestJob j = new TestJob(-1.0,true); for (int i = 0; i < workerNo+1; ++i){
+ * j.setEOS(); workpoolService.submit(j); } } try { if
+ * (nodeName.equals("nodeB")) { NodeManagerInitService serviceNodeB =
+ * node.getDomain().getService(NodeManagerInitService.class,"WorkerManagerNodeBComponent/NodeManagerInitService");
+ * serviceNodeB.setNode(node); } if (nodeName.equals("nodeC")) {
+ * NodeManagerInitService workerManagerC =
+ * node.getDomain().getService(NodeManagerInitService.class,"WorkerManagerNodeCComponent/NodeManagerInitService");
+ * workerManagerC.setNode(node); } if (nodeName.equals("nodeD")) {
+ * NodeManagerInitService workerManagerD =
+ * node.getDomain().getService(NodeManagerInitService.class,"WorkerManagerNodeDComponent/NodeManagerInitService");
+ * workerManagerD.setNode(node); } if (nodeName.equals("nodeE")) {
+ * NodeManagerInitService workerManagerE =
+ * node.getDomain().getService(NodeManagerInitService.class,"WorkerManagerNodeEComponent/NodeManagerInitService");
+ * workerManagerE.setNode(node); }
+ *
+ * System.out.println("Node started (press enter to shutdown)");
+ * System.in.read(); } catch (IOException e) { e.printStackTrace(); } //
+ * stop the node and all the domains in it node.stop(); node.destroy();
+ * System.exit(0); } catch(Exception ex) { System.err.println("Exception in
+ * node - " + ex.getMessage()); ex.printStackTrace(System.err); } }
+ */
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init(DaemonContext arg0) throws Exception {
+ String[] args = arg0.getArguments();
+ domainName = args[0];
+ nodeName = args[1];
+ iterations = Long.parseLong(args[2]);
+ jobsNo = Long.parseLong(args[3]);
+ workerNo = Long.parseLong(args[4]);
+ if (args.length == 6) {
+ ruleFile = args[5];
+ }
+ this.controller = arg0.getController();
+ // this.thread=new Thread(this);
+ }
+
+ public void start() throws Exception {
+
+ ClassLoader cl = WorkpoolDaemon.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(null, domainName);
+ node.addContribution(nodeName, cl.getResource(nodeName + "/"));
+ node.addToDomainLevelComposite(new QName("http://sample", "Workpool"));
+ node.start();
+ // nodeA is the head node and runs some tests while all other nodes
+ // simply listen for incoming messages
+
+ FileReader rules = new FileReader(ruleFile);
+ StringBuffer buffer = new StringBuffer();
+
+ BufferedReader br = new BufferedReader(rules);
+ String ruleString;
+ do {
+ ruleString = br.readLine();
+ if (ruleString != null) {
+ buffer.append(ruleString + "\n");
+ }
+ } while (ruleString != null);
+
+ if (nodeName.equals("nodeA")) {
+ // do some application stuff
+ WorkpoolService workpoolService = node.getDomain().getService(
+ WorkpoolService.class, "WorkpoolServiceComponent");
+ workpoolService.start();
+ SCANodeManagerInitService nodeInit = node.getDomain().getService(
+ SCANodeManagerInitService.class,
+ "WorkpoolManagerComponent/NodeManagerInitService");
+ nodeInit.setNode(node);
+ WorkpoolManager workpoolManager = node.getDomain().getService(
+ WorkpoolManager.class,
+ "WorkpoolManagerComponent/WorkpoolManager");
+ workpoolManager.setWorkpoolReference(node.getDomain()
+ .getServiceReference(WorkpoolService.class,
+ "WorkpoolServiceComponent"));
+ workpoolManager.acceptRules(buffer.toString());
+ workpoolManager.start();
+
+ int items[] = { 3, 4, 5, 6, 3, 6, 3, 5, 9, 5, 6 };
+
+ double x = 398349;
+ for (int i = 0; i < jobsNo; ++i) {
+ workpoolService.submit(new TestJob(x, iterations, items));
+ }
+ TestJob j = new TestJob(-1.0, true);
+ for (int i = 0; i < workerNo + 1; ++i) {
+ j.setEOS();
+ workpoolService.submit(j);
+ }
+
+ }
+ if (nodeName.equals("nodeB")) {
+ SCANodeManagerInitService workerManagerNodeB = node
+ .getDomain()
+ .getService(SCANodeManagerInitService.class,
+ "WorkerManagerNodeBComponent/NodeManagerInitService");
+ workerManagerNodeB.setNode(node);
+ }
+
+ if (nodeName.equals("nodeC")) {
+ SCANodeManagerInitService workerManagerNodeC = node
+ .getDomain()
+ .getService(SCANodeManagerInitService.class,
+ "WorkerManagerNodeCComponent/NodeManagerInitService");
+ workerManagerNodeC.setNode(node);
+ }
+
+ if (nodeName.equals("nodeD")) {
+ SCANodeManagerInitService workerManagerNodeD = node
+ .getDomain()
+ .getService(SCANodeManagerInitService.class,
+ "WorkerManagerNodeDComponent/NodeManagerInitService");
+ workerManagerNodeD.setNode(node);
+ }
+
+ if (nodeName.equals("nodeE")) {
+ SCANodeManagerInitService workerManagerNodeE = node
+ .getDomain()
+ .getService(SCANodeManagerInitService.class,
+ "WorkerManagerNodeEComponent/NodeManagerInitService");
+ workerManagerNodeE.setNode(node);
+ }
+
+ this.waitForever();
+ // this.thread.start();
+ }
+
+ public void stop() throws Exception {
+ Thread.currentThread().interrupt();
+ // thread.interrupt();
+ node.stop();
+ node.destroy();
+ }
+
+ private synchronized void waitForever() {
+ while (!stopped) {
+ try {
+ wait();
+ } catch (InterruptedException ex) {
+ stopped = true;
+ return;
+ }
+ }
+ }
+
+ public void run() {
+ waitForever();
+ }
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolNode.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolNode.java
new file mode 100644
index 0000000000..86557548af
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/WorkpoolNode.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 node;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.NodeManagerInitService;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.SCANodeImpl;
+import java.net.URI;
+
+import workpool.WorkerManager;
+import workpool.WorkerManagerImpl;
+import workpool.WorkpoolManager;
+import workpool.WorkpoolService;
+import workpool.WorkpoolServiceImpl;
+
+/**
+ * This client program shows how to run a distributed SCA node. In this case a
+ * calculator node has been constructed specifically for running the calculator
+ * composite. Internally it creates a representation of a node and associates a
+ * distributed domain with the node. This separation is made different
+ * implementations of the distributed domain can be provided.
+ */
+public class WorkpoolNode {
+
+ public static void main(String[] args) throws Exception {
+
+ // Check that the correct arguments have been provided
+ if (null == args || args.length < 4) {
+ System.err
+ .println("Useage: java WorkpoolNode domainname nodename iterTest workerNo");
+ System.exit(1);
+ }
+ BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+ String domainName = args[0];
+ String nodeName = args[1];
+ long iterations = Long.parseLong(args[2]);
+ long jobsNo = Long.parseLong(args[3]);
+ long workerNo = Long.parseLong(args[4]);
+ ClassLoader cl = WorkpoolNode.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ SCANode node = nodeFactory.createSCANode(null, domainName);
+ node.addContribution(nodeName, cl.getResource(nodeName + "/"));
+ node.addToDomainLevelComposite(new QName("http://sample", "Workpool"));
+ node.start();
+ // nodeA is the head node and runs some tests while all other nodes
+ // simply listen for incoming messages
+
+ FileReader rules = new FileReader("workerRules.drl");
+ StringBuffer buffer = new StringBuffer();
+
+ BufferedReader br = new BufferedReader(rules);
+ String ruleString;
+ do {
+ ruleString = br.readLine();
+ if (ruleString != null) {
+ buffer.append(ruleString + "\n");
+ }
+ } while (ruleString != null);
+
+ if (nodeName.equals("nodeA")) {
+ // do some application stuff
+ WorkpoolService workpoolService = node.getDomain().getService(
+ WorkpoolService.class, "WorkpoolServiceComponent");
+ workpoolService.start();
+ NodeManagerInitService nodeInit = node.getDomain().getService(
+ NodeManagerInitService.class,
+ "WorkpoolManagerComponent/NodeManagerInitService");
+ nodeInit.setNode(node);
+ WorkpoolManager workpoolManager = node.getDomain().getService(
+ WorkpoolManager.class,
+ "WorkpoolManagerComponent/WorkpoolManager");
+ workpoolManager.setWorkpoolReference(node.getDomain()
+ .getServiceReference(WorkpoolService.class,
+ "WorkpoolServiceComponent"));
+ workpoolManager.setCycleTime(8000);
+ workpoolManager.acceptRules(buffer.toString());
+ workpoolManager.start();
+ int items[] = { 3, 4, 5, 6, 3, 6, 3, 5, 9, 5, 6 };
+
+ double x = 398349;
+
+ for (int i = 0; i < jobsNo; ++i)
+ workpoolService.submit(new TestJob(x, iterations, items));
+
+ TestJob j = new TestJob(-1.0, true);
+ for (int i = 0; i < workerNo + 1; ++i) {
+ j.setEOS();
+ workpoolService.submit(j);
+ }
+
+ }
+ try {
+ if (nodeName.equals("nodeB")) {
+ NodeManagerInitService serviceNodeB = node
+ .getDomain()
+ .getService(NodeManagerInitService.class,
+ "WorkerManagerNodeBComponent/NodeManagerInitService");
+ serviceNodeB.setNode(node);
+ }
+ if (nodeName.equals("nodeC")) {
+ NodeManagerInitService workerManagerC = node
+ .getDomain()
+ .getService(NodeManagerInitService.class,
+ "WorkerManagerNodeCComponent/NodeManagerInitService");
+ workerManagerC.setNode(node);
+ }
+ if (nodeName.equals("nodeD")) {
+ NodeManagerInitService workerManagerD = node
+ .getDomain()
+ .getService(NodeManagerInitService.class,
+ "WorkerManagerNodeDComponent/NodeManagerInitService");
+ workerManagerD.setNode(node);
+ }
+ if (nodeName.equals("nodeE")) {
+ NodeManagerInitService workerManagerE = node
+ .getDomain()
+ .getService(NodeManagerInitService.class,
+ "WorkerManagerNodeEComponent/NodeManagerInitService");
+ workerManagerE.setNode(node);
+ }
+
+ System.out.println("Node started (press enter to shutdown)");
+ String buff;
+ for (;;) {
+ try {
+ buff = in.readLine();
+ if (buff == null)
+ break;
+ System.out.print(in.readLine());
+ } catch (IOException ex) {
+ break; // Exit thread.
+ }
+ }
+ // stop the node and all the domains in it
+ node.stop();
+ node.destroy();
+ System.exit(0);
+ } catch (Exception ex) {
+ System.err.println("Exception in node - " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ }
+ }
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/node/workerRules1.drl b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/workerRules1.drl
new file mode 100644
index 0000000000..9c5a5d1b7f
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/node/workerRules1.drl
@@ -0,0 +1,13 @@
+package workpool
+import workpool.*;
+rule "WorkerAdder1"
+ when
+ $workerBean: WorkpoolBean(singleAction == false && (jobComputed > 500))
+ then
+ $workerBean.setSingleAction()
+ $workerBean.addWorkerToNode("nodeB")
+ $workerBean.addWorkerToNode("nodeC")
+ $workerBean.addWorkerToNode("nodeD")
+ $workerBean.addWorkerToNode("nodeE")
+end
+ \ No newline at end of file
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MetaComponentWorker.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MetaComponentWorker.java
new file mode 100644
index 0000000000..cdd0f30b34
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MetaComponentWorker.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 workpool;
+
+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;
+import org.apache.tuscany.sca.assembly.impl.DefaultMetaComponent;
+
+public class MetaComponentWorker extends DefaultMetaComponent {
+
+ private SecureRandom prng;
+ private String componentName;
+ private String scdl;
+ private String javaClass;
+ private boolean loadedFromString = false;
+ private Logger log = Logger.getLogger(MetaComponentWorker.class.getName());
+
+ public MetaComponentWorker() {
+ componentName = "WorkerComponent"
+ + java.util.UUID.randomUUID().toString();
+ }
+
+ public void setWorkerName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ public void setWorkerClass(String javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ private String generateSCDL() {
+ StringBuffer buffer = new StringBuffer(512);
+ buffer
+ .append("<component xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" name=\"");
+ buffer.append(this.componentName);
+ buffer.append("\">\n");
+ buffer.append("<implementation.java class=\"");
+ buffer.append(this.javaClass);
+ buffer.append("\"/>");
+ buffer.append("<property name=\"workerName\">");
+ buffer.append(this.componentName);
+ buffer.append("</property>\n</component>");
+ return buffer.toString();
+ }
+
+ @Override
+ public XMLStreamReader build() throws Exception {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ if (!loadedFromString)
+ scdl = generateSCDL();
+ return factory.createXMLStreamReader(new StringReader(scdl));
+
+ }
+
+ public String getName() {
+
+ return componentName;
+ }
+
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MyWorker.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MyWorker.java
new file mode 100644
index 0000000000..3d4df38c95
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/MyWorker.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 workpool;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.databinding.job.JobDataMap;
+import org.apache.tuscany.sca.databinding.job.JobExecutionContext;
+import org.apache.tuscany.sca.databinding.job.RemoteJob;
+import org.oasisopen.sca.annotation.Scope;
+
+@Scope("COMPOSITE")
+public class MyWorker extends WorkerServiceImpl<Object, Double> {
+ private static int resultcount = 0;
+
+ @Override
+ public ResultJob computeTask(Job<Object, Double> job) {
+
+ RemoteJob remoteJob = (RemoteJob) job;
+ System.out.println("Computing the job");
+ JobExecutionContext context = remoteJob.getContext();
+ ResultJob resultJob = new ResultJob();
+ JobDataMap resultMap = new JobDataMap();
+ resultMap.addJobData("result", remoteJob.compute(context));
+ resultJob.setJobDataMap(resultMap);
+ System.out.println("Count result = " + (++resultcount));
+ return resultJob;
+ }
+
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/NullJob.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/NullJob.java
new file mode 100644
index 0000000000..fb930adf2e
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/NullJob.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 workpool;
+
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.databinding.job.JobDataMap;
+
+public class NullJob implements Job, java.io.Serializable {
+
+ public Object compute(Object arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public JobDataMap getDataMap() {
+ return null;
+ }
+
+ public boolean eos() {
+ return false;
+ }
+
+ public int getType() {
+ return Job.NULL_JOB;
+ }
+
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/ResultJob.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/ResultJob.java
new file mode 100644
index 0000000000..e04411668b
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/ResultJob.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 workpool;
+
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.databinding.job.JobDataMap;
+import org.apache.tuscany.sca.databinding.job.JobExecutionContext;
+import org.apache.tuscany.sca.databinding.job.RemoteJob;
+
+public class ResultJob extends RemoteJob<Object> implements
+ java.io.Serializable {
+ private JobDataMap map;
+
+ public JobDataMap getDataMap() {
+ return map;
+ }
+
+ public void setJobDataMap(JobDataMap map) {
+ this.map = map;
+ }
+
+ public boolean eos() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ public int getType() {
+ // TODO Auto-generated method stub
+ return Job.RESULT_JOB;
+ }
+
+ @Override
+ public Object compute(JobExecutionContext v) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/Trigger.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/Trigger.java
new file mode 100644
index 0000000000..52703d6954
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/Trigger.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 workpool;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
+public interface Trigger<T> {
+ void handleEvent(T c);
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManager.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManager.java
new file mode 100644
index 0000000000..d2b306cbd5
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManager.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 workpool;
+import org.oasisopen.sca.annotation.Remotable;
+import org.oasisopen.sca.CallableReference;
+@Remotable
+public interface WorkerManager {
+ CallableReference<WorkerService> addWorker();
+ boolean removeWorker(String workerName);
+ boolean removeWorkers(int k);
+ boolean removeAllWorkers();
+ double getNodeLoad();
+ int activeWorkers();
+ void start();
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManagerImpl.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManagerImpl.java
new file mode 100644
index 0000000000..9660a6c2b2
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerManagerImpl.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 workpool;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
+import org.oasisopen.sca.CallableReference;
+import org.apache.tuscany.sca.node.management.SCANodeManagerInitService;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.impl.SCANodeImpl;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.oasisopen.sca.ComponentContext;
+import org.oasisopen.sca.annotation.Context;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+import java.util.LinkedList;
+import java.util.ArrayList;
+
+@Scope("COMPOSITE")
+@Service(interfaces = { SCANodeManagerInitService.class, WorkerManager.class })
+public class WorkerManagerImpl implements WorkerManager, SCANodeManagerInitService {
+ private Logger log = Logger.getLogger(WorkerManagerImpl.class.getName());
+ private LinkedList<CallableReference<WorkerService>> activeWorkers = new LinkedList<CallableReference<WorkerService>>();
+ private List<String> workerComponentNames = new ArrayList<String>();
+ private SCANodeImpl node;
+ @Property
+ protected String nodeName;
+ @Property
+ protected String compositeName;
+ @Property
+ protected String workerClass;
+ @Context
+ protected ComponentContext context;
+ private double loadAverage;
+
+ /* This method is used to find a composite inside all deployed artifacts */
+ private Composite findComposite(List<Composite> artifacts) {
+ for (Composite fact : artifacts) {
+ log.info("Searching in a contribution deployed artifacts -"
+ + compositeName);
+ Composite augmented = (Composite) fact;
+ // found
+ if (augmented.getURI().equals(compositeName)) {
+ log.info("Found composite..." + compositeName);
+ return augmented;
+ }
+ }
+ }
+ return null;
+ }
+
+ public CallableReference<WorkerService> addWorker() {
+ log.info("Adding a new worker call..");
+ long addWorkerStartTime = System.nanoTime();
+ ContributionServiceImpl cServiceImpl = (ContributionServiceImpl) node.getContributionService();
+ Contribution contribution = cServiceImpl.getContribution(nodeName);
+ List<Composite> artifacts = contribution.getDeployables();
+ CallableReference<WorkerService> workerReference = null;
+ CallableReference<WorkerService> ref = null;
+ log.info("Creating a MetaComponentWorker..");
+ MetaComponentWorker mcw = new MetaComponentWorker();
+ boolean found = false;
+ mcw.setWorkerClass(workerClass);
+ Composite augmented = findComposite(artifacts);
+ try {
+ if (augmented != null) {
+ long startCreation = System.nanoTime();
+ node.addComponentToComposite(mcw, contribution.getURI(),
+ augmented.getURI());
+ System.out.println("addComponentToComposite time = "
+ + (System.nanoTime() - startCreation));
+ RuntimeComponent workerComponent = (RuntimeComponent) node
+ .getComponent(mcw.getName());
+ if (workerComponent != null) {
+ ref = (CallableReference<WorkerService>) workerComponent
+ .getComponentContext().createSelfReference(
+ WorkerService.class);
+ ref.getService().start();
+ activeWorkers.addLast(ref);
+ workerComponentNames.add(mcw.getName());
+ CallableReference<WorkerManager> manager = (CallableReference) context
+ .createSelfReference(WorkerManager.class,
+ "WorkerManager");
+ ref.getService().registerManager(manager);
+ return ref;
+ }
+ } else {
+ log.info("Workpool composite not found!");
+ }
+ } catch (Exception e) {
+ log.info("Exception activation");
+ e.printStackTrace();
+ }
+ ;
+ System.out.println("Component Creation Time ="
+ + (System.nanoTime() - addWorkerStartTime));
+ return ref;
+ }
+
+ public boolean removeAllWorkers() {
+ for (CallableReference<WorkerService> callable : activeWorkers) {
+ callable.getService().stop();
+ }
+ return true;
+ }
+
+ public boolean removeWorker() {
+ CallableReference<WorkerService> callable = activeWorkers
+ .removeLast();
+ callable.getService().stop();
+ return true;
+ }
+
+ public boolean removeWorkers(int k) {
+ if (k >= activeWorkers.size())
+ return false;
+ for (int i = 0; i < k; ++i) {
+ if (!removeWorker())
+ return false;
+ }
+ return true;
+ }
+
+ public void setNode(SCANode node) {
+ this.node = (SCANodeImpl) node;
+
+ }
+
+ public double getNodeLoad() {
+ /*
+ * FIXME [jo] this works only on Linux To be replaced with an JNI
+ * extension
+ */
+ RandomAccessFile statfile;
+
+ this.loadAverage = 1.0;
+ // load = 0;
+ int NoProcessors = 0;
+ String cpuLine = null;
+ try {
+ NoProcessors = Runtime.getRuntime().availableProcessors();
+ if (NoProcessors > 1)
+ this.loadAverage = 1 / (1.0 * NoProcessors);
+ statfile = new RandomAccessFile("/proc/loadavg", "r");
+ try {
+ statfile.seek(0);
+ cpuLine = statfile.readLine();
+
+ } catch (IOException e) {
+ // FIX ME: Better exception handling.
+ e.printStackTrace();
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
+ double min1;
+ if (cpuLine != null) {
+ java.util.StringTokenizer st = new java.util.StringTokenizer(
+ cpuLine, " ");
+ min1 = Double.parseDouble(st.nextToken());
+ } else
+ min1 = 0;
+
+ return min1 * this.loadAverage;
+ }
+
+ public int activeWorkers() {
+ return activeWorkers.size();
+ }
+
+ public boolean removeWorker(String workerName) {
+ RuntimeComponent workerComponent = (RuntimeComponent) node
+ .getComponent(workerName);
+ if (workerComponent != null) {
+ log.info("Removing component " + workerName);
+ node.removeComponentFromComposite(nodeName, "Workpool.composite",
+ workerName);
+ return true;
+ }
+ return false;
+ }
+
+ public void start() {
+ // do nothing for now.
+ }
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerService.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerService.java
new file mode 100644
index 0000000000..3f702db369
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerService.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 workpool;
+
+import org.oasisopen.sca.ServiceReference;
+import org.oasisopen.sca.annotation.Callback;
+import org.oasisopen.sca.annotation.Remotable;
+import org.oasisopen.sca.annotation.OneWay;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.databinding.job.Job;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+@Callback(WorkerServiceCallback.class)
+@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
+public interface WorkerService<T, E> {
+ @OneWay
+ void compute(Job<T, E> j);
+
+ void start();
+
+ void stop();
+
+ // void addJobCompleteHandler(String triggerName,
+ // CallableReferenceImpl<Trigger> handle);
+ // void removeJobCompleteHandler(String triggerName);
+ /* The worker manager */
+ void registerManager(CallableReferenceImpl<WorkerManager> wm);
+
+ void registerSender(CallableReferenceImpl<WorkpoolService> sender);
+
+ // void init(Job nullJob);
+ @OneWay
+ void computeFirstTime(Job nullJob,
+ CallableReferenceImpl<WorkpoolService> myReference);
+
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceCallback.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceCallback.java
new file mode 100644
index 0000000000..22cfc38ff4
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceCallback.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 workpool;
+
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface WorkerServiceCallback {
+ void receiveResult(Job resultType, boolean reuse, String workerName);
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceImpl.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceImpl.java
new file mode 100644
index 0000000000..c38b27a6cf
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkerServiceImpl.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 workpool;
+
+import org.oasisopen.sca.ComponentContext;
+import org.oasisopen.sca.RequestContext;
+import org.oasisopen.sca.ServiceReference;
+import org.oasisopen.sca.annotation.Callback;
+import org.oasisopen.sca.annotation.Context;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.databinding.job.Job;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.*;
+
+/**
+ * An implementation of the worker service.
+ */
+@Service(WorkerService.class)
+@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
+@Scope("COMPOSITE")
+public abstract class WorkerServiceImpl<T, E> implements WorkerService<T, E> {
+ private Logger log = Logger.getLogger(this.getClass().getName());
+ private WorkerServiceCallback workerServiceCallback;
+ @Context
+ protected ComponentContext workerContext;
+ @Context
+ protected RequestContext requestContext;
+ @Property
+ protected String workerName;
+ private CallableReferenceImpl<WorkerManager> managerReference = null;
+
+ /* TODO add the triggers, but before ask */
+ // protected Map<String,Trigger> triggers = new HashMap<String,Trigger>();
+ public abstract ResultJob computeTask(Job<T, E> job);
+
+ private boolean stopped = false;
+ private CallableReferenceImpl<WorkerService> serviceRef;
+ private CallableReferenceImpl<WorkpoolService> senderService;
+ private WorkpoolService wp = null;
+ private WorkerManager manager = null;
+
+ public void start() {
+ log.info("Starting worker...");
+ stopped = false;
+ serviceRef = (CallableReferenceImpl) workerContext
+ .createSelfReference(WorkerService.class);
+
+ }
+
+ public void init(CallableReferenceImpl<WorkpoolService> sender, Job nullJob) {
+ compute(nullJob);
+ }
+
+ public void stop() {
+ stopped = true;
+ }
+
+ @Callback
+ public void setWorkerServiceCallback(
+ WorkerServiceCallback workerServiceCallback) {
+ log.info("Setting worker callback");
+ this.workerServiceCallback = workerServiceCallback;
+ }
+
+ public void computeFirstTime(Job nullJob,
+ CallableReferenceImpl<WorkpoolService> sender) {
+ senderService = sender;
+ wp = sender.getService();
+ workWithCallable(nullJob);
+ }
+
+ public void registerManager(CallableReferenceImpl<WorkerManager> wm) {
+ managerReference = wm;
+ manager = managerReference.getService();
+
+ }
+
+ public void registerSender(CallableReferenceImpl<WorkpoolService> sender) {
+ log.info("Registering sender..");
+ senderService = sender;
+ wp = sender.getService();
+ }
+
+ private void workWithInjection(Job j) {
+ log.info("Worker has received job");
+ if (stopped) {
+ workerServiceCallback
+ .receiveResult(j, true, workerContext.getURI());
+ if (managerReference != null)
+ manager.removeWorker(workerContext.getURI());
+ } else if (j.eos()) {
+ if (managerReference != null)
+ manager.removeWorker(workerContext.getURI());
+ }
+ if (j instanceof NullJob) {
+ workerServiceCallback.receiveResult(j, false, workerContext
+ .getURI());
+ } else {
+ workerServiceCallback.receiveResult(computeTask(j), false,
+ workerContext.getURI());
+ }
+ }
+
+ private void workWithCallable(Job j) {
+ log.info("Worker " + workerContext.getURI()
+ + " has received job with eos --> " + j.eos());
+ if (stopped) {
+ wp.handleResult(j, true, workerContext.getURI(), serviceRef, false);
+ return;
+ }
+ if (j.eos()) {
+ log.info("Got poison token...");
+ if (managerReference != null) {
+ log.info("Removing component " + workerContext.getURI());
+ manager.removeWorker(workerContext.getURI());
+
+ }
+ return;
+ }
+ if (j.getType() != Job.NULL_JOB) {
+ wp.handleResult(computeTask(j), false, workerContext.getURI(),
+ serviceRef, false);
+ } else {
+ log.info("Got a null job");
+ wp.handleResult(j, false, workerContext.getURI(), serviceRef, true);
+ }
+ }
+
+ public void compute(Job<T, E> j) {
+
+ if (senderService != null) {
+ log.info("Computing job using callable reference method");
+ workWithCallable(j);
+
+ } else {
+ log.info("Computing job using reference injection method");
+ workWithInjection(j);
+
+ }
+ }
+ /*
+ * public void addJobCompleteHandler(String triggerName,
+ * CallableReferenceImpl<Trigger> handle) { if
+ * (!triggers.containsKey(triggerName)) { triggers.put(triggerName,
+ * handle.getService()); } } public void removeJobCompleteHandler(String
+ * triggerName) { if (!triggers.containsKey(triggerName)) {
+ * triggers.remove(triggerName); } }
+ */
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBean.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBean.java
new file mode 100644
index 0000000000..80c093ff1c
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBean.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 workpool;
+
+import java.beans.*;
+import java.util.Vector;
+import java.util.logging.*;
+
+public class WorkpoolBean {
+ private Vector<WorkpoolBeanListener> listeners = new Vector<WorkpoolBeanListener>();
+ double loadAverage = 0;
+ int nodeNumbers = 0;
+ int workers = 0;
+ int estimedQueueSize = 0;
+ double averageServiceTime = 0;
+ double averageArrivalTime = 0;
+ double usageFactor = 0;
+ private final PropertyChangeSupport changes = new PropertyChangeSupport(
+ this);
+ long jobComputed = 0;
+ boolean singleAction = false;
+ private Logger log = Logger.getLogger(WorkpoolBean.class.getName());
+
+ public void setNodeNumbers(int n) {
+ this.nodeNumbers = n;
+ }
+
+ public void setWorkers(int w) {
+ this.workers = w;
+ }
+
+ public void setLoadAverage(double loadAverage) {
+ this.loadAverage = loadAverage;
+ }
+
+ public void setAverageServiceTime(double service) {
+ this.averageServiceTime = service;
+ }
+
+ public void setAverageArrivalTime(double service) {
+ this.averageArrivalTime = service;
+ }
+
+ public double getAverageArrivalTime() {
+ return this.averageArrivalTime;
+ }
+
+ public double getUtilizationFactor() {
+ return usageFactor;
+ }
+
+ public void setUsageFactor() {
+ usageFactor = averageServiceTime / averageArrivalTime;
+ }
+
+ public void setEstimedQueueSize(int size) {
+ estimedQueueSize = size;
+ }
+
+ public int getEstimedQueueSize() {
+ return estimedQueueSize;
+ }
+
+ public double getLoadAverage() {
+ return this.loadAverage;
+ }
+
+ public int getWorkers() {
+ return this.workers;
+ }
+
+ public int getNodeNumbers() {
+ return this.nodeNumbers;
+ }
+
+ public double getAverageServiceTime() {
+ return this.averageServiceTime;
+ }
+
+ public void addPropertyChangeListener(final PropertyChangeListener l) {
+ this.changes.addPropertyChangeListener(l);
+ }
+
+ public void removePropertyChangeListener(final PropertyChangeListener l) {
+ this.changes.removePropertyChangeListener(l);
+ }
+
+ private synchronized void fireWorkpoolEvent(WorkpoolEvent ev) {
+ for (WorkpoolBeanListener l : listeners) {
+ l.handleEvent(new WorkpoolEvent(ev));
+ }
+ }
+
+ public void addWorkersToNode(int k, String nodeName) {
+ log.info("Adding a worker to node " + nodeName);
+ WorkpoolEvent ev = new WorkpoolEvent(this,
+ WorkpoolEvent.EVENT_MULTIPLE_ADD_WORKER, k, nodeName);
+ fireWorkpoolEvent(ev);
+ }
+
+ public void addWorkerToNode(String nodeName) {
+ log.info("Adding a worker to node " + nodeName);
+ WorkpoolEvent ev = new WorkpoolEvent(this,
+ WorkpoolEvent.SINGLE_ADD_WORKER, 1, nodeName);
+ fireWorkpoolEvent(ev);
+ }
+
+ public void removeWorkersToNode(int k, String nodeName) {
+ log.info("Removing a worker to node " + nodeName);
+ WorkpoolEvent ev = new WorkpoolEvent(this,
+ WorkpoolEvent.EVENT_MULTIPLE_REMOVE_WORKER, k, nodeName);
+ fireWorkpoolEvent(ev);
+ }
+
+ public void removeWorkerToNode(String nodeName) {
+ log.info("Removing a worker to node " + nodeName);
+ WorkpoolEvent ev = new WorkpoolEvent(this,
+ WorkpoolEvent.SINGLE_REMOVE_WORKER, 1, nodeName);
+ fireWorkpoolEvent(ev);
+ }
+
+ public synchronized void addListener(WorkpoolBeanListener l) {
+ this.listeners.add(l);
+ }
+
+ public synchronized void removeListener(WorkpoolBeanListener l) {
+ this.listeners.remove(l);
+ }
+
+ public void setJobComputed(long jobComputed) {
+ this.jobComputed = jobComputed;
+
+ }
+
+ public void setSingleAction() {
+ singleAction = true;
+ }
+
+ public boolean getSingleAction() {
+ return singleAction;
+ }
+
+ public long getJobComputed() {
+ return this.jobComputed;
+ }
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBeanListener.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBeanListener.java
new file mode 100644
index 0000000000..0ecc223fed
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolBeanListener.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 workpool;
+
+import java.util.EventListener;
+
+public interface WorkpoolBeanListener extends EventListener {
+ public void handleEvent(WorkpoolEvent ev);
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolEvent.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolEvent.java
new file mode 100644
index 0000000000..0bdc3671d5
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolEvent.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 workpool;
+
+import java.util.EventObject;
+
+public class WorkpoolEvent extends EventObject {
+
+ private static final long serialVersionUID = -1273928009411948768L;
+
+ public WorkpoolEvent(Object source) {
+ super(source);
+ }
+
+ public WorkpoolEvent(WorkpoolEvent ev) {
+ super(ev.source);
+ type = ev.type;
+ noWorker = ev.noWorker;
+ nodeName = ev.nodeName;
+ }
+
+ public WorkpoolEvent(Object source, int typeEv, int worker) {
+ super(source);
+ type = typeEv;
+ noWorker = worker;
+ nodeName = "";
+ }
+
+ public WorkpoolEvent(Object source, int typeEv, int worker, String nodeName) {
+ super(source);
+ type = typeEv;
+ noWorker = worker;
+ this.nodeName = nodeName;
+ }
+
+ public String getNodeName() {
+ return nodeName;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public int workers() {
+ return noWorker;
+ }
+
+ private int type;
+ private int noWorker;
+ private String nodeName;
+ public static final int EVENT_MULTIPLE_ADD_WORKER = 0;
+ public static final int EVENT_MULTIPLE_REMOVE_WORKER = 1;
+ public static final int SINGLE_REMOVE_WORKER = 2;
+ public static final int SINGLE_ADD_WORKER = 3;
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManager.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManager.java
new file mode 100644
index 0000000000..46fbda7998
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManager.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 workpool;
+
+import org.oasisopen.sca.ServiceReference;
+import org.oasisopen.sca.annotation.OneWay;
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface WorkpoolManager {
+ /*
+ * @param String rules This are the autonomic rules. The format is the Java
+ * Drools .drl file. You have to read it
+ */
+ @OneWay
+ void acceptRules(String rules);
+
+ @OneWay
+ void start();
+
+ @OneWay
+ void stopAutonomicCycle();
+
+ @OneWay
+ void startAutonomicCycle();
+
+ int activeWorkers();
+
+ void setCycleTime(long time);
+
+ void setWorkpoolReference(ServiceReference<WorkpoolService> serviceReference);
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java
new file mode 100644
index 0000000000..cf353fb3fe
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java
@@ -0,0 +1,555 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package workpool;
+
+import org.oasisopen.sca.ComponentContext;
+import org.oasisopen.sca.ServiceReference;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLStreamException;
+
+import node.TestJob;
+import java.io.File;
+import java.util.Vector;
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.node.NodeManagerInitService;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.impl.SCANodeImpl;
+import org.oasisopen.sca.CallableReference;
+import org.drools.FactHandle;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.StatelessSession;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+import org.oasisopen.sca.annotation.Constructor;
+import org.oasisopen.sca.annotation.Context;
+import org.oasisopen.sca.annotation.Destroy;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.ReentrantLock;
+
+@Service(interfaces = { NodeManagerInitService.class, WorkpoolManager.class })
+@Scope("COMPOSITE")
+/*
+ * This is the core manager of the workpool application. The Workpool Manager
+ * holds the reference to each remote node manager. Inside it we've a rule
+ * engine instance.
+ */
+public class WorkpoolManagerImpl implements WorkpoolManager,
+ NodeManagerInitService, WorkpoolBeanListener {
+ /*
+ * This inner class trigs the rule engine, at given times: 1. It checks the
+ * different loads for each nodes and sets the WorkpoolBean 2. It checks the
+ * Workpool AverageService Time and sets the WorkpoolBean 3. It checks how
+ * many jobs are already computed and sets the WorkpoolBean Then given the
+ * configured bean and the rules, run the Rule Engine for executing the
+ * business logic
+ */
+ class RuleEngineTrigger extends TimerTask {
+ // private ReentrantLock triggerLock = new ReentrantLock();
+ @Override
+ public void run() {
+
+ System.out.println("Updating WorkpoolBean..");
+ // checkActiveWorkers();
+ // checkLoadInNodes();
+ checkServiceTime();
+ // checkEstimedQueueSize();
+ // checkArrivalTime();
+ getProcessedItem();
+ // computeUsageFactor();
+ doRun(bean);
+ }
+
+ }
+
+ private WorkerManager managerNodeB;
+ private WorkerManager managerNodeC;
+ private WorkerManager managerNodeD;
+ private WorkerManager managerNodeE;
+
+ private SCANodeImpl node;
+ private WorkpoolBean bean = new WorkpoolBean();
+ private ReentrantLock handleEventLock = new ReentrantLock();
+ private ReentrantLock updateRuleLock = new ReentrantLock();
+
+ private ServiceReference<WorkpoolService> reference;
+ private AtomicInteger activeWorkers = new AtomicInteger(0);
+ private Logger log = Logger.getLogger(WorkpoolManagerImpl.class.getName());
+ @Property
+ protected String workers;
+ @Property
+ protected String nodes;
+ @Property
+ protected String injection;
+ @Context
+ protected ComponentContext workpoolManagerContext;
+ private CallableReferenceImpl<WorkpoolManager> myReference;
+ private String rules = null;
+ private boolean referenceInjection = false;
+ private ConcurrentHashMap<String, WorkerManager> workerManagerTable = new ConcurrentHashMap<String, WorkerManager>();
+ private int workersNo;
+ private int nodesNo;
+ private Timer timer = new Timer();
+ /* this handle facts */
+ private RuleBase ruleBase = null;
+ private FactHandle handle = null;
+ private StatefulSession wm = null;
+ private long cycleTime = 5000;
+
+ @Reference
+ public void setManagerNodeB(WorkerManager managerNodeB) {
+ this.managerNodeB = managerNodeB;
+ workerManagerTable.put("nodeB", managerNodeB);
+ }
+
+ @Reference
+ public void setManagerNodeC(WorkerManager managerNodeC) {
+ this.managerNodeC = managerNodeC;
+ workerManagerTable.put("nodeC", managerNodeC);
+ }
+
+ @Reference
+ public void setManagerNodeD(WorkerManager managerNodeD) {
+ this.managerNodeD = managerNodeD;
+ workerManagerTable.put("nodeD", managerNodeD);
+ }
+
+ @Reference
+ public void setManagerNodeE(WorkerManager managerNodeE) {
+ this.managerNodeE = managerNodeE;
+ workerManagerTable.put("nodeE", managerNodeE);
+ }
+
+ private void startNewComponents(
+ Vector<CallableReferenceImpl<WorkerService>> vector) {
+ log.info("Starting new components");
+ WorkpoolService wp = reference.getService();
+ // CallableReferenceImpl<WorkpoolService> sink =
+ // (CallableReferenceImpl<WorkpoolService>) reference;
+ Job j = new NullJob();
+ for (CallableReferenceImpl<WorkerService> item : vector) {
+ // WorkerService service = item.getService();
+ // service.start();
+ // service.computeFirstTime(j, sink);
+ log.info("Send PostWorkerReference...");
+ wp.PostWorkerReference(item);
+ }
+ if (myReference != null)
+ wp.registerManager(myReference);
+ }
+
+ public void setCycleTime(long cycle) {
+ this.cycleTime = cycle;
+ }
+
+ @SuppressWarnings("unchecked")
+ /*
+ * This gets the number of workers workerNo and instantiates them
+ */
+ public void start() {
+ this.myReference = (CallableReferenceImpl<WorkpoolManager>) workpoolManagerContext
+ .createSelfReference(WorkpoolManager.class, "WorkpoolManager");
+ this.workersNo = Integer.parseInt(this.workers);
+ this.nodesNo = Integer.parseInt(this.nodes);
+ this.referenceInjection = (Integer.parseInt(this.injection) != 0);
+ log.info("Starting WorkpoolManager Component with #" + workersNo
+ + " workers and #" + nodes + " nodes");
+ nodesNo = workerManagerTable.values().size();
+ // Sets info in the bean.
+ bean.setWorkers(this.workersNo);
+ bean.setNodeNumbers(nodesNo);
+ Vector<CallableReferenceImpl<WorkerService>> workerRefs = new Vector<CallableReferenceImpl<WorkerService>>();
+ int exactTimes = workersNo / nodesNo;
+ for (int i = 0; i < exactTimes; ++i) {
+ for (WorkerManager manager : workerManagerTable.values()) {
+ manager.start();
+ if (manager != null) {
+ System.err.println("Actual load = "
+ + manager.getNodeLoad() + " for node ");
+ addNewComponent(manager, workerRefs);
+ }
+ }
+ }
+
+ int module = (workersNo % nodesNo);
+ int n = 0;
+ if (module > 0) {
+ Vector<String> v = new Vector(workerManagerTable.keySet());
+ Collections.sort(v);
+ // Iterator<WorkerManager> iter =
+ // workerManagerTable.values().iterator();
+ // Display (sorted) hashtable.
+ for (Enumeration<String> e = v.elements(); (e.hasMoreElements() && n < module); ++n) {
+ String key = e.nextElement();
+ WorkerManager m = workerManagerTable.get(key);
+ System.err.println("Module Actual load = " + m.getNodeLoad()
+ + " for node ");
+ addNewComponent(m, workerRefs);
+ }
+ }
+ startNewComponents(workerRefs);
+ bean.addListener(this);
+ TimerTask task = new WorkpoolManagerImpl.RuleEngineTrigger();
+ timer.scheduleAtFixedRate(task, 3000, cycleTime);
+ }
+
+ private void checkLoadInNodes() {
+ System.out.println("CheckLoadInNodes");
+ int number = 1;
+ double loadAverage = 0;
+ for (WorkerManager manager : workerManagerTable.values()) {
+ loadAverage += manager.getNodeLoad();
+ number++;
+ }
+ bean.setLoadAverage(loadAverage / number);
+ }
+
+ private void computeUsageFactor() {
+ bean.setUsageFactor();
+ }
+
+ private void checkEstimedQueueSize() {
+ WorkpoolService wp = reference.getService();
+
+ if (wp != null) {
+ int size = wp.estimatedQueueSize();
+ log.info("Estimed Queue Size =" + size);
+ bean.setEstimedQueueSize(size);
+ }
+ }
+
+ private WorkerManager findMinLoad() {
+ double load = 0;
+ // workerManagerTable.values().iterator().next().getNodeLoad();
+ WorkerManager toFind = null;
+ for (WorkerManager manager : workerManagerTable.values()) {
+ if (load == 0) {
+ load = manager.getNodeLoad();
+ toFind = manager;
+ } else if (manager.getNodeLoad() < load) {
+ load = manager.getNodeLoad();
+ toFind = manager;
+ }
+ }
+ return toFind;
+ }
+
+ private void checkServiceTime() {
+ WorkpoolService wp = reference.getService();
+
+ if (wp != null) {
+ double time = wp.getServiceTime();
+ log.info("Average System Service Time =" + time);
+ bean.setAverageServiceTime(time);
+ }
+ }
+
+ private void checkArrivalTime() {
+ WorkpoolService wp = reference.getService();
+
+ if (wp != null) {
+ double time = wp.getArrivalTime();
+ log.info("Average Arrival Service Time =" + time);
+ bean.setAverageArrivalTime(time);
+ }
+ }
+
+ private void checkActiveWorkers() {
+ bean.setWorkers(this.activeWorkers());
+ }
+
+ private void getProcessedItem() {
+ WorkpoolService wp = reference.getService();
+ if (wp != null) {
+ long computed = wp.getJobComputed();
+ log.info("The system has already computed " + computed + " jobs");
+ bean.setJobComputed(computed);
+ }
+ }
+
+ private boolean removeComponent(WorkerManager manager, int k) {
+ manager.removeWorkers(k);
+ activeWorkers.decrementAndGet();
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean addNewComponent(WorkerManager manager,
+ Vector<CallableReferenceImpl<WorkerService>> workerRefs) {
+ CallableReferenceImpl<WorkerService> workerReference = (CallableReferenceImpl<WorkerService>) manager
+ .addWorker();
+
+ if (workerReference != null) {
+ /* if i'll decide to use dynamically generated references */
+ if (referenceInjection) {
+ workerReference.getService();
+ String uri = workerReference.getEndpointReference().getURI();
+ int nameIndex = uri.indexOf("/");
+ String componentName = uri.substring(0, nameIndex);
+ if (componentName.startsWith("/"))
+ componentName = uri.substring(1, uri.length());
+ if (componentName.endsWith("/"))
+ componentName = uri.substring(0, uri.length() - 1);
+ // String componentName = uri.substring(0, nameIndex-1);
+
+ log.info("Adding wire from WorkpoolComponentService to "
+ + componentName);
+ String referenceName = "ref" + componentName;
+
+ /*
+ * I'm updating the WorkpoolServiceComponent with a new
+ * reference to a just created component I assume that the
+ * WorkpoolManagerService and the WorkpoolServiceComponent stay
+ * in the same JVM It's like in the scdl there were: <reference
+ * name=referenceName target="componentName"/> With this then
+ * I've a wire WorkpoolService---> a new Worker
+ */
+ try {
+ node.addComponentReferenceWire(referenceName, "nodeA",
+ "Workpool.composite", "workpool.WorkerServiceImpl",
+ WorkerService.class, "WorkpoolServiceComponent",
+ componentName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ log.info("Sending reference name " + referenceName
+ + " to WorkpoolService");
+ // TODO: this was part of dynamic wiring, but it doesn't work.
+ // reference.getService().PostWorkerName(referenceName);
+
+ } else {
+ // log.info("Sending callable reference to WorkpoolService
+ // placed at -->"+reference);
+ // reference.getService().PostWorkerReference(workerReference);
+ workerRefs.add(workerReference);
+ }
+ activeWorkers.incrementAndGet();
+ return true;
+ }
+ return false;
+ }
+
+ public int activeWorkers() {
+
+ return activeWorkers.get();
+ }
+
+ private void doRun(WorkpoolBean bean) {
+
+ long startTime = System.currentTimeMillis();
+ updateRuleLock.lock();
+ if (wm == null)
+ wm = ruleBase.newStatefulSession();
+ if (this.handle == null)
+ handle = wm.insert(bean);
+ else {
+ wm.update(handle, bean);
+ }
+ wm.fireAllRules();
+ updateRuleLock.unlock();
+
+ System.out.println("Engine rule overhead = "
+ + (System.currentTimeMillis() - startTime));
+ }
+
+ private RuleBase readRule(String rule) {
+
+ PackageBuilder packBuilder = new PackageBuilder();
+ try {
+ packBuilder.addPackageFromDrl(new StringReader(rule));
+ } catch (DroolsParserException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Package pkg = packBuilder.getPackage();
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ try {
+ ruleBase.addPackage(pkg);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return ruleBase;
+ }
+
+ public void acceptRules(String rules) {
+ this.rules = rules;
+ if (ruleBase == null) {
+ RuleBase base = readRule(rules);
+ if (base != null) {
+ ruleBase = base;
+ }
+ } else {
+ updateRuleLock.lock();
+ // i have already a rule: updating
+ ruleBase = readRule(rules);
+ wm = ruleBase.newStatefulSession();
+ handle = null;
+ updateRuleLock.unlock();
+ }
+
+ System.out.println("Accepted rules = " + rules);
+ }
+
+ public String getRules() {
+ return rules;
+ }
+
+ private WorkerManager findMaxLoadNode() {
+ double load = 0.0;
+ WorkerManager toFind = null;
+ for (WorkerManager manager : workerManagerTable.values()) {
+ if (manager.getNodeLoad() > load) {
+ load = manager.getNodeLoad();
+ toFind = manager;
+ }
+ }
+ return toFind;
+
+ }
+
+ public void setWorkpoolReference(
+ ServiceReference<WorkpoolService> serviceReference) {
+ reference = serviceReference;
+ }
+
+ public void setNode(SCANode arg0) {
+ node = (SCANodeImpl) arg0;
+ }
+
+ public void handleEvent(WorkpoolEvent ev) {
+ if (ev == null)
+ return;
+
+ String nodeName = ev.getNodeName();
+
+ switch (ev.getType()) {
+ case WorkpoolEvent.SINGLE_ADD_WORKER: {
+ if (nodeName != null) {
+ Vector<CallableReferenceImpl<WorkerService>> workerRefs = new Vector<CallableReferenceImpl<WorkerService>>();
+
+ // in this case I have a nodeName
+ if (!nodeName.equals("")
+ && (workerManagerTable.containsKey(nodeName))) {
+ WorkerManager manager = workerManagerTable.get(nodeName);
+ addNewComponent(manager, workerRefs);
+ startNewComponents(workerRefs);
+ } else if (nodeName.equals("")) {
+ WorkerManager manager = findMinLoad();
+ addNewComponent(manager, workerRefs);
+ startNewComponents(workerRefs);
+ }
+ }
+ break;
+ }
+ case WorkpoolEvent.EVENT_MULTIPLE_ADD_WORKER: {
+ Vector<CallableReferenceImpl<WorkerService>> workerRefs = new Vector<CallableReferenceImpl<WorkerService>>();
+
+ if (nodeName.equals("")) {
+
+ WorkerManager manager = findMinLoad();
+ int k = ev.workers();
+ for (int h = 0; h < k; ++h) {
+ addNewComponent(manager, workerRefs);
+ }
+ } else {
+ WorkerManager manager = workerManagerTable
+ .get(ev.getNodeName());
+ int k = ev.workers();
+ for (int h = 0; h < k; ++h) {
+ addNewComponent(manager, workerRefs);
+ }
+ }
+ startNewComponents(workerRefs);
+ break;
+ }
+ case WorkpoolEvent.SINGLE_REMOVE_WORKER: {
+ if (nodeName != null) {
+ // in this case I have a nodeName
+ if (!nodeName.equals("")
+ && (workerManagerTable.containsKey(nodeName))) {
+ WorkerManager manager = workerManagerTable.get(nodeName);
+ removeComponent(manager, 1);
+ } else if (nodeName.equals("")) {
+ WorkerManager manager = findMaxLoadNode();
+ removeComponent(manager, 1);
+ }
+ }
+ break;
+ }
+ case WorkpoolEvent.EVENT_MULTIPLE_REMOVE_WORKER: {
+ if (nodeName.equals("")) {
+ WorkerManager manager = findMaxLoadNode();
+ removeComponent(manager, ev.workers());
+
+ } else {
+ WorkerManager manager = workerManagerTable.get(nodeName);
+ removeComponent(manager, ev.workers());
+ }
+ break;
+ }
+ }
+
+ }
+
+ @Destroy
+ public void onExit() {
+ // do cleanup
+ this.timer.cancel();
+ this.timer.purge();
+ }
+
+ public void stopAutonomicCycle() {
+ this.timer.cancel();
+ this.timer.purge();
+ this.timer = null;
+ }
+
+ public void startAutonomicCycle() {
+ if (this.timer == null) {
+ this.timer = new Timer();
+ TimerTask task = new WorkpoolManagerImpl.RuleEngineTrigger();
+ timer.schedule(task, 3000, cycleTime);
+ }
+ }
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java
new file mode 100644
index 0000000000..239e5d145d
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.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 workpool;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.oasisopen.sca.annotation.OneWay;
+import org.oasisopen.sca.annotation.Remotable;
+import org.oasisopen.sca.ServiceReference;
+
+@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
+@Remotable
+public interface WorkpoolService {
+
+ /* this the functional part */
+ void submit(Job i);
+
+ /* the time between two subsequent worker invocations */
+ double getServiceTime();
+
+ /* the number of ResultJob received */
+ long getJobComputed();
+
+ /* the time elapsed between the stream has initiated and now */
+ long getElapsedTime();
+
+ /* the size of the internal queue : it's not accurate */
+ int estimatedQueueSize();
+
+ /* the average time between two consuecutive submit */
+ double getArrivalTime();
+
+ void start();
+
+ void stop();
+
+ /*
+ * this is the part needed by management. May be in future i'll refactor it
+ * order to hide this part.
+ */
+ @OneWay
+ void handleResult(Job j, boolean reuse, String string,
+ CallableReferenceImpl<WorkerService> worker, boolean newJob);
+
+ void addTrigger(CallableReferenceImpl<Trigger> reference);
+
+ void removeTrigger();
+
+ void registerManager(
+ CallableReferenceImpl<WorkpoolManager> createSelfReference);
+
+ /*
+ * This could placed in another interface definition - think about it These
+ * methods evict, and evictAll are needed when a worker finish to exist and
+ * it needs to be evicted by the WorkpoolManager. In the system I have two
+ * caches: 1) a domain cache, which holds the components URI 2) a
+ * workerReference cache (implemented by a ConcurrentHashMap), which holds a
+ * proxy to each worker. Every proxy gets built from the worker callable
+ * reference. I'm thinking for placing the workerReferenceCache in a local
+ * interface. Assuming that WorkpoolService and WorkpoolManager are in the
+ * same JVM.
+ */
+ void evict(String workerURI);
+
+ void evictAll();
+
+ /*
+ * these two are no longer needed. I leave it because if i'll have time to
+ * do dynamic wiring the first one is needed. void PostWorkerName(String
+ * referenceName);
+ */
+ void PostWorkerReference(CallableReferenceImpl<WorkerService> worker);
+
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java
new file mode 100644
index 0000000000..268edae530
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java
@@ -0,0 +1,416 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package workpool;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Logger;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.oasisopen.sca.ComponentContext;
+import org.oasisopen.sca.annotation.Context;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.databinding.job.JobDataMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * An implementation of the Workpool service.
+ */
+@Service(WorkpoolService.class)
+@Scope("COMPOSITE")
+@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
+public class WorkpoolServiceImpl implements WorkpoolService,
+ WorkerServiceCallback {
+
+ /* incoming job queue */
+ private LinkedBlockingQueue<Job> queue = new LinkedBlockingQueue<Job>(5000);
+ private CallableReferenceImpl<Trigger> trigger = null;
+ private Trigger forwardResult = null;
+ /* counter for job's number fetched from the queue and sent to the Worker */
+ private AtomicInteger jobSent = new AtomicInteger(0);
+ /* time for initHandleResult */
+ private AtomicLong initHandleResult = new AtomicLong(0);
+ /* time for endHandleResult */
+ private AtomicLong endHandleResult = new AtomicLong(0);
+ /*
+ * number of job computed, this will be exposed in order to be used to
+ * firing rules
+ */
+ private long jobComputed = 0;
+ /* same as above */
+ private AtomicLong elapsedTime = new AtomicLong(0);
+ /* this is for comuputing averageServiceTime */
+ private long times = 1;
+ /* this is for computing averageArrivalTime */
+ private long timesArrival = 1;
+ private ReentrantLock arrivalLock = new ReentrantLock();
+ private long arrivalPrevious = -1;
+ // private AtomicBoolean processingStopped = new AtomicBoolean(false);
+ private boolean processingStopped = false;
+ // private LinkedBlockingQueue<Trigger> triggers = new
+ // LinkedBlockingQueue<Trigger>();
+ @Context
+ protected ComponentContext workpoolContext;
+ private CallableReferenceImpl<WorkpoolManager> manager;
+ private long previousSubmitTime = -1;
+ private boolean firstTime = true;
+ private boolean first = true;
+ private long start = 0;
+ private long end = 0;
+ private double averageServiceTime = 0;
+ private double averageArrivalTime = 0;
+ private int workersNo = 0;
+ private final Job nullJob = new NullJob();
+ /* This is useful for counting the start and end */
+ private Logger log = Logger.getLogger(WorkpoolServiceImpl.class.getName());
+ private ReentrantLock handleResultLock = new ReentrantLock();
+ private ReentrantLock postWorkerReferenceLock = new ReentrantLock();
+ private ConcurrentHashMap<String, WorkerService> cacheReference = new ConcurrentHashMap<String, WorkerService>();
+ private CallableReferenceImpl<WorkpoolService> myReference;
+ private String previuosURI = "";
+ private long time = 0;
+
+ private void computeAverageTime() {
+ long actualServiceTime = 0;
+ // if the processing is finished
+ if (processingStopped)
+ return;
+
+ if (firstTime == true) {
+ this.previousSubmitTime = System.currentTimeMillis();
+ this.averageServiceTime = 0;
+ firstTime = false;
+ } else {
+ actualServiceTime = System.currentTimeMillis()
+ - this.previousSubmitTime;
+ this.previousSubmitTime = System.currentTimeMillis();
+ averageServiceTime = ((averageServiceTime * times) + actualServiceTime)
+ / (times + 1);
+ ++times;
+ }
+ }
+
+ public void submit(Job j) {
+ try {
+ // log.info("Submit job in queue -->"+ j.getType());
+ // processingStopped.set(false);
+ try {
+ arrivalLock.lock();
+ if (this.arrivalPrevious == -1) {
+ arrivalPrevious = System.currentTimeMillis();
+ averageArrivalTime = 0;
+ }
+ double actualArrivalTime = System.currentTimeMillis()
+ - arrivalPrevious;
+ averageArrivalTime = ((averageArrivalTime * timesArrival) + actualArrivalTime)
+ / (timesArrival + 1);
+ arrivalPrevious = System.currentTimeMillis();
+ ++timesArrival;
+ } finally {
+ arrivalLock.unlock();
+ }
+ queue.put(j);
+ } catch (Exception e) {
+ log.info("Exception in queue");
+ queue.clear();
+ e.printStackTrace();
+ }
+ }
+
+ public double getArrivalTime() {
+ return this.averageArrivalTime;
+ }
+
+ public double getServiceTime() {
+ return this.averageServiceTime;
+ }
+
+ public void receiveResult(Job resultType, boolean reuse, String workerURI) {
+
+ if (reuse) {
+ queue.add(resultType);
+ return;
+ }
+
+ computeAverageTime();
+ Job job = null;
+ try {
+ job = queue.take();
+ } catch (InterruptedException e) {
+ // TODO Better exception handling --> see Exception antipattern doc
+ e.printStackTrace();
+ return;
+ }
+
+ if ((job != null) && (job.eos() == false)) {
+ int nameIndex = workerURI.indexOf("/");
+ String workerName = workerURI.substring(0, nameIndex - 1);
+ log.info("Sending job to worker --> " + workerName);
+ WorkerService worker = workpoolContext.getService(
+ WorkerService.class, workerName);
+ worker.compute(job);
+ }
+
+ JobDataMap map = ((ResultJob) resultType).getDataMap();
+ if (map != null) {
+ ++jobComputed;
+ Object obj = map.getJobDataObject("result");
+ System.out.println("Result = " + ((Double) obj).doubleValue());
+ }
+
+ }
+
+ public void start() {
+ log.info("WorkpoolServiceComponent started...");
+ myReference = (CallableReferenceImpl) workpoolContext
+ .createSelfReference(WorkpoolService.class, "WorkpoolService");
+ myReference.getService();
+ }
+
+ /*
+ *
+ * This method is called by WorkpoolManagerImpl, when it creates a new
+ * worker component in order to dispatch worker to the WorkpoolServiceImpl
+ * @param CallableReferenceImpl reference - a dynamically created reference
+ * from the Worker
+ */
+ public void PostWorkerReference(
+ CallableReferenceImpl<WorkerService> reference) {
+
+ try {
+ long initPostWorkerReference;
+ long endPostWorkerReference;
+ this.postWorkerReferenceLock.lock();
+
+ initPostWorkerReference = System.currentTimeMillis();
+ WorkerService worker;
+ worker = reference.getService();
+ worker.start();
+
+ ++workersNo;
+ if (myReference != null) {
+
+ // Job poison = new ResultJob();
+ this.postWorkerReferenceLock.unlock();
+ log.info("Sending null job to worker");
+ worker.computeFirstTime(nullJob, myReference);
+ // queue.put(poison);
+ endPostWorkerReference = System.currentTimeMillis();
+ System.out.println("Time PostWorker ="
+ + (endPostWorkerReference - initPostWorkerReference));
+ } else {
+ log.info("myReference is null");
+
+ }
+ } catch (Exception e) {
+ postWorkerReferenceLock.unlock();
+ } finally {
+ }
+
+ }
+
+ /*
+ * FIXME This method currently is not used because i've not yet ready
+ * dynamic wire injection
+ */
+
+ public void PostWorkerName(String referenceName) {
+ /* TODO Do something similar to PostWorkerReference */
+ }
+
+ private void printComputingTime(Job j) {
+
+ if (first == true) {
+ first = false;
+ start = System.currentTimeMillis();
+ end = System.currentTimeMillis();
+ } else {
+ end = System.currentTimeMillis();
+ System.out.println("Elapsed Time = " + (end - start));
+ elapsedTime.set(end - start);
+ }
+ /*
+ * i could use reflection or instance of (but it's a penalty kick) , or
+ * an object as result, but i'd prefer a job so i've defined a
+ * RESULT_JOB There're in the system three kind of jobs: RESULT_JOB,
+ * NULL_JOB, DEFAULT_JOB
+ */
+ if ((j != null) && (j.getType() == Job.RESULT_JOB)) {
+ jobComputed++;
+ ResultJob result = (ResultJob) j;
+ JobDataMap map = result.getDataMap();
+ if (map != null) {
+ Double doubleValue = (Double) map.getJobDataObject("result");
+ System.out
+ .println("ResultValue = " + doubleValue.doubleValue());
+ }
+
+ }
+
+ }
+
+ public void handleResult(Job resultType, boolean reuse, String workerURI,
+ CallableReferenceImpl<WorkerService> worker, boolean newWorker) {
+ initHandleResult.set(System.nanoTime());
+ if (reuse) {
+ log.info("Reusing a job..");
+ queue.add(resultType);
+ return;
+ }
+ // init job variable
+ Job job;
+ if (newWorker)
+ System.out.println("newWorkerActivation= " + System.nanoTime());
+ printComputingTime(resultType);
+
+ try {
+ job = queue.take();
+ } catch (Exception e) {
+ log.info("Exception during fetching the queue");
+ e.printStackTrace();
+ return;
+ }
+
+ try {
+ // it needs to be locked because multiple threads could invoke this.
+ handleResultLock.lock();
+ if (previuosURI.equals("")) {
+ time = System.currentTimeMillis();
+ this.previuosURI = workerURI;
+ } else {
+ if (previuosURI.equals(workerURI))
+ System.out.println("Complete ComputeTime for an item ="
+ + (time - System.currentTimeMillis()));
+ }
+ if (job.eos()) {
+ long endTime = System.currentTimeMillis();
+ /* checking for EOS */
+ if (processingStopped == false) {
+ processingStopped = true;
+ System.out.println("GOT EOS in time=" + (endTime - start));
+ log.info("Stop autonomic cycle..");
+ /*
+ * I'm doing this because i want that in the termination i
+ * would have more jobs with eos == true than workers. So
+ * i'm sure that every worker removes itself from its
+ * manager. I do it only one time. This is necessary because
+ * i have a variable number of workers. The number of
+ * workers in the system might change every time the rule
+ * engine cycle gets executed.
+ */
+ ResultJob poison = new ResultJob();
+ for (int i = 0; i < workersNo; ++i) {
+ try {
+
+ queue.put(poison);
+
+ } catch (Exception e) {
+ log.info("Cannot duplicate poison tokens");
+ break;
+ }
+
+ }
+ manager.getService().stopAutonomicCycle();
+ }
+ }
+ computeAverageTime();
+ System.out.println("AverageTime =" + averageServiceTime);
+ if (job != null) {
+
+ WorkerService workerService;
+ /*
+ * the workpool has a high reuse, i always call the same
+ * component set or un superset or subset, so i cache it. When
+ * the WorkpoolManager will remove an item, it removes still
+ * this cache entry
+ */
+ if (!cacheReference.containsKey(workerURI)) {
+ workerService = worker.getService();
+ handleResultLock.unlock();
+ cacheReference.put(workerURI, workerService);
+ } else {
+ handleResultLock.unlock();
+ workerService = cacheReference.get(workerURI);
+ }
+ // it's still a penalty kick locking compute because it's going
+ // to be scheduled whereas it's async.
+ workerService.compute(job);
+ log.info("Sent job #" + jobSent.incrementAndGet()
+ + " Queue size " + queue.size());
+ endHandleResult.set(System.nanoTime());
+ System.out
+ .println("begin:handleResult ==> end:handleResult:compute = "
+ + (endHandleResult.addAndGet(-(initHandleResult
+ .get())) / 1000000));
+ }
+ } catch (Exception e) {
+ handleResultLock.unlock();
+ }
+ }
+
+ public void evictAll() {
+ cacheReference.clear();
+ }
+
+ public void evict(String workerURI) {
+ if (cacheReference.containsKey(workerURI)) {
+ cacheReference.remove(workerURI);
+ }
+
+ }
+
+ public int estimatedQueueSize() {
+ return queue.size();
+ }
+
+ public long getElapsedTime() {
+ return elapsedTime.get();
+ }
+
+ public long getJobComputed() {
+ return jobComputed;
+ }
+
+ public void registerManager(
+ CallableReferenceImpl<WorkpoolManager> createSelfReference) {
+ manager = createSelfReference;
+
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addTrigger(CallableReferenceImpl<Trigger> reference) {
+ this.trigger = reference;
+ this.forwardResult = reference.getService();
+
+ }
+
+ public void removeTrigger() {
+ this.trigger = null;
+ this.forwardResult = null;
+ }
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b3e2d16c05
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-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:Workpool"/>
+</contribution>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite
new file mode 100644
index 0000000000..9a00a8e839
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeA/Workpool.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"
+ xmlns:sample="http://sample"
+ name="Workpool">
+
+ <component name="WorkpoolServiceComponent">
+ <implementation.java class="workpool.WorkpoolServiceImpl"/>
+ </component>
+ <component name="WorkpoolManagerComponent">
+ <implementation.java class="workpool.WorkpoolManagerImpl"/>
+ <property name="workers">4</property>
+ <property name="nodes">4</property>
+ <property name="injection">0</property>
+ <reference name="managerNodeB" target="WorkerManagerNodeBComponent" />
+
+ <reference name="managerNodeC" target="WorkerManagerNodeCComponent" />
+
+ <reference name="managerNodeD" target="WorkerManagerNodeDComponent" />
+
+ <reference name="managerNodeE" target="WorkerManagerNodeEComponent" />
+
+
+ <service name="WorkpoolManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+ <binding.sca/>
+ </service>
+ </component>
+ </composite>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b3e2d16c05
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-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:Workpool"/>
+</contribution>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite
new file mode 100644
index 0000000000..a71dc9e08a
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeB/Workpool.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://sample"
+ xmlns:sample="http://sample"
+ name="Workpool">
+ <component name="WorkerManagerNodeBComponent">
+ <implementation.java class="workpool.WorkerManagerImpl"/>
+ <property name="nodeName">nodeB</property>
+ <property name="compositeName">Workpool.composite</property>
+ <property name="workerClass">workpool.MyWorker</property>
+ <service name="WorkerManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="WorkerManager">
+ <binding.sca uri="http://u13:13001/WorkerManagerNodeBComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b3e2d16c05
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-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:Workpool"/>
+</contribution>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite
new file mode 100644
index 0000000000..771db5370b
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeC/Workpool.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://sample"
+ xmlns:sample="http://sample"
+ name="Workpool">
+ <component name="WorkerManagerNodeCComponent">
+ <implementation.java class="workpool.WorkerManagerImpl"/>
+ <property name="nodeName">nodeC</property>
+ <property name="compositeName">Workpool.composite</property>
+ <property name="workerClass">workpool.MyWorker</property>
+ <service name="WorkerManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="WorkerManager">
+ <binding.sca uri="http://u14:13002/WorkerManagerNodeCComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b3e2d16c05
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/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:Workpool"/>
+</contribution>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite
new file mode 100644
index 0000000000..55fd48934f
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeD/Workpool.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://sample"
+ xmlns:sample="http://sample"
+ name="Workpool">
+ <component name="WorkerManagerNodeDComponent">
+ <implementation.java class="workpool.WorkerManagerImpl"/>
+ <property name="nodeName">nodeD</property>
+ <property name="compositeName">Workpool.composite</property>
+ <property name="workerClass">workpool.MyWorker</property>
+ <service name="WorkerManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="WorkerManager">
+ <binding.sca uri="http://u15:13003/WorkerManagerNodeDComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b3e2d16c05
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/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:Workpool"/>
+</contribution>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite
new file mode 100644
index 0000000000..1dc9ccfcea
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/main/resources/nodeE/Workpool.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://sample"
+ xmlns:sample="http://sample"
+ name="Workpool">
+ <component name="WorkerManagerNodeEComponent">
+ <implementation.java class="workpool.WorkerManagerImpl"/>
+ <property name="nodeName">nodeE</property>
+ <property name="compositeName">Workpool.composite</property>
+ <property name="workerClass">workpool.MyWorker</property>
+ <service name="WorkerManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="WorkerManager">
+ <binding.sca uri="http://u16:13004/WorkerManagerNodeEComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/demos/workpool-distributed/src/test/java/workpool/AComponent.java b/java/sca-contrib/demos/workpool-distributed/src/test/java/workpool/AComponent.java
new file mode 100644
index 0000000000..5c20537fab
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/src/test/java/workpool/AComponent.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 workpool;
+
+public interface AComponent {
+ public static final int RETURN_VALUE = 1;
+
+ public void greet();
+}
diff --git a/java/sca-contrib/demos/workpool-distributed/workerRules.drl b/java/sca-contrib/demos/workpool-distributed/workerRules.drl
new file mode 100644
index 0000000000..e7ebcad4c0
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/workerRules.drl
@@ -0,0 +1,9 @@
+package workpool
+import workpool.*;
+rule "WorkerAdder"
+ when
+ $workerBean: WorkpoolBean(singleAction == false && (jobComputed > 500))
+ then
+ $workerBean.addWorkerToNode("nodeB");
+ $workerBean.setSingleAction();
+end
diff --git a/java/sca-contrib/demos/workpool-distributed/workerRules1.drl b/java/sca-contrib/demos/workpool-distributed/workerRules1.drl
new file mode 100644
index 0000000000..6fa0b85ba2
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/workerRules1.drl
@@ -0,0 +1,9 @@
+package workpool
+import workpool.*;
+rule "WorkerAdder"
+ when
+ $workerBean: WorkpoolBean(averageServiceTime > 250)
+ then
+ $workerBean.addWorkerToNode("nodeB");
+ $workerBean.setSingleAction();
+end
diff --git a/java/sca-contrib/demos/workpool-distributed/workerRules2.drl b/java/sca-contrib/demos/workpool-distributed/workerRules2.drl
new file mode 100644
index 0000000000..9d9551c3ea
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/workerRules2.drl
@@ -0,0 +1,8 @@
+package workpool
+import workpool.*;
+rule "WorkerAverageService"
+ when
+ $workerBean: WorkpoolBean(jobComputed > 250)
+ then
+ $workerBean.addWorkerToNode("nodeB");
+end
diff --git a/java/sca-contrib/demos/workpool-distributed/workerRules3.drl b/java/sca-contrib/demos/workpool-distributed/workerRules3.drl
new file mode 100644
index 0000000000..a67af910a4
--- /dev/null
+++ b/java/sca-contrib/demos/workpool-distributed/workerRules3.drl
@@ -0,0 +1,14 @@
+package workpool
+import workpool.*;
+rule "AdaptUsageFactor"
+ when
+ $workerBean: WorkpoolBean(usageFactor > 0.8)
+ then
+ $workerBean.addWorkerToNode("");
+end
+rule "AdaptQueueFull"
+ when
+ $workerBean: WorkpoolBean((estimedQueueSize > 1900) && jobsComputed > 100)
+ then
+ $workerBean.addWorkerToNode("nodeB")
+end \ No newline at end of file
diff --git a/java/sca-contrib/demos/xml-bigbank/LICENSE b/java/sca-contrib/demos/xml-bigbank/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/NOTICE b/java/sca-contrib/demos/xml-bigbank/NOTICE
new file mode 100644
index 0000000000..51042eab05
--- /dev/null
+++ b/java/sca-contrib/demos/xml-bigbank/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/java/sca-contrib/demos/xml-bigbank/README b/java/sca-contrib/demos/xml-bigbank/README
new file mode 100644
index 0000000000..3bdeeca60a
--- /dev/null
+++ b/java/sca-contrib/demos/xml-bigbank/README
@@ -0,0 +1,46 @@
+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 run" and it will produce the following output.
+
+Buildfile: build.xml
+
+init:
+ [get] Getting: http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx?WSDL
+ [get] To: C:\Apache\tuscany-sca-1.0.1-incubating\demos\xml-bigbank\src\main\resources\wsdl\StockQuotes.wsdl
+ [get] local file date : Tue Nov 06 15:50:37 PST 2007
+ [get] .
+ [get] last modified = Wed Dec 31 16:00:00 PST 1969 - using current time instead
+ [mkdir] Created dir: C:\Apache\tuscany-sca-1.0.1-incubating\demos\xml-bigbank\target\classes
+
+compile:
+ [javac] Compiling 11 source files to C:\Apache\tuscany-sca-1.0.1-incubating\demos\xml-bigbank\target\classes
+ [copy] Copying 6 files to C:\Apache\tuscany-sca-1.0.1-incubating\demos\xml-bigbank\target\classes
+ [jar] Building jar: C:\Apache\tuscany-sca-1.0.1-incubating\demos\xml-bigbank\target\demo-xml-bigbank.jar
+
+run:
+ [java] Nov 6, 2007 3:52:28 PM org.apache.axis2.deployment.DeploymentEngine loadFromClassPath
+ [java] INFO: Module validation failed: The system is attempting to engage a module that is not available: rampart
+ [java] Retrieving exchange rate...
+ [java] Nov 6, 2007 3:52:29 PM org.apache.tuscany.sca.binding.feed.provider.RSSBindingInvoker invoke
+ [java] INFO: >>> RSSBindingInvoker (rss_2.0) 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.68705
+ [java] Loading account data...
+ [java] Getting stock quote...
+ [java] Nov 6, 2007 3:52:30 PM org.apache.commons.httpclient.HttpMethodBase readResponse
+ [java] INFO: Discarding unexpected response: HTTP/1.1 100 Continue
+ [java] Calculating total value...
+ [java] Checking Balance: xs:double: 1000
+ [java] Saving Blance: xs:double: 20000
+ [java] Stock Value: xs:integer: 0
+ [java] Total Value [1]: xs:double: 21000
+ [java] Total Value=USD 21000.0
+ [java] EUR: 14428.050000000001
+
+BUILD SUCCESSFUL
+Total time: 7 seconds
+
diff --git a/java/sca-contrib/demos/xml-bigbank/build.xml b/java/sca-contrib/demos/xml-bigbank/build.xml
new file mode 100644
index 0000000000..0ba1b069aa
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/pom.xml b/java/sca-contrib/demos/xml-bigbank/pom.xml
new file mode 100644
index 0000000000..0dc535352b
--- /dev/null
+++ b/java/sca-contrib/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>2.0-SNAPSHOT</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>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-saxon</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</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>2.0-SNAPSHOT</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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountData.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountData.java
new file mode 100644
index 0000000000..c3ae8d0912
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java
new file mode 100644
index 0000000000..bb37b97fb8
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountService.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountService.java
new file mode 100644
index 0000000000..4c72384e7b
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java
new file mode 100644
index 0000000000..77af28d6cd
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.ServiceRuntimeException;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java
new file mode 100644
index 0000000000..a7703787fb
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java
new file mode 100644
index 0000000000..f5f1ca90b6
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java
new file mode 100644
index 0000000000..96f9e9bd18
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java
new file mode 100644
index 0000000000..358e5e19a2
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java
new file mode 100644
index 0000000000..3b95f5240f
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.ServiceRuntimeException;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java
new file mode 100644
index 0000000000..7896cf7890
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/StockValue.java b/java/sca-contrib/demos/xml-bigbank/src/main/java/bigbank/StockValue.java
new file mode 100644
index 0000000000..6b9ab1f9a3
--- /dev/null
+++ b/java/sca-contrib/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.oasisopen.sca.annotation.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/java/sca-contrib/demos/xml-bigbank/src/main/resources/BigBank.composite b/java/sca-contrib/demos/xml-bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..8afde4bf80
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/resources/accounts.xml b/java/sca-contrib/demos/xml-bigbank/src/main/resources/accounts.xml
new file mode 100644
index 0000000000..52ffd41fa7
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/resources/customer.xsd b/java/sca-contrib/demos/xml-bigbank/src/main/resources/customer.xsd
new file mode 100644
index 0000000000..b22efb74c4
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/resources/stock.xq b/java/sca-contrib/demos/xml-bigbank/src/main/resources/stock.xq
new file mode 100644
index 0000000000..03c19e457d
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl b/java/sca-contrib/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl
new file mode 100644
index 0000000000..8411e22ff7
--- /dev/null
+++ b/java/sca-contrib/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/java/sca-contrib/demos/xml-bigbank/xml-bigbank.png b/java/sca-contrib/demos/xml-bigbank/xml-bigbank.png
new file mode 100644
index 0000000000..0743a413a3
--- /dev/null
+++ b/java/sca-contrib/demos/xml-bigbank/xml-bigbank.png
Binary files differ
diff --git a/java/sca-contrib/demos/xml-bigbank/xml-bigbank.svg b/java/sca-contrib/demos/xml-bigbank/xml-bigbank.svg
new file mode 100644
index 0000000000..c7acc03324
--- /dev/null
+++ b/java/sca-contrib/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>