From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../demos/alert-aggregator-webapp/DISCLAIMER | 8 + .../demos/alert-aggregator-webapp/LICENSE | 205 +++++++ .../axis2-1.4/demos/alert-aggregator-webapp/NOTICE | 6 + .../axis2-1.4/demos/alert-aggregator-webapp/README | 82 +++ .../alert-aggregator-webapp/alert-aggregator.png | Bin 0 -> 36819 bytes .../alert-aggregator-webapp/alert-aggregator.svg | 627 +++++++++++++++++++++ .../demos/alert-aggregator-webapp/build-dojo.xml | 92 +++ .../demos/alert-aggregator-webapp/build.xml | 148 +++++ .../demos/alert-aggregator-webapp/pom.xml | 344 +++++++++++ .../sca/demos/aggregator/AlertTypeNonSDOImpl.java | 339 +++++++++++ .../demos/aggregator/AlertsFeedServiceImpl.java | 106 ++++ .../sca/demos/aggregator/AlertsService.java | 40 ++ .../sca/demos/aggregator/AlertsServiceImpl.java | 126 +++++ .../sca/demos/aggregator/AlertsSourcesService.java | 69 +++ .../demos/aggregator/AlertsSourcesServiceImpl.java | 183 ++++++ .../sca/demos/aggregator/AlertsTypeNonSDOImpl.java | 74 +++ .../sca/demos/aggregator/ConfigTypeNonSDOImpl.java | 55 ++ .../sca/demos/aggregator/RSSCheckerService.java | 30 + .../demos/aggregator/RSSCheckerServiceImpl.java | 85 +++ .../sca/demos/aggregator/SourceTypeNonSDOImpl.java | 536 ++++++++++++++++++ .../src/main/resources/Alerts.wsdl | 88 +++ .../src/main/resources/Alerts.xsd | 80 +++ .../src/main/resources/AlertsSources.wsdl | 124 ++++ .../src/main/resources/alerts-client.composite | 49 ++ .../src/main/resources/alerts.composite | 85 +++ .../src/main/resources/sources.xml | 33 ++ .../src/main/webapp/AlertAggregator.html | 330 +++++++++++ .../src/main/webapp/META-INF/sca-contribution.xml | 26 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 32 ++ .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../src/main/webapp/pop.png | Bin 0 -> 244 bytes .../src/main/webapp/rss.png | Bin 0 -> 689 bytes .../src/main/webapp/service.smd | 1 + .../src/main/webapp/sources.smd | 1 + .../src/main/webapp/style.css | 176 ++++++ .../demos/aggregator/AlertsIntegrationTest.java | 99 ++++ sandbox/axis2-1.4/demos/bigbank-account/DISCLAIMER | 8 + sandbox/axis2-1.4/demos/bigbank-account/LICENSE | 205 +++++++ sandbox/axis2-1.4/demos/bigbank-account/NOTICE | 6 + sandbox/axis2-1.4/demos/bigbank-account/README | 4 + .../axis2-1.4/demos/bigbank-account/bigbank.png | Bin 0 -> 100070 bytes .../axis2-1.4/demos/bigbank-account/bigbank.svg | 537 ++++++++++++++++++ .../axis2-1.4/demos/bigbank-account/build-dojo.xml | 92 +++ sandbox/axis2-1.4/demos/bigbank-account/build.xml | 85 +++ sandbox/axis2-1.4/demos/bigbank-account/pom.xml | 71 +++ .../account/checking/CheckingAccountDetails.java | 50 ++ .../account/checking/CheckingAccountService.java | 37 ++ .../checking/CheckingAccountServiceImpl.java | 66 +++ .../account/savings/SavingsAccountDetails.java | 52 ++ .../account/savings/SavingsAccountService.java | 35 ++ .../account/savings/SavingsAccountServiceImpl.java | 66 +++ .../AccountsDataPasswordCallbackHandler.java | 54 ++ .../account/security/BigbankCheckingsAcl.java | 48 ++ ...ckingsDeptAuthImplementationPolicyProvider.java | 90 +++ .../account/security/CheckingsDeptAuthPolicy.java | 46 ++ .../CheckingsDeptAuthPolicyInterceptor.java | 77 +++ .../CheckingsDeptAuthPolicyProviderFactory.java | 75 +++ .../CheckingsDeptAuthorizationPolicyHandler.java | 65 +++ .../CheckingsDeptAuthorizationPolicyProcessor.java | 72 +++ .../bigbank/account/stock/StockAccountDetails.java | 68 +++ .../bigbank/account/stock/StockAccountService.java | 36 ++ .../account/stock/StockAccountServiceImpl.java | 60 ++ .../src/main/resources/CheckingsAccount.composite | 35 ++ .../main/resources/META-INF/sca-contribution.xml | 42 ++ ...ca.contribution.processor.StAXArtifactProcessor | 19 + ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 20 + ...ache.tuscany.sca.provider.PolicyProviderFactory | 19 + .../src/main/resources/SavingsAccount.composite | 34 ++ .../src/main/resources/StockAccount.composite | 34 ++ .../src/main/resources/definitions.xml | 58 ++ .../src/main/resources/web/AccountJSON.html | 92 +++ .../src/main/resources/web/style.css | 22 + .../src/main/resources/wsdl/AccountService.wsdl | 91 +++ .../axis2-1.4/demos/bigbank-calculator/DISCLAIMER | 8 + sandbox/axis2-1.4/demos/bigbank-calculator/LICENSE | 205 +++++++ sandbox/axis2-1.4/demos/bigbank-calculator/NOTICE | 6 + sandbox/axis2-1.4/demos/bigbank-calculator/README | 2 + .../axis2-1.4/demos/bigbank-calculator/build.xml | 68 +++ sandbox/axis2-1.4/demos/bigbank-calculator/pom.xml | 78 +++ .../src/main/java/calculator/AddService.java | 25 + .../main/java/calculator/CalculatorService.java | 34 ++ .../java/calculator/CalculatorServiceImpl.java | 72 +++ .../src/main/java/calculator/DivideService.java | 25 + .../src/main/java/calculator/MultiplyService.java | 25 + .../src/main/java/calculator/SubtractService.java | 25 + .../java/calculator/demo/CalculatorServer.java | 44 ++ .../src/main/resources/Calculator.composite | 55 ++ .../main/resources/calculator/AddServiceImpl.js | 22 + .../resources/calculator/DivideServiceImpl.groovy | 22 + .../resources/calculator/MultiplyServiceImpl.py | 21 + .../resources/calculator/SubtractServiceImpl.rb | 22 + .../axis2-1.4/demos/bigbank-stockquote/DISCLAIMER | 8 + sandbox/axis2-1.4/demos/bigbank-stockquote/LICENSE | 205 +++++++ sandbox/axis2-1.4/demos/bigbank-stockquote/NOTICE | 6 + sandbox/axis2-1.4/demos/bigbank-stockquote/README | 4 + .../axis2-1.4/demos/bigbank-stockquote/build.xml | 67 +++ sandbox/axis2-1.4/demos/bigbank-stockquote/pom.xml | 85 +++ .../java/stockquote/PasswordCallbackHandler.java | 47 ++ .../src/main/java/stockquote/StockQuoteImpl.java | 38 ++ .../main/java/stockquote/StockQuoteService.java | 30 + .../java/stockquote/demo/StockQuoteServer.java | 42 ++ .../src/main/resources/StockQuote.composite | 33 ++ .../src/main/resources/definitions.xml | 49 ++ .../src/main/resources/security.properties | 4 + .../src/main/resources/stockQuote.jks | Bin 0 -> 1986 bytes sandbox/axis2-1.4/demos/bigbank/DISCLAIMER | 8 + sandbox/axis2-1.4/demos/bigbank/LICENSE | 205 +++++++ sandbox/axis2-1.4/demos/bigbank/NOTICE | 6 + sandbox/axis2-1.4/demos/bigbank/README | 127 +++++ sandbox/axis2-1.4/demos/bigbank/bigbank.png | Bin 0 -> 100070 bytes sandbox/axis2-1.4/demos/bigbank/bigbank.svg | 537 ++++++++++++++++++ sandbox/axis2-1.4/demos/bigbank/build-dojo.xml | 92 +++ sandbox/axis2-1.4/demos/bigbank/build.xml | 84 +++ sandbox/axis2-1.4/demos/bigbank/pom.xml | 201 +++++++ .../main/java/bigbank/account/AccountService.java | 32 ++ .../java/bigbank/account/AccountServiceImpl.java | 99 ++++ .../java/bigbank/account/feed/AccountFeedImpl.java | 70 +++ .../main/java/bigbank/client/BigBankClient.java | 50 ++ .../src/main/java/bigbank/demo/BigBankServer.java | 130 +++++ .../security/BigbankPasswordCallbackHandler.java | 51 ++ .../main/java/calculator/CalculatorService.java | 34 ++ .../main/java/stockquote/StockQuoteService.java | 29 + .../bigbank/src/main/resources/BigBank.composite | 85 +++ .../main/resources/META-INF/sca-contribution.xml | 36 ++ .../demos/bigbank/src/main/resources/bigbank.jks | Bin 0 -> 1986 bytes .../bigbank/src/main/resources/definitions.xml | 64 +++ .../bigbank/src/main/resources/security.properties | 4 + .../src/main/resources/web/AccountJSON.html | 92 +++ .../demos/bigbank/src/main/resources/web/style.css | 22 + .../src/main/resources/wsdl/AccountService.wsdl | 91 +++ .../src/test/java/test/BigBankTestCase.java | 33 ++ .../demos/load-balancing-webapp/DISCLAIMER | 8 + .../axis2-1.4/demos/load-balancing-webapp/LICENSE | 205 +++++++ .../axis2-1.4/demos/load-balancing-webapp/NOTICE | 6 + .../axis2-1.4/demos/load-balancing-webapp/README | 76 +++ .../demos/load-balancing-webapp/build-tomcat.xml | 96 ++++ .../demos/load-balancing-webapp/build.xml | 125 ++++ .../axis2-1.4/demos/load-balancing-webapp/pom.xml | 349 ++++++++++++ .../src/main/java/client/LaunchClient.java | 57 ++ .../src/main/java/domain/LaunchDomain.java | 33 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 35 ++ .../main/java/helloworld/HelloWorldService.java | 31 + .../java/helloworld/HelloWorldServiceClient.java | 42 ++ .../demos/loadbalancer/rule/RoundRobinRule.java | 96 ++++ .../helloworldwsclient.composite | 33 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../sca-deployables/helloworldws.composite | 32 ++ .../src/main/webapp/WEB-INF/web.xml | 37 ++ .../src/test/resources/apache-80/conf/httpd.conf | 28 + .../resources/apache-80/conf/workers.properties | 18 + .../src/test/resources/tomcat-8085/conf/server.xml | 391 +++++++++++++ .../webapps/balancer/WEB-INF/config/rules.xml | 26 + .../src/test/resources/tomcat-8086/conf/server.xml | 391 +++++++++++++ .../src/test/resources/tomcat-8087/conf/server.xml | 391 +++++++++++++ .../demos/mortgage-creditcheck/DISCLAIMER | 8 + .../axis2-1.4/demos/mortgage-creditcheck/LICENSE | 205 +++++++ .../axis2-1.4/demos/mortgage-creditcheck/NOTICE | 6 + .../axis2-1.4/demos/mortgage-creditcheck/README | 6 + .../axis2-1.4/demos/mortgage-creditcheck/build.xml | 66 +++ .../axis2-1.4/demos/mortgage-creditcheck/pom.xml | 75 +++ .../src/main/java/credit/CreditCheck.java | 26 + .../src/main/java/credit/CreditCheckImpl.java | 34 ++ .../src/main/java/credit/CreditCheckServer.java | 40 ++ .../src/main/resources/CreditCheck.composite | 37 ++ .../src/main/resources/wsdl/credit.wsdl | 81 +++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../src/main/webapp/WEB-INF/web.xml | 37 ++ .../demos/mortgage-loanapproval/DISCLAIMER | 8 + .../axis2-1.4/demos/mortgage-loanapproval/LICENSE | 205 +++++++ .../axis2-1.4/demos/mortgage-loanapproval/NOTICE | 6 + .../axis2-1.4/demos/mortgage-loanapproval/README | 60 ++ .../demos/mortgage-loanapproval/build.xml | 66 +++ .../mortgage-loanapproval/doc/credit_composite.jpg | Bin 0 -> 73610 bytes .../mortgage-loanapproval/doc/credit_composite.png | Bin 0 -> 51153 bytes .../mortgage-loanapproval/doc/loan_approval.jpg | Bin 0 -> 162536 bytes .../mortgage-loanapproval/doc/loan_approval.png | Bin 0 -> 58247 bytes .../doc/mortgage_assembly0.jpg | Bin 0 -> 145053 bytes .../doc/mortgage_assembly0.png | Bin 0 -> 93773 bytes .../doc/mortgage_assembly1.jpg | Bin 0 -> 181317 bytes .../doc/mortgage_assembly1.png | Bin 0 -> 113404 bytes .../doc/mortgage_assembly2.jpg | Bin 0 -> 180240 bytes .../doc/mortgage_assembly2.png | Bin 0 -> 106656 bytes .../doc/mortgage_composite.jpg | Bin 0 -> 343699 bytes .../doc/mortgage_composite.png | Bin 0 -> 288351 bytes .../doc/mortgage_diagrams.doc | Bin 0 -> 2278400 bytes .../doc/mortgage_package1.jpg | Bin 0 -> 181031 bytes .../doc/mortgage_package1.png | Bin 0 -> 34939 bytes .../doc/mortgage_package2.jpg | Bin 0 -> 110930 bytes .../doc/mortgage_package2.png | Bin 0 -> 58993 bytes .../doc/mortgage_scenario.jpg | Bin 0 -> 225690 bytes .../doc/mortgage_scenario.png | Bin 0 -> 106791 bytes .../mortgage-loanapproval/mortgage_assembly.png | Bin 0 -> 106656 bytes .../axis2-1.4/demos/mortgage-loanapproval/pom.xml | 83 +++ .../src/main/java/mortgage/CreditCheck.java | 29 + .../src/main/java/mortgage/CreditCheckImpl.java | 34 ++ .../src/main/java/mortgage/Customer.java | 76 +++ .../src/main/java/mortgage/InterestRateQuote.java | 23 + .../main/java/mortgage/InterestRateQuoteImpl.java | 42 ++ .../src/main/java/mortgage/LoanApproval.java | 27 + .../src/main/java/mortgage/LoanApprovalImpl.java | 84 +++ .../src/main/java/mortgage/MortgageCalculator.java | 29 + .../main/java/mortgage/MortgageCalculatorImpl.java | 38 ++ .../src/main/java/mortgage/MortgageClient.java | 44 ++ .../src/main/java/mortgage/RiskAssessment.java | 27 + .../src/main/java/mortgage/RiskAssessmentImpl.java | 38 ++ .../src/main/resources/Mortgage.composite | 48 ++ .../src/main/resources/Mortgage1.composite | 57 ++ .../resources/MortgageCalculator.componentType | 27 + .../src/main/resources/MortgageCalculator.js | 25 + .../src/main/resources/wsdl/credit.wsdl | 81 +++ .../test/java/mortgage/MortgageClientTestCase.java | 56 ++ sandbox/axis2-1.4/demos/pom.xml | 52 ++ .../demos/workpool-distributed/DISCLAIMER | 8 + .../axis2-1.4/demos/workpool-distributed/LICENSE | 205 +++++++ .../axis2-1.4/demos/workpool-distributed/NOTICE | 6 + .../axis2-1.4/demos/workpool-distributed/build.xml | 446 +++++++++++++++ .../axis2-1.4/demos/workpool-distributed/pom.xml | 148 +++++ .../src/main/java/node/DomainNode.java | 57 ++ .../src/main/java/node/DomainNodeDaemon.java | 79 +++ .../src/main/java/node/TestJob.java | 82 +++ .../src/main/java/node/WorkpoolDaemon.java | 271 +++++++++ .../src/main/java/node/WorkpoolNode.java | 179 ++++++ .../src/main/java/node/workerRules1.drl | 13 + .../main/java/workpool/MetaComponentWorker.java | 85 +++ .../src/main/java/workpool/MyWorker.java | 46 ++ .../src/main/java/workpool/NullJob.java | 43 ++ .../src/main/java/workpool/ResultJob.java | 54 ++ .../src/main/java/workpool/Trigger.java | 29 + .../src/main/java/workpool/WorkerManager.java | 31 + .../src/main/java/workpool/WorkerManagerImpl.java | 213 +++++++ .../src/main/java/workpool/WorkerService.java | 56 ++ .../main/java/workpool/WorkerServiceCallback.java | 27 + .../src/main/java/workpool/WorkerServiceImpl.java | 171 ++++++ .../src/main/java/workpool/WorkpoolBean.java | 162 ++++++ .../main/java/workpool/WorkpoolBeanListener.java | 25 + .../src/main/java/workpool/WorkpoolEvent.java | 71 +++ .../src/main/java/workpool/WorkpoolManager.java | 48 ++ .../main/java/workpool/WorkpoolManagerImpl.java | 555 ++++++++++++++++++ .../src/main/java/workpool/WorkpoolService.java | 91 +++ .../main/java/workpool/WorkpoolServiceImpl.java | 416 ++++++++++++++ .../resources/nodeA/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeA/Workpool.composite | 47 ++ .../resources/nodeB/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeB/Workpool.composite | 38 ++ .../resources/nodeC/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeC/Workpool.composite | 38 ++ .../resources/nodeD/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeD/Workpool.composite | 38 ++ .../resources/nodeE/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeE/Workpool.composite | 38 ++ .../src/test/java/workpool/AComponent.java | 25 + .../demos/workpool-distributed/workerRules.drl | 9 + .../demos/workpool-distributed/workerRules1.drl | 9 + .../demos/workpool-distributed/workerRules2.drl | 8 + .../demos/workpool-distributed/workerRules3.drl | 14 + sandbox/axis2-1.4/demos/xml-bigbank/DISCLAIMER | 8 + sandbox/axis2-1.4/demos/xml-bigbank/LICENSE | 205 +++++++ sandbox/axis2-1.4/demos/xml-bigbank/NOTICE | 6 + sandbox/axis2-1.4/demos/xml-bigbank/README | 46 ++ sandbox/axis2-1.4/demos/xml-bigbank/build.xml | 63 +++ sandbox/axis2-1.4/demos/xml-bigbank/pom.xml | 115 ++++ .../src/main/java/bigbank/AccountData.java | 36 ++ .../src/main/java/bigbank/AccountDataImpl.java | 48 ++ .../src/main/java/bigbank/AccountService.java | 32 ++ .../src/main/java/bigbank/AccountServiceImpl.java | 84 +++ .../src/main/java/bigbank/BigBankClient.java | 35 ++ .../src/main/java/bigbank/BigBankServer.java | 40 ++ .../src/main/java/bigbank/CurrencyExchange.java | 36 ++ .../src/main/java/bigbank/ExchangeRate.java | 32 ++ .../src/main/java/bigbank/ExchangeRateImpl.java | 84 +++ .../src/main/java/bigbank/StockQuote.java | 38 ++ .../src/main/java/bigbank/StockValue.java | 38 ++ .../src/main/resources/BigBank.composite | 51 ++ .../xml-bigbank/src/main/resources/accounts.xml | 29 + .../xml-bigbank/src/main/resources/customer.xsd | 46 ++ .../demos/xml-bigbank/src/main/resources/stock.xq | 52 ++ .../src/main/resources/wsdl/StockQuotes.wsdl | 23 + .../axis2-1.4/demos/xml-bigbank/xml-bigbank.png | Bin 0 -> 30396 bytes .../axis2-1.4/demos/xml-bigbank/xml-bigbank.svg | 447 +++++++++++++++ 279 files changed, 20385 insertions(+) create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/LICENSE create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/NOTICE create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/README create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.png create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.svg create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/build-dojo.xml create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/build.xml create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/pom.xml create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts.composite create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/sources.xml create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/pop.png create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/rss.png create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/service.smd create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/sources.smd create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/style.css create mode 100644 sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/LICENSE create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/NOTICE create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/README create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/bigbank.png create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/bigbank.svg create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/build-dojo.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/build.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/pom.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/CheckingsAccount.composite create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/SavingsAccount.composite create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/StockAccount.composite create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/definitions.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/web/AccountJSON.html create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/web/style.css create mode 100644 sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/LICENSE create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/NOTICE create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/README create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/build.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/pom.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/AddService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/DivideService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/Calculator.composite create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py create mode 100644 sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/LICENSE create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/NOTICE create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/README create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/build.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/pom.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/StockQuote.composite create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/definitions.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/security.properties create mode 100644 sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/stockQuote.jks create mode 100644 sandbox/axis2-1.4/demos/bigbank/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/bigbank/LICENSE create mode 100644 sandbox/axis2-1.4/demos/bigbank/NOTICE create mode 100644 sandbox/axis2-1.4/demos/bigbank/README create mode 100644 sandbox/axis2-1.4/demos/bigbank/bigbank.png create mode 100644 sandbox/axis2-1.4/demos/bigbank/bigbank.svg create mode 100644 sandbox/axis2-1.4/demos/bigbank/build-dojo.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank/build.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank/pom.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/calculator/CalculatorService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/java/stockquote/StockQuoteService.java create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/BigBank.composite create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/bigbank.jks create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/definitions.xml create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/security.properties create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/web/AccountJSON.html create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/web/style.css create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl create mode 100644 sandbox/axis2-1.4/demos/bigbank/src/test/java/test/BigBankTestCase.java create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/LICENSE create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/NOTICE create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/README create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/build-tomcat.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/build.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/pom.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/client/LaunchClient.java create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/domain/LaunchDomain.java create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldService.java create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldServiceClient.java create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/org/apache/tuscany/sca/demos/loadbalancer/rule/RoundRobinRule.java create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/resources/client-contribution/helloworldwsclient.composite create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/apache-80/conf/httpd.conf create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/apache-80/conf/workers.properties create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8085/webapps/balancer/WEB-INF/config/rules.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml create mode 100644 sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/LICENSE create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/NOTICE create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/README create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/build.xml create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/pom.xml create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/LICENSE create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/NOTICE create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/README create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/build.xml create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/mortgage_assembly.png create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/pom.xml create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl create mode 100644 sandbox/axis2-1.4/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java create mode 100644 sandbox/axis2-1.4/demos/pom.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/LICENSE create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/NOTICE create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/build.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/pom.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/DomainNode.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/DomainNodeDaemon.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/TestJob.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/WorkpoolDaemon.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/WorkpoolNode.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/workerRules1.drl create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/MetaComponentWorker.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/MyWorker.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/NullJob.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/ResultJob.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/Trigger.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerManager.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerManagerImpl.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerService.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerServiceCallback.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolBean.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolBeanListener.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolEvent.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolManager.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/src/test/java/workpool/AComponent.java create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/workerRules.drl create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/workerRules1.drl create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/workerRules2.drl create mode 100644 sandbox/axis2-1.4/demos/workpool-distributed/workerRules3.drl create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/DISCLAIMER create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/LICENSE create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/NOTICE create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/README create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/build.xml create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/pom.xml create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountData.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountService.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockValue.java create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/BigBank.composite create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/accounts.xml create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/customer.xsd create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/stock.xq create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.png create mode 100644 sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.svg (limited to 'sandbox/axis2-1.4/demos') diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/DISCLAIMER b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/LICENSE b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/alert-aggregator-webapp/NOTICE b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/README b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/README new file mode 100644 index 0000000000..3ec27ef65f --- /dev/null +++ b/sandbox/axis2-1.4/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 + + + + BBC News + http://news.bbc.co.uk/ + 10-Jun-2007 16:34:03 + http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml + + + Engadget + http://www.engadget.com + 10-Jun-2007 16:34:03 + http://www.engadget.com/rss.xml + + + +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/sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.png b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.png new file mode 100644 index 0000000000..ae429cca94 Binary files /dev/null and b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.png differ diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.svg b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.svg new file mode 100644 index 0000000000..807416135e --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/alert-aggregator.svg @@ -0,0 +1,627 @@ + + + + + + + + + + image/svg+xml + + + + + + + + DisplayComposite - PHP + + Display + + + + + + AlerterComposite - Java + + AlertsService + + + + rest soap + + + soap + + RSS + + + AlertsSourcesService + + + + + + jsonrpc + + + + + soap + + soap + atom + jsonrpc + + + + + + + POP - Not done + + + + + + + + + HTML Web2.0 Thunderbird + + NNTP - Not done + + rss + + AlertFeedService + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/build-dojo.xml b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/build-dojo.xml new file mode 100644 index 0000000000..c31c9adee8 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/build.xml b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/build.xml new file mode 100644 index 0000000000..b75842d08c --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/build.xml @@ -0,0 +1,148 @@ + + +]> + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/pom.xml b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/pom.xml new file mode 100644 index 0000000000..e42ab9ed84 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/pom.xml @@ -0,0 +1,344 @@ + + + + 4.0.0 + + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + + org.apache.tuscany.sca + demo-alert-aggregator-webapp + war + 2.0-incubating-SNAPSHOT + Apache Tuscany SCA Alert Aggregator Demo + http://cwiki.apache.org/TUSCANY + + + + junit + junit + 4.2 + test + + + httpunit + httpunit + 1.6.1 + test + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + 1.1-incubating + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.1-incubating + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + ${pom.version} + runtime + + + org.apache.tuscany.sca + tuscany-core-databinding + ${pom.version} + runtime + + + org.apache.tuscany.sca + tuscany-databinding-jaxb + ${pom.version} + runtime + + + org.apache.tuscany.sca + tuscany-databinding-sdo + ${pom.version} + compile + + + org.apache.tuscany.sca + tuscany-databinding-axiom + ${pom.version} + compile + + + org.apache.tuscany.sca + tuscany-host-embedded + ${pom.version} + compile + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + ${pom.version} + compile + + + org.apache.tuscany.sca + tuscany-interface-java-xml + ${pom.version} + compile + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-incubating-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-binding-rss-rome + 2.0-incubating-SNAPSHOT + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + runtime + + + + + demo-alert-aggregator-webapp + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-test-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.1-incubating + + + generate-sdo + generate-sources + + + + ${basedir}/src/main/resources/Alerts.wsdl + org.apache.tuscany.sca.demos.aggregator.service + + + ${basedir}/src/main/resources/AlertsSources.wsdl + org.apache.tuscany.sca.demos.aggregator.sources + + + ${basedir}/src/main/resources/Alerts.xsd + org.apache.tuscany.sca.demos.aggregator.types + + + true + true + true + + + generate + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.1 + + + + ant + ant-trax + 1.6.5 + + + + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + surefire-it + integration-test + + test + + + + **/*AlertsIntegrationTest.java + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + + + start-container + pre-integration-test + + start + + + + stop-container + post-integration-test + + stop + + + + + + jetty6x + embedded + + org.apache.commons.logging.impl.SimpleLog + + + false + + + 8080 + + + + + ${project.build.directory}/${project.build.finalName}.${project.packaging} + + http://localhost:8080/AlertsSourcesServiceJSONRPC + + + ${project.build.directory}/cargo-jetty + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-incubating-SNAPSHOT + + + + true + + + generate + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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() Title}' attribute. + * + * + * @see #getTitle() + * @generated + * @ordered + */ + protected static final String TITLE_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getTitle() Title}' attribute. + * + * + * @see #getTitle() + * @generated + * @ordered + */ + protected String title = TITLE_DEFAULT_; + + /** + * The default value of the '{@link #getSummary() Summary}' attribute. + * + * + * @see #getSummary() + * @generated + * @ordered + */ + protected static final String SUMMARY_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getSummary() Summary}' attribute. + * + * + * @see #getSummary() + * @generated + * @ordered + */ + protected String summary = SUMMARY_DEFAULT_; + + /** + * The default value of the '{@link #getAddress() Address}' attribute. + * + * + * @see #getAddress() + * @generated + * @ordered + */ + protected static final String ADDRESS_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getAddress() Address}' attribute. + * + * + * @see #getAddress() + * @generated + * @ordered + */ + protected String address = ADDRESS_DEFAULT_; + + /** + * The default value of the '{@link #getDate() Date}' attribute. + * + * + * @see #getDate() + * @generated + * @ordered + */ + protected static final String DATE_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getDate() Date}' attribute. + * + * + * @see #getDate() + * @generated + * @ordered + */ + protected String date = DATE_DEFAULT_; + + /** + * The default value of the '{@link #getSourceId() Source Id}' attribute. + * + * + * @see #getSourceId() + * @generated + * @ordered + */ + protected static final String SOURCE_ID_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getSourceId() Source Id}' attribute. + * + * + * @see #getSourceId() + * @generated + * @ordered + */ + protected String sourceId = SOURCE_ID_DEFAULT_; + + /** + * The default value of the '{@link #isUnread() Unread}' attribute. + * + * + * @see #isUnread() + * @generated + * @ordered + */ + protected static final boolean UNREAD_DEFAULT_ = false; + + /** + * The cached value of the '{@link #isUnread() Unread}' attribute. + * + * + * @see #isUnread() + * @generated + * @ordered + */ + protected boolean unread = UNREAD_DEFAULT_; + + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final String ID_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected String id = ID_DEFAULT_; + + /** + * + * + * @generated + */ + public AlertTypeNonSDOImpl() + { + super(); + } + + + /** + * + * + * @generated + */ + public String getTitle() + { + return title; + } + /** + * + * + * @generated + */ + public void setTitle(String newTitle) + { + title = newTitle; + } + + /** + * + * + * @generated + */ + public String getSummary() + { + return summary; + } + /** + * + * + * @generated + */ + public void setSummary(String newSummary) + { + summary = newSummary; + } + + /** + * + * + * @generated + */ + public String getAddress() + { + return address; + } + /** + * + * + * @generated + */ + public void setAddress(String newAddress) + { + address = newAddress; + } + + /** + * + * + * @generated + */ + public String getDate() + { + return date; + } + /** + * + * + * @generated + */ + public void setDate(String newDate) + { + date = newDate; + } + + /** + * + * + * @generated + */ + public String getSourceId() + { + return sourceId; + } + /** + * + * + * @generated + */ + public void setSourceId(String newSourceId) + { + sourceId = newSourceId; + } + + /** + * + * + * @generated + */ + public boolean isUnread() + { + return unread; + } + /** + * + * + * @generated + */ + public void setUnread(boolean newUnread) + { + unread = newUnread; + } + + /** + * + * + * @generated + */ + public String getId() + { + return id; + } + /** + * + * + * @generated + */ + public void setId(String newId) + { + id = newId; + } + + /** + * + * + * @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/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java new file mode 100644 index 0000000000..b062504311 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.demos.aggregator; + +import java.text.DateFormat; + +import org.apache.abdera.Abdera; +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.apache.tuscany.sca.binding.atom.collection.Collection; +import org.apache.tuscany.sca.binding.atom.collection.NotFoundException; +import org.apache.tuscany.sca.demos.aggregator.types.AlertType; +import org.apache.tuscany.sca.demos.aggregator.types.AlertsType; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * Read all new alerts from the specified sources + * + * @version $Rev$ $Date$ + */ +@Service(Collection.class) +public class AlertsFeedServiceImpl implements Collection { + + private AlertsService alerts; + + @Reference + public void setAlerts(AlertsService alerts) { + this.alerts = alerts; + } + + DateFormat dateFormatter = DateFormat.getDateTimeInstance(); + + /** + * Return the alerts as a feed. + * + * @return the structure containing alerts + */ + public org.apache.abdera.model.Feed getFeed() { + + // Create a new Feed + Factory factory = Abdera.getNewFactory(); + Feed feed = factory.newFeed(); + feed.setTitle("Apache Tuscany Feed Aggregator"); + feed.setSubtitle("A sample showing an SCA application to aggregate various types of feeds"); + feed.addAuthor("Apache Tuscany"); + feed.addLink("http://incubator.apache.org/tuscany"); + + // Aggregate entries from feed1 and feed2 + try { + AlertsType alerts = this.alerts.getAllNewAlerts(""); + + for( Object alertObject : alerts.getAlert() ){ + AlertType alert = ((AlertType)alertObject); + Entry entry = factory.newEntry(); + entry.setTitle(alert.getTitle()); + //entry.(alert.getSummary()); + entry.addLink(alert.getAddress()); + entry.setPublished(dateFormatter.parse(alert.getDate())); + + feed.addEntry(entry); + } + } catch(Exception ex) { + System.err.println("Exception " + ex.toString()); + } + + return feed; + } + + public Feed query(String queryString) { + return getFeed(); + } + + public void delete(String id) throws NotFoundException { + } + + public Entry get(String id) throws NotFoundException { + return null; + } + + public Entry post(Entry entry) { + return null; + } + + public void put(String id, Entry entry) throws NotFoundException { + } + +} diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java new file mode 100644 index 0000000000..c4bf13ce7a --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.demos.aggregator; + +import org.apache.tuscany.sca.demos.aggregator.types.AlertsType; +import org.osoa.sca.annotations.Remotable; + +/** + * Retrieve and manage alerts + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface AlertsService { + + /** + * Return a structure holding all of the new alerts that have been found + * + * @return the structure containing alerts + */ + public AlertsType getAllNewAlerts(String id); + +} diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java new file mode 100644 index 0000000000..28e27a9978 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.demos.aggregator; + +import java.text.DateFormat; +import java.util.Date; +import java.util.List; + +import org.apache.tuscany.sca.demos.aggregator.types.AlertType; +import org.apache.tuscany.sca.demos.aggregator.types.AlertsType; +import org.apache.tuscany.sca.demos.aggregator.types.ConfigType; +import org.apache.tuscany.sca.demos.aggregator.types.SourceType; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * Read all new alerts from the specified sources + * + * @version $Rev$ $Date$ + */ +@Service(AlertsService.class) +public class AlertsServiceImpl implements AlertsService { + + private RSSCheckerService rssChecker; + + private AlertsSourcesService alertsSources; + + @Reference + public void setRssChecker(RSSCheckerService rssChecker) { + this.rssChecker = rssChecker; + } + + @Reference + public void setAlertsSources(AlertsSourcesService alertsSources) { + this.alertsSources = alertsSources; + } + + DateFormat dateFormatter = DateFormat.getDateTimeInstance(); + + /** + * Return a structure holding all of the new alerts that have been found + * + * @return the structure containing alerts + */ + public AlertsType getAllNewAlerts(String id) + { + System.err.println("getAllNewAlerts(" + id + ")"); + + //TypesFactory factory = TypesFactory.INSTANCE; + //AlertsType returnAlerts = factory.createAlertsType(); + AlertsType returnAlerts = new AlertsTypeNonSDOImpl(); + List returnAlertList = returnAlerts.getAlert(); + + // get the date/time now so that we can update the + // alert source record so that next time we + // only get the latest alerts + Date now = new Date(); + String nowString = dateFormatter.format(now); + + try { + ConfigType alertSourceConfig = alertsSources.getAlertSources(id); + + for (Object source : alertSourceConfig.getSource()){ + SourceType sourceType = (SourceType)source; + + AlertsType alerts = null; + + if ( sourceType.getFeedType().equals("rss")){ + alerts = rssChecker.getNewAlerts(sourceType.getFeedAddress(), + sourceType.getLastChecked()); + } else { + + } + + // extend return list with any alerts we found + for( Object alert : alerts.getAlert() ){ + + // set the id on the alert so we know which source it + // came from + ((AlertType)alert).setSourceId(sourceType.getId()); + + // convert from SDO to POJO so that the + // JSONRPC binding will work. It can't currently + // handle SDOs + AlertType newAlert = new AlertTypeNonSDOImpl(); + + newAlert.setSourceId(((AlertType)alert).getSourceId()); + newAlert.setTitle(((AlertType)alert).getTitle()); + newAlert.setSummary(((AlertType)alert).getSummary()); + newAlert.setAddress(((AlertType)alert).getAddress()); + newAlert.setDate(((AlertType)alert).getDate()); + newAlert.setId(((AlertType)alert).getId()); + newAlert.setUnread(((AlertType)alert).isUnread()); + + returnAlertList.add(newAlert); + } + + // update the time last checked for this source + sourceType.setLastChecked(nowString); + //alertsSources.updateAlertSource(sourceType); + } + } catch(Exception ex) { + System.err.println("Exception " + ex.toString()); + } + + return returnAlerts ; + + } +} diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java new file mode 100644 index 0000000000..7b943b1b45 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.demos.aggregator; + +import org.apache.tuscany.sca.demos.aggregator.types.ConfigType; +import org.apache.tuscany.sca.demos.aggregator.types.SourceType; +import org.osoa.sca.annotations.Remotable; + +/** + * Retrieve and manage alert sources + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface AlertsSourcesService { + + /** + * Return all of the configured alert sources. + * + * @return the list of alert sources + */ + public ConfigType getAlertSources (String id); + + /** + * Return a single alert source. + * @param id not currently used + * @return the alert source + */ + public SourceType getAlertSource (String id); + + /** + * Update an alert source. + * + * @param updatedSource the alert source to update + */ + public void updateAlertSource (SourceType updatedSource); + + /** + * Add an alert source. + * + * @param newSource the alert source to add + */ + public String addAlertSource (SourceType newSource); + + /** + * Remove an alert source. + * + * @param oldSource the alert source to remove + */ + public void removeAlertSource (String id); + +} diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java new file mode 100644 index 0000000000..ca2fc95b4a --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java @@ -0,0 +1,183 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.demos.aggregator; + +import java.io.InputStream; +import java.text.DateFormat; +import java.util.Date; + +import org.apache.tuscany.sca.demos.aggregator.types.ConfigType; +import org.apache.tuscany.sca.demos.aggregator.types.SourceType; +import org.apache.tuscany.sca.demos.aggregator.types.TypesFactory; +import org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.impl.HelperProvider; + +/** + * Retrieve and manage alert sources + * + * @version $Rev$ $Date$ + */ +@Service(AlertsSourcesService.class) +@Scope("COMPOSITE") +public class AlertsSourcesServiceImpl implements AlertsSourcesService { + + ConfigType alertSources; + + /** + * Constructor reads the configuration to provide + * the initial list of alert sources + */ + public AlertsSourcesServiceImpl(){ + System.err.println("AlertsSourcesServiceImpl()"); + try { + // read the alerts config from an XML file + InputStream is = this.getClass().getClassLoader().getResourceAsStream("sources.xml"); + + if (is == null) { + throw new Exception("Can;t find sources.xml"); + } else { + HelperContext helperContext = HelperProvider.getDefaultContext(); + TypesFactory.INSTANCE.register(helperContext); + XMLDocument xmlDoc = helperContext.getXMLHelper().load(is); + alertSources = (ConfigType)xmlDoc.getRootObject(); + } + } catch (Exception ex) { + System.err.println("Exception " + ex.toString()); + } + } + + /** + * Return all of the configured alert sources. + * + * @return the list of alert sources + */ + public ConfigType getAlertSources (String id) + { + System.err.println("getAlertSources(" + id + ")"); + + // convert alert sources to POJOs so that + // the JSONRPC binding will work + ConfigTypeNonSDOImpl sources = new ConfigTypeNonSDOImpl(); + + for (Object source : alertSources.getSource()) { + SourceTypeNonSDOImpl newSource = new SourceTypeNonSDOImpl(); + newSource.setAddress(((SourceTypeImpl)source).getAddress()); + newSource.setFeedAddress(((SourceTypeImpl)source).getFeedAddress()); + newSource.setId(((SourceTypeImpl)source).getId()); + newSource.setLastChecked(((SourceTypeImpl)source).getLastChecked()); + newSource.setName(((SourceTypeImpl)source).getName()); + newSource.setFeedType(((SourceTypeImpl)source).getFeedType()); + sources.getSource().add(newSource); + } + + return sources; + } + + /** + * Return a single alert source. + * @param id the alert source id number + * @return the alert source + */ + public SourceType getAlertSource (String id) + { + System.err.println("getAlertSource(" + id + ")"); + SourceType alertSource = null; + + for (Object source : alertSources.getSource()) { + if ( ((SourceType)source).getId().equals(id)) { + alertSource = (SourceType)source; + } + } + return alertSource; + } + + /** + * Update an alert source. + * + * @param updatedSource the alert source to update + */ + public void updateAlertSource (SourceType updatedSource) + { + System.err.println("updateAlertSource()"); + + Object originalSource = null; + + for (Object source : alertSources.getSource()) { + if ( ((SourceType)source).getId().equals(updatedSource.getId())) { + originalSource = source; + break; + } + } + + if (originalSource != null){ + alertSources.getSource().add(updatedSource); + alertSources.getSource().remove(originalSource); + } + } + + /** + * Add an alert source. + * + * @param newSource the alert source to add + */ + public String addAlertSource (SourceType newSource) + { + System.err.println("addAlertSource()"); + // set the date to now less 2 hours so we + // get some alerts straight away + DateFormat dateFormatter = DateFormat.getDateTimeInstance(); + Date now = new Date(); + now.setHours(now.getHours()-2); + String nowString = dateFormatter.format(now); + newSource.setLastChecked(nowString); + alertSources.getSource().add(newSource); + return "Done"; + } + + /** + * Remove an alert source. + * + * @param oldSource the alert source to remove + */ + public void removeAlertSource (String id) + { + System.err.println("removeAlertSource()"); + + Object originalSource = null; + + for (Object source : alertSources.getSource()) { + if ( ((SourceType)source).getId().equals(id)) { + originalSource = source; + break; + } + } + + if (originalSource != null) { + alertSources.getSource().remove(originalSource); + } + + } + +} diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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; + +/** + * + * An implementation of the model object 'Alerts Type'. + * + *

+ * The following features are implemented: + *

+ *

+ * + * @generated + */ +public class AlertsTypeNonSDOImpl implements AlertsType +{ + private static final long serialVersionUID = -3784576466148158776L; + +/** + * The cached value of the '{@link #getAlert() Alert}' containment reference list. + * + * + * @see #getAlert() + * @generated + * @ordered + */ + + protected List alert = new ArrayList(); + + /** + * + * + * @generated + */ + public AlertsTypeNonSDOImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public List getAlert() + { + return alert; + } + +} //AlertsTypeImpl diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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(); + + /** + * + * + * @generated + */ + public ConfigTypeNonSDOImpl() + { + super(); + } + + + /** + * + * + * @generated + */ + public List getSource() + { + return source; + } + + +} //ConfigTypeImpl diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java new file mode 100644 index 0000000000..9b73a27625 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.demos.aggregator; + +import java.net.URL; +import java.text.DateFormat; +import java.util.Date; +import java.util.List; + +import org.apache.tuscany.sca.demos.aggregator.types.AlertType; +import org.apache.tuscany.sca.demos.aggregator.types.AlertsType; +import org.apache.tuscany.sca.demos.aggregator.types.TypesFactory; + +import com.sun.syndication.feed.synd.SyndEntry; +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.io.SyndFeedInput; +import com.sun.syndication.io.XmlReader; + +/** + * The interface for the rss checker service + */ +public class RSSCheckerServiceImpl implements RSSCheckerService { + + public AlertsType getNewAlerts(String rssaddress, String lastchecktimestamp){ + // Create the list of alerts to return + TypesFactory factory = TypesFactory.INSTANCE; + AlertsType returnAlerts = factory.createAlertsType(); + List returnAlertList = returnAlerts.getAlert(); + + try { + // Turn the date into something we can process. + DateFormat dateFormatter = DateFormat.getDateTimeInstance(); + Date timestamp = dateFormatter.parse(lastchecktimestamp); + + // get the feed data from the supplied address + SyndFeedInput input = new SyndFeedInput(); + SyndFeed feed = input.build(new XmlReader(new URL(rssaddress))); + //System.out.println(feed); + + // check all the items to see if we have seen them before + List entries = feed.getEntries(); + for(Object entry: entries){ + SyndEntry syndEntry = (SyndEntry)entry; + + if (syndEntry.getPublishedDate().after(timestamp)){ + AlertType newAlert = factory.createAlertType(); + + newAlert.setTitle(syndEntry.getTitle()); + // newAlert.setSummary(""); + newAlert.setSummary(""); + newAlert.setAddress(syndEntry.getLink()); + newAlert.setDate(dateFormatter.format(syndEntry.getPublishedDate())); + newAlert.setId(rssaddress); + newAlert.setUnread(true); + + returnAlertList.add(newAlert); + } + } + + } catch(Exception ex) { + System.err.println("Exception " + ex.toString()); + } + + return returnAlerts; + } + +} diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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 'Name' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_NAME = 0; + + /** + * The internal feature id for the 'Address' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_ADDRESS = 1; + + /** + * The internal feature id for the 'Last Checked' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_LAST_CHECKED = 2; + + /** + * The internal feature id for the 'Feed Address' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_FEED_ADDRESS = 3; + + /** + * The internal feature id for the 'Pop Server' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_POP_SERVER = 4; + + /** + * The internal feature id for the 'Pop Username' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_POP_USERNAME = 5; + + /** + * The internal feature id for the 'Pop Password' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_POP_PASSWORD = 6; + + /** + * The internal feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_ANY = 7; + + /** + * The internal feature id for the 'Id' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_ID = 8; + + /** + * The internal feature id for the 'Type' attribute. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_TYPE = 9; + + /** + * The number of properties for this type. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 10; + + + + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_DEFAULT_; + + /** + * The default value of the '{@link #getAddress() Address}' attribute. + * + * + * @see #getAddress() + * @generated + * @ordered + */ + protected static final String ADDRESS_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getAddress() Address}' attribute. + * + * + * @see #getAddress() + * @generated + * @ordered + */ + protected String address = ADDRESS_DEFAULT_; + + /** + * The default value of the '{@link #getLastChecked() Last Checked}' attribute. + * + * + * @see #getLastChecked() + * @generated + * @ordered + */ + protected static final String LAST_CHECKED_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getLastChecked() Last Checked}' attribute. + * + * + * @see #getLastChecked() + * @generated + * @ordered + */ + protected String lastChecked = LAST_CHECKED_DEFAULT_; + + /** + * The default value of the '{@link #getFeedAddress() Feed Address}' attribute. + * + * + * @see #getFeedAddress() + * @generated + * @ordered + */ + protected static final String FEED_ADDRESS_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getFeedAddress() Feed Address}' attribute. + * + * + * @see #getFeedAddress() + * @generated + * @ordered + */ + protected String feedAddress = FEED_ADDRESS_DEFAULT_; + + /** + * The default value of the '{@link #getPopServer() Pop Server}' attribute. + * + * + * @see #getPopServer() + * @generated + * @ordered + */ + protected static final String POP_SERVER_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getPopServer() Pop Server}' attribute. + * + * + * @see #getPopServer() + * @generated + * @ordered + */ + protected String popServer = POP_SERVER_DEFAULT_; + + /** + * The default value of the '{@link #getPopUsername() Pop Username}' attribute. + * + * + * @see #getPopUsername() + * @generated + * @ordered + */ + protected static final String POP_USERNAME_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getPopUsername() Pop Username}' attribute. + * + * + * @see #getPopUsername() + * @generated + * @ordered + */ + protected String popUsername = POP_USERNAME_DEFAULT_; + + /** + * The default value of the '{@link #getPopPassword() Pop Password}' attribute. + * + * + * @see #getPopPassword() + * @generated + * @ordered + */ + protected static final String POP_PASSWORD_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getPopPassword() Pop Password}' attribute. + * + * + * @see #getPopPassword() + * @generated + * @ordered + */ + protected String popPassword = POP_PASSWORD_DEFAULT_; + + /** + * The cached value of the '{@link #getAny() Any}' attribute list. + * + * + * @see #getAny() + * @generated + * @ordered + */ + + protected Sequence any = null; + + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final String ID_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected String id = ID_DEFAULT_; + + /** + * The default value of the '{@link #getFeedType() Feed Type}' attribute. + * + * + * @see #getFeedType() + * @generated + * @ordered + */ + protected static final String FEED_TYPE_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getFeedType() Feed Type}' attribute. + * + * + * @see #getFeedType() + * @generated + * @ordered + */ + protected String feedType = FEED_TYPE_DEFAULT_; + + + /** + * + * + * @generated + */ + public SourceTypeNonSDOImpl() + { + super(); + } + + + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + /** + * + * + * @generated + */ + public void setName(String newName) + { + name = newName; + } + + /** + * + * + * @generated + */ + public String getAddress() + { + return address; + } + /** + * + * + * @generated + */ + public void setAddress(String newAddress) + { + address = newAddress; + } + + /** + * + * + * @generated + */ + public String getLastChecked() + { + return lastChecked; + } + /** + * + * + * @generated + */ + public void setLastChecked(String newLastChecked) + { + lastChecked = newLastChecked; + } + + /** + * + * + * @generated + */ + public String getFeedAddress() + { + return feedAddress; + } + /** + * + * + * @generated + */ + public void setFeedAddress(String newFeedAddress) + { + feedAddress = newFeedAddress; + } + + /** + * + * + * @generated + */ + public String getPopServer() + { + return popServer; + } + /** + * + * + * @generated + */ + public void setPopServer(String newPopServer) + { + popServer = newPopServer; + } + + /** + * + * + * @generated + */ + public String getPopUsername() + { + return popUsername; + } + /** + * + * + * @generated + */ + public void setPopUsername(String newPopUsername) + { + popUsername = newPopUsername; + } + + /** + * + * + * @generated + */ + public String getPopPassword() + { + return popPassword; + } + /** + * + * + * @generated + */ + public void setPopPassword(String newPopPassword) + { + popPassword = newPopPassword; + } + + /** + * + * + * @generated + */ + public String getId() + { + return id; + } + /** + * + * + * @generated + */ + public void setId(String newId) + { + id = newId; + } + + /** + * + * + * @generated + */ + public String getFeedType() + { + return feedType; + } + /** + * + * + * @generated + */ + public void setFeedType(String newType) + { + feedType = newType; + } + + public Sequence getAny(){ + return null; + } + +} //SourceTypeImpl diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl new file mode 100644 index 0000000000..79b025bc73 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd new file mode 100644 index 0000000000..f0ec561ad8 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl new file mode 100644 index 0000000000..987481bd14 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite new file mode 100644 index 0000000000..49f44f9da8 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts.composite b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts.composite new file mode 100644 index 0000000000..c359b275be --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/alerts.composite @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/sources.xml b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/sources.xml new file mode 100644 index 0000000000..2168c10c9c --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/resources/sources.xml @@ -0,0 +1,33 @@ + + + + + BBC News + http://news.bbc.co.uk/ + 10-Jun-2007 16:34:03 + http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml + + + Engadget + http://www.engadget.com + 10-Jun-2007 16:34:03 + http://www.engadget.com/rss.xml + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html new file mode 100644 index 0000000000..8b472fd0fa --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html @@ -0,0 +1,330 @@ + + + +Apache Tuscany Alert Aggregator Sample + + + + + + + + + + + + + + + +

Apache Tuscany Alert Aggregator Demo

+
+

Alert Sources:

+ +
Refreshing...
+

+

+

Refreshing...
+

Back to top

+
+

+

+ + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..0bc67c4c98 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..e926aed615 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,32 @@ + + + + + + org.apache.tuscany.sca + demo-alert-aggregator-webapp + 2.0-incubating-SNAPSHOT + war + + + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..a81165e1b4 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Alert Aggregator Demo + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + AlertAggregator.html + + + diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/pop.png b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/pop.png new file mode 100644 index 0000000000..1cf1df24a7 Binary files /dev/null and b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/pop.png differ diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/rss.png b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/rss.png new file mode 100644 index 0000000000..b3c949d224 Binary files /dev/null and b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/rss.png differ diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/service.smd b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/service.smd new file mode 100644 index 0000000000..bc77e39bf9 --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/service.smd @@ -0,0 +1 @@ +{"SMDVersion":".1","objectName":"AlertsService","serviceType":"JSON-RPC","serviceURL":"http://localhost:8080/sample-feed-aggregator/services/AlertsServiceJSONRPC","methods":[{"name":"getAllNewAlerts","parameters":[{"name":"param0","type":"STRING"}]}]} diff --git a/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/sources.smd b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/sources.smd new file mode 100644 index 0000000000..b5f1824363 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/style.css b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/main/webapp/style.css new file mode 100644 index 0000000000..f5bbf23379 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java new file mode 100644 index 0000000000..6e75ea0bdf --- /dev/null +++ b/sandbox/axis2-1.4/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.demos.aggregator; + +import java.io.ByteArrayInputStream; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.json.JSONObject; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.meterware.httpunit.PostMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; + + +/** + */ +public class AlertsIntegrationTest { + //private static SCADomain scaDomain; + + @BeforeClass + public static void setUp() throws Exception { + //scaDomain = SCADomain.newInstance("alerts.composite"); + } + + /** + * Runs after each test method + */ + @AfterClass + public static void tearDown() { + //scaDomain.close(); + } + +/* Use this if you want to test locally without deploying to a web container + public void testWait() throws Exception { + System.out.println("Feed aggregator server started (press enter to shutdown)"); + System.in.read(); + System.out.println("Feed aggregator server stopped"); + } +*/ + + @Test + public void testGetAllNewAlerts() throws Exception { + JSONObject jsonRequest = new JSONObject("{\"params\":[\"sometext\"],\"method\":\"getAllNewAlerts\",\"id\":2}"); + JSONObject jsonResp = callService ("http://localhost:8080/demo-alert-aggregator-webapp/AlertsServiceJSONRPC", + jsonRequest); + Assert.assertNotNull(jsonResp); + } + + @Test + public void testAddAlertSources() throws Exception { + JSONObject jsonRequest = new JSONObject("{\"params\":[{\"name\":\"news\",\"id\":\"2\",\"address\":\"www.news.com\",\"feedAddress\":\"http://news.com.com/2547-1_3-0-20.xml\",\"feedType\":\"rss\",\"lastChecked\":\"lastChecked\",\"javaClass\":\"org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl\"}],\"method\":\"addAlertSource\",\"id\":2}"); + JSONObject jsonResp = callService ("http://localhost:8080/demo-alert-aggregator-webapp/AlertsSourcesServiceJSONRPC", + jsonRequest); + Assert.assertNotNull(jsonResp); + } + + @Test + public void testGetAlertSources() throws Exception { + JSONObject jsonRequest = new JSONObject("{\"params\":[\"sometext\"],\"method\":\"getAlertSources\",\"id\":2}"); + JSONObject jsonResp = callService ("http://localhost:8080/demo-alert-aggregator-webapp/AlertsSourcesServiceJSONRPC", + jsonRequest); + Assert.assertEquals("BBC News", jsonResp.getJSONObject("result").getJSONObject("source").optJSONArray("list").getJSONObject(0).getString("name")); + } + + public JSONObject callService(String url, JSONObject jsonRequest) throws Exception { + System.out.println("Request = " + jsonRequest.toString()); + WebConversation wc = new WebConversation(); + WebRequest request = new PostMethodWebRequest( url, + new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json"); + WebResponse response = wc.getResource(request); + System.out.println("Response= " + response.getText()); + Assert.assertEquals(200, response.getResponseCode()); + return new JSONObject(response.getText()); + } +} diff --git a/sandbox/axis2-1.4/demos/bigbank-account/DISCLAIMER b/sandbox/axis2-1.4/demos/bigbank-account/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/LICENSE b/sandbox/axis2-1.4/demos/bigbank-account/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/NOTICE b/sandbox/axis2-1.4/demos/bigbank-account/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/README b/sandbox/axis2-1.4/demos/bigbank-account/README new file mode 100644 index 0000000000..5c0d850c5e --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/bigbank.png b/sandbox/axis2-1.4/demos/bigbank-account/bigbank.png new file mode 100644 index 0000000000..985cc6bd05 Binary files /dev/null and b/sandbox/axis2-1.4/demos/bigbank-account/bigbank.png differ diff --git a/sandbox/axis2-1.4/demos/bigbank-account/bigbank.svg b/sandbox/axis2-1.4/demos/bigbank-account/bigbank.svg new file mode 100644 index 0000000000..0650075d48 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/bigbank.svg @@ -0,0 +1,537 @@ + + + + + + + + + + image/svg+xml + + + + + + + + CompositeBigBank WebApp + + Component AccountJava + + + + Component AccountDataJava + binding.jsonrpc + binding.ws + binding.rmi + + + + CompositeStockQuote + + CompositeCalculator + + Component CalculatorJava + + + + Component AddJavascript + binding.rmi + + + Component SubtractRuby + + Component MultiplyPython + + Component DivideGroovy + + + + Component StockQuoteJava + + binding.ws + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/build-dojo.xml b/sandbox/axis2-1.4/demos/bigbank-account/build-dojo.xml new file mode 100644 index 0000000000..0e029c6335 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/build.xml b/sandbox/axis2-1.4/demos/bigbank-account/build.xml new file mode 100644 index 0000000000..ed68e0745d --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/build.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/pom.xml b/sandbox/axis2-1.4/demos/bigbank-account/pom.xml new file mode 100644 index 0000000000..38c7d090b3 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-bigbank-account + jar + Apache Tuscany SCA BigBank Account Demo + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-core-spi + 2.0-incubating-SNAPSHOT + + + + + org.apache.ws.security + wss4j + 1.5.4 + + + + + demo-bigbank-account + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java new file mode 100644 index 0000000000..57c1adcba0 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java new file mode 100644 index 0000000000..bf919525c4 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Service +@Remotable +public interface CheckingAccountService { + + public CheckingAccountDetails getAccountDetails(String customerID); + + public double deposit(String accountNo, double depositAmt); + + public double withdraw(String accountNo, double withdrawalAmount); + +} diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java new file mode 100644 index 0000000000..0ed4b1dd2e --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Service; + +/** + * + * */ + +@Service(CheckingAccountService.class) +public class CheckingAccountServiceImpl implements CheckingAccountService { + private Map custAcctMap = new HashMap(); + private Map checkingAccts = new HashMap(); + + 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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java new file mode 100644 index 0000000000..cc9023da60 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java new file mode 100644 index 0000000000..5bf6e6d26b --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import org.osoa.sca.annotations.Remotable; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Remotable +public interface SavingsAccountService { + + public SavingsAccountDetails getAccountDetails(String customerID); + + public double deposit(String accountNo, double depositAmt); + + public double withdraw(String accountNo, double withdrawalAmount); + +} diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java new file mode 100644 index 0000000000..1f4f02ea6d --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Service; + +/** + * + * */ + +@Service(SavingsAccountService.class) +public class SavingsAccountServiceImpl implements SavingsAccountService { + private Map custAcctMap = new HashMap(); + private Map savingsAccts = new HashMap(); + + 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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java new file mode 100644 index 0000000000..579b4ee64b --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java new file mode 100644 index 0000000000..5c64e11d10 --- /dev/null +++ b/sandbox/axis2-1.4/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 MapcheckingsAcl = new Hashtable(); + + 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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java new file mode 100644 index 0000000000..c98dcacbf3 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java new file mode 100644 index 0000000000..121ee9a3f8 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java new file mode 100644 index 0000000000..c8b73d4ed4 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java @@ -0,0 +1,77 @@ +package bigbank.account.security; + +import java.security.Principal; +import java.util.logging.ConsoleHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.PolicySet; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Policy handler to handle PolicySet related to Logging with the QName + * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy + */ +public class CheckingsDeptAuthPolicyInterceptor implements Interceptor { + private Invoker next; + + public CheckingsDeptAuthPolicyInterceptor(String context, Operation operation, PolicySet policySet) { + super(); + init(); + } + + private final void init() { + } + + public Message invoke(Message msg) { + Object msgBody = msg.getBody(); + if (msgBody instanceof Object[]) { + Object args[] = (Object[])msg.getBody(); + if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) { + BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL), + (String)args[0]); + } + } + + Message responseMsg = null; + try { + responseMsg = getNext().invoke(msg); + return responseMsg; + } catch (RuntimeException e) { + throw e; + } + } + + public Invoker getNext() { + return next; + } + + public void setNext(Invoker next) { + this.next = next; + } +} diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java new file mode 100644 index 0000000000..5fecef691e --- /dev/null +++ b/sandbox/axis2-1.4/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 { + 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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java new file mode 100644 index 0000000000..419b5def58 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import java.security.Principal; + +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.util.PolicyHandler; + +/** + * @version $Rev$ $Date$ + */ +public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler { + private PolicySet applicablePolicySet = null; + + public void afterInvoke(Object... context) { + } + + public void beforeInvoke(Object... context) { + for ( int count = 0 ; count < context.length ; ++count ) { + if ( context[count] instanceof Message ) { + Message msg = (Message)context[count]; + Object args[] = (Object[])msg.getBody(); + if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) { + BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL), + (String)args[0]); + } + } + } + } + + public void cleanUp(Object... arg0) { + } + + public PolicySet getApplicablePolicySet() { + return this.applicablePolicySet; + } + + public void setApplicablePolicySet(PolicySet policySet) { + this.applicablePolicySet = policySet; + } + + public void setUp(Object... arg0) { + + } + +} diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java new file mode 100644 index 0000000000..da1b6e1d06 --- /dev/null +++ b/sandbox/axis2-1.4/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 { + 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 getModelType() { + return CheckingsDeptAuthPolicy.class; + } + + public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException { + + } + +} diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java new file mode 100644 index 0000000000..1473436000 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java new file mode 100644 index 0000000000..fcbf8a4831 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +import org.osoa.sca.annotations.Remotable; + +/** + * + */ +@Remotable +public interface StockAccountService { + + public StockAccountDetails getAccountDetails(String customerID); + + public StockAccountDetails buy(String accountNo, String symbol, int quantity); + + public StockAccountDetails sell(String accountNo, String symbol, int quantity); + + +} diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java new file mode 100644 index 0000000000..28101a1986 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Service; + +/** + * + * */ + +@Service(StockAccountService.class) +public class StockAccountServiceImpl implements StockAccountService { + private Map custAcctMap = new HashMap(); + private Map stockAccts = new HashMap(); + + 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/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/CheckingsAccount.composite b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/CheckingsAccount.composite new file mode 100644 index 0000000000..cc76e30a75 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/CheckingsAccount.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c5532b879d --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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=;model= +bigbank.account.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbankAccount#authorization,model=bigbank.account.security.CheckingsDeptAuthPolicy diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/SavingsAccount.composite b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/SavingsAccount.composite new file mode 100644 index 0000000000..696b96d6e6 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/SavingsAccount.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/StockAccount.composite b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/StockAccount.composite new file mode 100644 index 0000000000..62c0b63003 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/StockAccount.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/definitions.xml b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/definitions.xml new file mode 100644 index 0000000000..31a8798f8b --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/definitions.xml @@ -0,0 +1,58 @@ + + + + + + + + Authorization Intent + + + + + + + + + UsernameToken + bigbank.account.security.AccountsDataPasswordCallbackHandler + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/web/AccountJSON.html b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/web/AccountJSON.html new file mode 100644 index 0000000000..1609bf4b43 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/web/AccountJSON.html @@ -0,0 +1,92 @@ + + + +Tuscany JSON-RPC BigBank Client + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tuscany JSON-RPC BigBank Client
+

This example uses the Dojo + Toolkit to create a JavaScript object accountService for + the service at http://localhost:8080/AccountJSONService using Dojo's + RPC classes and providing them with http://localhost:8080/AccountJSONService?smd + for Simple Method Description + (SMD) input.

+

It then creates a Dojo button that will envoke the getAccountReport + method of the accountService object.

+
RequestResponse

+ +
+
+
None Yet.
+
+
Dojo Debug:
+
+ + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/web/style.css b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/web/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..ac4d987a57 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-calculator/DISCLAIMER b/sandbox/axis2-1.4/demos/bigbank-calculator/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-calculator/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/bigbank-calculator/LICENSE b/sandbox/axis2-1.4/demos/bigbank-calculator/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/NOTICE b/sandbox/axis2-1.4/demos/bigbank-calculator/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-calculator/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/bigbank-calculator/README b/sandbox/axis2-1.4/demos/bigbank-calculator/README new file mode 100644 index 0000000000..e8ff28fc0f --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/build.xml b/sandbox/axis2-1.4/demos/bigbank-calculator/build.xml new file mode 100644 index 0000000000..18064373bf --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-calculator/build.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-calculator/pom.xml b/sandbox/axis2-1.4/demos/bigbank-calculator/pom.xml new file mode 100644 index 0000000000..0b3185b8dc --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-calculator/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-bigbank-calculator + Apache Tuscany SCA BigBank Calculator Demo + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-script + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-rmi + 2.0-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + diff --git a/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/AddService.java b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..4eeb30a9c2 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..c89043276e --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..ed7bee0f4e --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the Calculator service. + */ +@Service(CalculatorService.class) +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + System.err.println("Multiply"); + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/DivideService.java b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..131c5a8014 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..a917896aeb --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..e328f024ea --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java new file mode 100644 index 0000000000..b1861daafc --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/Calculator.composite b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..851813d31f --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/Calculator.composite @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js new file mode 100644 index 0000000000..1d4d221364 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy new file mode 100644 index 0000000000..c31c1e8fd6 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py new file mode 100644 index 0000000000..dd56af0ad8 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb b/sandbox/axis2-1.4/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb new file mode 100644 index 0000000000..08fa310f46 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-stockquote/DISCLAIMER b/sandbox/axis2-1.4/demos/bigbank-stockquote/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/LICENSE b/sandbox/axis2-1.4/demos/bigbank-stockquote/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-stockquote/NOTICE b/sandbox/axis2-1.4/demos/bigbank-stockquote/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/README b/sandbox/axis2-1.4/demos/bigbank-stockquote/README new file mode 100644 index 0000000000..2ea98d020c --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-stockquote/build.xml b/sandbox/axis2-1.4/demos/bigbank-stockquote/build.xml new file mode 100644 index 0000000000..145c158ac2 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/build.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/pom.xml b/sandbox/axis2-1.4/demos/bigbank-stockquote/pom.xml new file mode 100644 index 0000000000..36d601b7b8 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-bigbank-stockquote + Apache Tuscany SCA BigBank StockQuote Demo + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + + + + org.apache.ws.security + wss4j + 1.5.4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java new file mode 100644 index 0000000000..2d7821171d --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java new file mode 100644 index 0000000000..2a0801f9b8 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package stockquote; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the StockQuote service. + */ +@Service(StockQuoteService.class) +public class StockQuoteImpl implements StockQuoteService { + + public double getQuote(String symbol) { + double price = 104.0 + Math.random(); + price = ((int)(price * 100)) / 100.0; + + System.out.println("Getting stock quote for: " + symbol + ", value: "+ price); + + return price; + } + +} diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..9d128657eb --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package stockquote; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the StockQuote service. + */ +@Remotable +public interface StockQuoteService { + + public double getQuote(String symbol); +} diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java new file mode 100644 index 0000000000..04ed762602 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/StockQuote.composite b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/StockQuote.composite new file mode 100644 index 0000000000..aaad92c861 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/StockQuote.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/definitions.xml b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/definitions.xml new file mode 100644 index 0000000000..7e1f51304e --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/definitions.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + Timestamp Signature + security.properties + + + + + Timestamp Signature + sqservice + security.properties + stockquote.PasswordCallbackHandler + DirectReference + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/security.properties b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/security.properties new file mode 100644 index 0000000000..0063207e06 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/security.properties @@ -0,0 +1,4 @@ +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 \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/stockQuote.jks b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/stockQuote.jks new file mode 100644 index 0000000000..d53d32c4ef Binary files /dev/null and b/sandbox/axis2-1.4/demos/bigbank-stockquote/src/main/resources/stockQuote.jks differ diff --git a/sandbox/axis2-1.4/demos/bigbank/DISCLAIMER b/sandbox/axis2-1.4/demos/bigbank/DISCLAIMER new file mode 100644 index 0000000000..8e5c524323 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/bigbank/LICENSE b/sandbox/axis2-1.4/demos/bigbank/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank/NOTICE b/sandbox/axis2-1.4/demos/bigbank/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/bigbank/README b/sandbox/axis2-1.4/demos/bigbank/README new file mode 100644 index 0000000000..5ec796db60 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank/bigbank.png b/sandbox/axis2-1.4/demos/bigbank/bigbank.png new file mode 100644 index 0000000000..985cc6bd05 Binary files /dev/null and b/sandbox/axis2-1.4/demos/bigbank/bigbank.png differ diff --git a/sandbox/axis2-1.4/demos/bigbank/bigbank.svg b/sandbox/axis2-1.4/demos/bigbank/bigbank.svg new file mode 100644 index 0000000000..30aa0eab6d --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/bigbank.svg @@ -0,0 +1,537 @@ + + + + + + + + + + image/svg+xml + + + + + + + + CompositeBigBank WebApp + + Component AccountJava + + + + Component AccountDataJava + binding.jsonrpc + binding.ws + binding.rmi + + + + CompositeStockQuote + + CompositeCalculator + + Component CalculatorJava + + + + Component AddJavascript + binding.rmi + + + Component SubtractRuby + + Component MultiplyPython + + Component DivideGroovy + + + + Component StockQuoteJava + + binding.ws + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank/build-dojo.xml b/sandbox/axis2-1.4/demos/bigbank/build-dojo.xml new file mode 100644 index 0000000000..9d282c2dd2 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank/build.xml b/sandbox/axis2-1.4/demos/bigbank/build.xml new file mode 100644 index 0000000000..046aadd228 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/build.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank/pom.xml b/sandbox/axis2-1.4/demos/bigbank/pom.xml new file mode 100644 index 0000000000..9950ed5b42 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/pom.xml @@ -0,0 +1,201 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-bigbank + jar + Apache Tuscany SCA BigBank Demo + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-incubating-SNAPSHOT + + + + org.apache.ws.security + wss4j + 1.5.4 + + + + org.apache.tuscany.sca + demo-bigbank-account + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-rss-rome + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-rmi + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + demo-bigbank + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountService.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountService.java new file mode 100644 index 0000000000..2cb8027874 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import org.osoa.sca.annotations.Remotable; + +/** + * @version $$Rev$$ $$Date$$ + */ + +@Remotable +public interface AccountService { + + public double getAccountReport(String customerID); + +} diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java new file mode 100644 index 0000000000..4f0e3879dc --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import stockquote.StockQuoteService; +import bigbank.account.checking.CheckingAccountDetails; +import bigbank.account.checking.CheckingAccountService; +import bigbank.account.savings.SavingsAccountDetails; +import bigbank.account.savings.SavingsAccountService; +import bigbank.account.stock.StockAccountDetails; +import bigbank.account.stock.StockAccountService; +import calculator.CalculatorService; + +/** + * @version $$Rev$$ $$Date$$ + */ + +@Service(AccountService.class) +public class AccountServiceImpl implements AccountService { + + @Reference + protected SavingsAccountService savingsAcService; + + @Reference + protected CheckingAccountService checkingAcService; + + @Reference + protected StockAccountService stockAcService; + + @Reference + protected StockQuoteService stockQuoteService; + + @Reference + protected CalculatorService calculatorService; + + @Property + protected String currency; + + public double getAccountReport(String customerID) { + + // Get the checking, savings and stock accounts from the AccountData + // service component + CheckingAccountDetails checking = null; + try { + checking = checkingAcService.getAccountDetails(customerID); + System.out.println("Checking account: " + checking); + + SavingsAccountDetails savings = savingsAcService.getAccountDetails(customerID); + System.out.println("Savings account: " + savings); + + StockAccountDetails stock = stockAcService.getAccountDetails(customerID); + System.out.println("Stock account: " + stock); + + // Get the stock price in USD + double price = stockQuoteService.getQuote(stock.getSymbol()); + System.out.println("Stock price for " + stock.getSymbol() + ": " + price); + + // Convert to the configured currency + if (currency.equals("EURO")) { + + // Use our fancy calculator service to convert to the target currency + price = calculatorService.multiply(price, 0.70); + + System.out.println("Converted to " + currency + ": " + price); + } + + // Calculate the value of the stock account + double stockValue = price * stock.getQuantity(); + + // Calculate the total balance of all accounts and return it + double balance = checking.getBalance() + savings.getBalance() + stockValue; + + return balance; + } catch ( Throwable e ) { + e.printStackTrace(); + return 0; + } + } +} diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java new file mode 100644 index 0000000000..13d79a9c33 --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import bigbank.account.AccountService; + +/** + * @version $$Rev$$ $$Date$$ + */ + +@Service(Collection.class) +public class AccountFeedImpl implements Collection { + + @Reference + protected AccountService accountService; + + public Entry[] getAll() { + + // Add the Account report entry + String report = get("1234"); + Entry entry = new Entry("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[] query(String queryString) { + return null; + } +} diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java new file mode 100644 index 0000000000..a7fa5ecc22 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java new file mode 100644 index 0000000000..05360e07a5 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java new file mode 100644 index 0000000000..6d3b547939 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank/src/main/java/calculator/CalculatorService.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..c89043276e --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank/src/main/java/stockquote/StockQuoteService.java b/sandbox/axis2-1.4/demos/bigbank/src/main/java/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..749b8ee2f4 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/java/stockquote/StockQuoteService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package stockquote; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the StockQuote service. + */ +@Remotable +public interface StockQuoteService { + public double getQuote(String symbol); +} diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/resources/BigBank.composite b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/BigBank.composite new file mode 100644 index 0000000000..e57541b423 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/BigBank.composite @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EURO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..154992c843 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/resources/bigbank.jks b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/bigbank.jks new file mode 100644 index 0000000000..e6294d85f7 Binary files /dev/null and b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/bigbank.jks differ diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/resources/definitions.xml b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/definitions.xml new file mode 100644 index 0000000000..8654151d82 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/definitions.xml @@ -0,0 +1,64 @@ + + + + + + + + + + Timestamp Signature + security.properties + + + + + Timestamp Signature + bbservice + security.properties + bigbank.security.BigbankPasswordCallbackHandler + DirectReference + + + + + + + + + + UsernameToken + bbaservice + bigbank.security.BigbankPasswordCallbackHandler + PasswordText + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/resources/security.properties b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/security.properties new file mode 100644 index 0000000000..762d0523d9 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/security.properties @@ -0,0 +1,4 @@ +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 \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/resources/web/AccountJSON.html b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/web/AccountJSON.html new file mode 100644 index 0000000000..9f4368443f --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/web/AccountJSON.html @@ -0,0 +1,92 @@ + + + +Tuscany JSON-RPC BigBank Client + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tuscany JSON-RPC BigBank Client
+

This example uses the Dojo + Toolkit to create a JavaScript object accountService for + the service at http://localhost:8080/AccountJSONService using Dojo's + RPC classes and providing them with http://localhost:8080/AccountJSONService?smd + for Simple Method Description + (SMD) input.

+

It then creates a Dojo button that will envoke the getAccountReport + method of the accountService object.

+
RequestResponse

+ +
+
+
None Yet.
+
+
Dojo Debug:
+
+ + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank/src/main/resources/web/style.css b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/web/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..ac4d987a57 --- /dev/null +++ b/sandbox/axis2-1.4/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/bigbank/src/test/java/test/BigBankTestCase.java b/sandbox/axis2-1.4/demos/bigbank/src/test/java/test/BigBankTestCase.java new file mode 100644 index 0000000000..3b7c5ef2ad --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/DISCLAIMER b/sandbox/axis2-1.4/demos/load-balancing-webapp/DISCLAIMER new file mode 100644 index 0000000000..8e5c524323 --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/LICENSE b/sandbox/axis2-1.4/demos/load-balancing-webapp/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/NOTICE b/sandbox/axis2-1.4/demos/load-balancing-webapp/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/README b/sandbox/axis2-1.4/demos/load-balancing-webapp/README new file mode 100644 index 0000000000..b7bbb64b1a --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/build-tomcat.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/build-tomcat.xml new file mode 100644 index 0000000000..7e1dc4b0e9 --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/build-tomcat.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/build.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/build.xml new file mode 100644 index 0000000000..813423743f --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/build.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/pom.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/pom.xml new file mode 100644 index 0000000000..60b1bab76b --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/pom.xml @@ -0,0 +1,349 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-load-balancing-webapp + war + Apache Tuscany SCA WebApp Load Balancing Demo + A sample SCA application that is deployed as a webapp to a cluster of tomcat servers + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-monitor-logging + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node2-impl + 2.0-incubating-SNAPSHOT + + + + tomcat + catalina-balancer + 5.5.12 + + + + javax.servlet + servlet-api + 2.4 + provided + + + + junit + junit + 4.2 + test + + + + + + 8085 + http://127.0.0.1:${http.port} + ${env.CATALINA_HOME} + + + + ${artifactId} + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.1 + + + + ant + ant-trax + 1.6.5 + + + + + + download-tomcat + validate + + run + + + + + + + + + + + + unpack-tomcat-8086 + generate-resources + + run + + + + + + + + + + + unpack-tomcat-8087 + generate-resources + + run + + + + + + + + + + + + configure-tomcat-8086 + pre-integration-test + + run + + + + + + + + + + + configure-tomcat-8087 + pre-integration-test + + run + + + + + + + + + + + + copy-webapp-8086 + pre-integration-test + + run + + + + + + + + + + + copy-webapp-8087 + pre-integration-test + + run + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/client/LaunchClient.java b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/client/LaunchClient.java new file mode 100644 index 0000000000..efa89b4fe9 --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/domain/LaunchDomain.java b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/domain/LaunchDomain.java new file mode 100644 index 0000000000..33c37869a3 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldImpl.java b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..65dc030d89 --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldService.java b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..7245513b2a --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldServiceClient.java b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/helloworld/HelloWorldServiceClient.java new file mode 100644 index 0000000000..f3d2fdb2ed --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/java/org/apache/tuscany/sca/demos/loadbalancer/rule/RoundRobinRule.java b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/resources/client-contribution/helloworldwsclient.composite b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/resources/client-contribution/helloworldwsclient.composite new file mode 100644 index 0000000000..9b6052741e --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/resources/client-contribution/helloworldwsclient.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..11347004f9 --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite new file mode 100644 index 0000000000..1ab78d802d --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/WEB-INF/web.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..8d47ae2207 --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,37 @@ + + + + + + + Apache Tuscany Load Balancing Demo + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/apache-80/conf/httpd.conf b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/apache-80/conf/httpd.conf new file mode 100644 index 0000000000..37cf284d35 --- /dev/null +++ b/sandbox/axis2-1.4/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 (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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/apache-80/conf/workers.properties b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/apache-80/conf/workers.properties new file mode 100644 index 0000000000..9228c4fd8e --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml new file mode 100644 index 0000000000..920fa7b037 --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8085/conf/server.xml @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8085/webapps/balancer/WEB-INF/config/rules.xml b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8085/webapps/balancer/WEB-INF/config/rules.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml new file mode 100644 index 0000000000..5ecb8fe5c4 --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8086/conf/server.xml @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml new file mode 100644 index 0000000000..f83c68191c --- /dev/null +++ b/sandbox/axis2-1.4/demos/load-balancing-webapp/src/test/resources/tomcat-8087/conf/server.xml @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/DISCLAIMER b/sandbox/axis2-1.4/demos/mortgage-creditcheck/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/LICENSE b/sandbox/axis2-1.4/demos/mortgage-creditcheck/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-creditcheck/NOTICE b/sandbox/axis2-1.4/demos/mortgage-creditcheck/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/README b/sandbox/axis2-1.4/demos/mortgage-creditcheck/README new file mode 100644 index 0000000000..b785802920 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-creditcheck/build.xml b/sandbox/axis2-1.4/demos/mortgage-creditcheck/build.xml new file mode 100644 index 0000000000..59f1342276 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/build.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/pom.xml b/sandbox/axis2-1.4/demos/mortgage-creditcheck/pom.xml new file mode 100644 index 0000000000..deb953625f --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/pom.xml @@ -0,0 +1,75 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-mortgage-creditcheck + jar + Apache Tuscany SCA Mortgage Credit Check Demo + A sample Mortgage application made of several SCA components wired together. + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java new file mode 100644 index 0000000000..ec95a60227 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package credit; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CreditCheck { + int getCreditScore(String ssn); +} diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java new file mode 100644 index 0000000000..f19e8a1250 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package credit; + +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the CreditReportService service + */ +@Service(CreditCheck.class) +public class CreditCheckImpl implements CreditCheck { + + public int getCreditScore(String ssn) { + int score = (int)(700 + (Math.random() - 0.5) * 100); + System.out.println("Credit score for " + ssn + ": " + score); + return score; + } +} diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java new file mode 100644 index 0000000000..870ea1941d --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite new file mode 100644 index 0000000000..5c828f5a39 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl new file mode 100644 index 0000000000..9c2acc96d3 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..aea009292a --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..d7b2e32dd1 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,37 @@ + + + + + + + Apache Tuscany Credit Check Demo + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/DISCLAIMER b/sandbox/axis2-1.4/demos/mortgage-loanapproval/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/LICENSE b/sandbox/axis2-1.4/demos/mortgage-loanapproval/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/NOTICE b/sandbox/axis2-1.4/demos/mortgage-loanapproval/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/README b/sandbox/axis2-1.4/demos/mortgage-loanapproval/README new file mode 100644 index 0000000000..dbf3829a20 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/build.xml b/sandbox/axis2-1.4/demos/mortgage-loanapproval/build.xml new file mode 100644 index 0000000000..9a0a83bf1d --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/build.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.jpg new file mode 100644 index 0000000000..e28ed63cfb Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.png new file mode 100644 index 0000000000..0bfce0078d Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/credit_composite.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.jpg new file mode 100644 index 0000000000..3f00557c7f Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.png new file mode 100644 index 0000000000..9d5f829fe5 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/loan_approval.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg new file mode 100644 index 0000000000..515b6ecde7 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.png new file mode 100644 index 0000000000..4b815a4b82 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly0.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg new file mode 100644 index 0000000000..01a7c55a14 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.png new file mode 100644 index 0000000000..07422c4f45 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly1.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg new file mode 100644 index 0000000000..992c048684 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.png new file mode 100644 index 0000000000..4667956ed0 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_assembly2.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.jpg new file mode 100644 index 0000000000..5021f6a317 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.png new file mode 100644 index 0000000000..1398c50ded Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_composite.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc new file mode 100644 index 0000000000..00d45e1084 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.jpg new file mode 100644 index 0000000000..e91c5f1bbd Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.png new file mode 100644 index 0000000000..db304a4c28 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package1.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.jpg new file mode 100644 index 0000000000..e8c2865e4a Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.png new file mode 100644 index 0000000000..502e538e94 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_package2.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg new file mode 100644 index 0000000000..fccf2e35c3 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.png new file mode 100644 index 0000000000..b8f42ad318 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/doc/mortgage_scenario.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/mortgage_assembly.png b/sandbox/axis2-1.4/demos/mortgage-loanapproval/mortgage_assembly.png new file mode 100644 index 0000000000..4667956ed0 Binary files /dev/null and b/sandbox/axis2-1.4/demos/mortgage-loanapproval/mortgage_assembly.png differ diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/pom.xml b/sandbox/axis2-1.4/demos/mortgage-loanapproval/pom.xml new file mode 100644 index 0000000000..91a6a8c8c2 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-mortgage-loanapproval + jar + Apache Tuscany SCA Mortgage Loan Approval Demo + A sample Mortgage application made of several SCA components wired together. + + + 2.0-incubating-SNAPSHOT + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-implementation-script + 2.0-incubating-SNAPSHOT + runtime + + + + + + install + ${artifactId} + + + org.apache.maven.plugins + maven-jar-plugin + + + + mortgage.MortgageClient + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java new file mode 100644 index 0000000000..c5787b7819 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package mortgage; + +import org.osoa.sca.annotations.Remotable; + +/** + * CreditCheck interface + */ +@Remotable +public interface CreditCheck { + int getCreditScore(String ssn); +} diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java new file mode 100644 index 0000000000..dc803d9688 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package mortgage; + +import org.osoa.sca.annotations.Service; + +/** + * A pojo implementation of the CreditCheck service + */ +@Service(CreditCheck.class) +public class CreditCheckImpl implements CreditCheck { + + public int getCreditScore(String ssn) { + int score = (int)(700 + (Math.random() - 0.5) * 100); + System.out.println("Credit score for " + ssn + ": " + score); + return score; + } +} diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java new file mode 100644 index 0000000000..66a486d516 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java new file mode 100644 index 0000000000..b5bafeb204 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java new file mode 100644 index 0000000000..8c642667f1 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package mortgage; + +import org.osoa.sca.annotations.Service; + +@Service(InterestRateQuote.class) +public class InterestRateQuoteImpl implements InterestRateQuote { + public float getRate(String state, double loanAmount, int termInYears) { + float rate = 6.0f; + if (termInYears == 5) { + rate = 5.5f; + } else { + rate = 6.5f; + } + System.out.println("Interest rate for a " + termInYears + + "-year loan of $" + + loanAmount + + " in " + + state + + ": " + + rate + + "%"); + return rate; + } +} diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java new file mode 100644 index 0000000000..dcdad18496 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java new file mode 100644 index 0000000000..40bfdc4a1d --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package mortgage; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the LoanApproval service. + */ +@Service(LoanApproval.class) +// Service declaration +public class LoanApprovalImpl implements LoanApproval { + private CreditCheck[] creditCheck; + private MortgageCalculator mortgageCalculator; + private InterestRateQuote interestRateQuote; + + // Reference declaration using a protected or public field + @Reference + public RiskAssessment riskAssessment; + + private int minimumCreditScore = 650; + + // Property declaration using a setter method + @Property(name = "minimumCreditScore") + public void setMinimumCreditScore(int minimumCreditScore) { + this.minimumCreditScore = minimumCreditScore; + } + + // Reference declaration using a setter method + @Reference + public void setCreditCheck(CreditCheck[] creditCheck) { + this.creditCheck = creditCheck; + } + + @Reference + public void setInterestRateQuote(InterestRateQuote interestRateQuote) { + this.interestRateQuote = interestRateQuote; + } + + @Reference + public void setMortgageCalculator(MortgageCalculator mortgageCalculator) { + this.mortgageCalculator = mortgageCalculator; + } + + public boolean approve(Customer customer, double loanAmount, int years) { + int score = 0; + for (int i = 0; i < creditCheck.length; i++) { + score += creditCheck[i].getCreditScore(customer.getSsn()); + } + if (score != 0) { + score = score / creditCheck.length; + } + if (score < minimumCreditScore) { + System.err.println("Credit score " + score + " is below the minimum " + minimumCreditScore + "."); + return false; + } + float rate = interestRateQuote.getRate(customer.getState(), loanAmount, years); + double monthlyPayment = mortgageCalculator.getMonthlyPayment(loanAmount, years, rate); + double ratio = monthlyPayment / customer.getMonthlyIncome(); + boolean approved = riskAssessment.assess(score, ratio); + if (!approved) { + System.err.println("Debt/Income ratio " + ratio + " is too high."); + } + return approved; + } +} diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java new file mode 100644 index 0000000000..cacd8694de --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package mortgage; + +import org.osoa.sca.annotations.Remotable; + +/** + * The Mortgage Calculator service interface. + */ +@Remotable +public interface MortgageCalculator { + public double getMonthlyPayment(double principal, int years, float interestRate); +} diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java new file mode 100644 index 0000000000..015f1bae98 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package mortgage; + +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the Calculator service. + */ +@Service(MortgageCalculator.class) +public class MortgageCalculatorImpl implements MortgageCalculator { + + public double getMonthlyPayment(double principal, int years, float interestRate) { + double monthlyRate = interestRate / 12.0 / 100.0; + double p = Math.pow(1 + monthlyRate, years * 12); + double q = p / (p - 1); + double monthlyPayment = principal * monthlyRate * q; + System.out.println("Monthly payment for a " + years + "-year loan of $" + principal + ": " + monthlyPayment); + return monthlyPayment; + } + +} diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java new file mode 100644 index 0000000000..d69f0a1163 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java new file mode 100644 index 0000000000..23c9589e85 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java new file mode 100644 index 0000000000..c2116366ec --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package mortgage; + +import org.osoa.sca.annotations.Service; + +/** + * A pojo implementation of RiskAssessment service + */ +@Service(RiskAssessment.class) +public class RiskAssessmentImpl implements RiskAssessment { + public boolean assess(int creditScore, double ratio) { + if (creditScore >= 750) { + return ratio < 0.35; + } else if (creditScore >= 700) { + return ratio < 0.30; + } else { + return ratio < 0.25; + } + } +} diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite new file mode 100644 index 0000000000..d1128b9907 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite @@ -0,0 +1,48 @@ + + + + + + + 600 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite new file mode 100644 index 0000000000..4cad6c7223 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite @@ -0,0 +1,57 @@ + + + + + + + 600 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType new file mode 100644 index 0000000000..bf7b10e0f7 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js new file mode 100644 index 0000000000..b25af1d039 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl new file mode 100644 index 0000000000..9c2acc96d3 --- /dev/null +++ b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java b/sandbox/axis2-1.4/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java new file mode 100644 index 0000000000..285cc72515 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/pom.xml b/sandbox/axis2-1.4/demos/pom.xml new file mode 100644 index 0000000000..8cac6686bc --- /dev/null +++ b/sandbox/axis2-1.4/demos/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-incubating-SNAPSHOT + ../pom.xml + + tuscany-demos + pom + Apache Tuscany SCA Demos + + + + default + + true + + + alert-aggregator-webapp + bigbank + bigbank-account + bigbank-calculator + bigbank-stockquote + mortgage-creditcheck + mortgage-loanapproval + xml-bigbank + + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/DISCLAIMER b/sandbox/axis2-1.4/demos/workpool-distributed/DISCLAIMER new file mode 100644 index 0000000000..8e5c524323 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/LICENSE b/sandbox/axis2-1.4/demos/workpool-distributed/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/NOTICE b/sandbox/axis2-1.4/demos/workpool-distributed/NOTICE new file mode 100644 index 0000000000..94481d6cfa --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2007 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/build.xml b/sandbox/axis2-1.4/demos/workpool-distributed/build.xml new file mode 100644 index 0000000000..9e10e8ec91 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/build.xml @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/pom.xml b/sandbox/axis2-1.4/demos/workpool-distributed/pom.xml new file mode 100644 index 0000000000..ea74e4e45a --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/pom.xml @@ -0,0 +1,148 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-incubating-SNAPSHOT + ../../pom.xml + + demo-workpool-distributed + Apache Tuscany SCA Distributed Job Workpool Demo + + + + apache.incubator + + http://people.apache.org/repo/m2-incubating-repository + + + + org.drools + http://repository.jboss.com/maven2/org/drools/ + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + + + + org.drools + drools + 4.0.4 + + + + antlr + antlr + 2.7.1 + + + commons-daemon + commons-daemon + 1.0.1 + + + + antlr + stringtemplate + 2.3b6 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-domain-impl + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-sca-axis2 + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-databinding-job + 2.0-incubating-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-contribution-updater + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-databinding-xstream + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-incubating-SNAPSHOT + test + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/DomainNode.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/DomainNode.java new file mode 100644 index 0000000000..a278499aae --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/DomainNodeDaemon.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/DomainNodeDaemon.java new file mode 100644 index 0000000000..9d05761ad6 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/TestJob.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/TestJob.java new file mode 100644 index 0000000000..f48e647bd6 --- /dev/null +++ b/sandbox/axis2-1.4/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 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/WorkpoolDaemon.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/WorkpoolDaemon.java new file mode 100644 index 0000000000..1f2a4d1f9a --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/WorkpoolNode.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/WorkpoolNode.java new file mode 100644 index 0000000000..86557548af --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/workerRules1.drl b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/node/workerRules1.drl new file mode 100644 index 0000000000..9c5a5d1b7f --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/MetaComponentWorker.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/MetaComponentWorker.java new file mode 100644 index 0000000000..cdd0f30b34 --- /dev/null +++ b/sandbox/axis2-1.4/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("\n"); + buffer.append(""); + buffer.append(""); + buffer.append(this.componentName); + buffer.append("\n"); + 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/MyWorker.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/MyWorker.java new file mode 100644 index 0000000000..c45696e3cf --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class MyWorker extends WorkerServiceImpl { + private static int resultcount = 0; + + @Override + public ResultJob computeTask(Job 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/NullJob.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/NullJob.java new file mode 100644 index 0000000000..fb930adf2e --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/ResultJob.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/ResultJob.java new file mode 100644 index 0000000000..e04411668b --- /dev/null +++ b/sandbox/axis2-1.4/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 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/Trigger.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/Trigger.java new file mode 100644 index 0000000000..469675b19b --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.Remotable; + +@Remotable +@DataBinding("org.apache.tuscany.sca.databinding.job.Job") +public interface Trigger { + void handleEvent(T c); +} diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerManager.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerManager.java new file mode 100644 index 0000000000..520203e190 --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.Remotable; +import org.osoa.sca.CallableReference; +@Remotable +public interface WorkerManager { + CallableReference addWorker(); + boolean removeWorker(String workerName); + boolean removeWorkers(int k); + boolean removeAllWorkers(); + double getNodeLoad(); + int activeWorkers(); + void start(); +} diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerManagerImpl.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerManagerImpl.java new file mode 100644 index 0000000000..d4337cad2f --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.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.osoa.sca.ComponentContext; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.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> activeWorkers = new LinkedList>(); + private List workerComponentNames = new ArrayList(); + 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 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 addWorker() { + log.info("Adding a new worker call.."); + long addWorkerStartTime = System.nanoTime(); + ContributionServiceImpl cServiceImpl = (ContributionServiceImpl) node.getContributionService(); + Contribution contribution = cServiceImpl.getContribution(nodeName); + List artifacts = contribution.getDeployables(); + CallableReference workerReference = null; + CallableReference 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) workerComponent + .getComponentContext().createSelfReference( + WorkerService.class); + ref.getService().start(); + activeWorkers.addLast(ref); + workerComponentNames.add(mcw.getName()); + CallableReference 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 callable : activeWorkers) { + callable.getService().stop(); + } + return true; + } + + public boolean removeWorker() { + CallableReference 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerService.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerService.java new file mode 100644 index 0000000000..37b7ea227a --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.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 { + @OneWay + void compute(Job j); + + void start(); + + void stop(); + + // void addJobCompleteHandler(String triggerName, + // CallableReferenceImpl handle); + // void removeJobCompleteHandler(String triggerName); + /* The worker manager */ + void registerManager(CallableReferenceImpl wm); + + void registerSender(CallableReferenceImpl sender); + + // void init(Job nullJob); + @OneWay + void computeFirstTime(Job nullJob, + CallableReferenceImpl myReference); + +} diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerServiceCallback.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerServiceCallback.java new file mode 100644 index 0000000000..6fb1278e5e --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.Remotable; + +@Remotable +public interface WorkerServiceCallback { + void receiveResult(Job resultType, boolean reuse, String workerName); +} diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerServiceImpl.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkerServiceImpl.java new file mode 100644 index 0000000000..2c9bf5ea48 --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.ComponentContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.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 implements WorkerService { + 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 managerReference = null; + + /* TODO add the triggers, but before ask */ + // protected Map triggers = new HashMap(); + public abstract ResultJob computeTask(Job job); + + private boolean stopped = false; + private CallableReferenceImpl serviceRef; + private CallableReferenceImpl 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 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 sender) { + senderService = sender; + wp = sender.getService(); + workWithCallable(nullJob); + } + + public void registerManager(CallableReferenceImpl wm) { + managerReference = wm; + manager = managerReference.getService(); + + } + + public void registerSender(CallableReferenceImpl 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 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 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolBean.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolBean.java new file mode 100644 index 0000000000..80c093ff1c --- /dev/null +++ b/sandbox/axis2-1.4/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 listeners = new Vector(); + 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolBeanListener.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolBeanListener.java new file mode 100644 index 0000000000..0ecc223fed --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolEvent.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolEvent.java new file mode 100644 index 0000000000..0bdc3671d5 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolManager.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolManager.java new file mode 100644 index 0000000000..6520954bdd --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.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 serviceReference); +} diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java new file mode 100644 index 0000000000..f7c727ad04 --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.ComponentContext; +import org.osoa.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.osoa.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.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; +import 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 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 myReference; + private String rules = null; + private boolean referenceInjection = false; + private ConcurrentHashMap workerManagerTable = new ConcurrentHashMap(); + 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> vector) { + log.info("Starting new components"); + WorkpoolService wp = reference.getService(); + // CallableReferenceImpl sink = + // (CallableReferenceImpl) reference; + Job j = new NullJob(); + for (CallableReferenceImpl 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) 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> workerRefs = new Vector>(); + 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 v = new Vector(workerManagerTable.keySet()); + Collections.sort(v); + // Iterator iter = + // workerManagerTable.values().iterator(); + // Display (sorted) hashtable. + for (Enumeration 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> workerRefs) { + CallableReferenceImpl workerReference = (CallableReferenceImpl) 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: 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 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> workerRefs = new Vector>(); + + // 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> workerRefs = new Vector>(); + + 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/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java new file mode 100644 index 0000000000..d84ae549d8 --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.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 worker, boolean newJob); + + void addTrigger(CallableReferenceImpl reference); + + void removeTrigger(); + + void registerManager( + CallableReferenceImpl 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 worker); + +} diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java new file mode 100644 index 0000000000..52b88af42c --- /dev/null +++ b/sandbox/axis2-1.4/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.osoa.sca.ComponentContext; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.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 queue = new LinkedBlockingQueue(5000); + private CallableReferenceImpl 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 triggers = new + // LinkedBlockingQueue(); + @Context + protected ComponentContext workpoolContext; + private CallableReferenceImpl 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 cacheReference = new ConcurrentHashMap(); + private CallableReferenceImpl 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 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 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 createSelfReference) { + manager = createSelfReference; + + } + + public void stop() { + // TODO Auto-generated method stub + + } + + public void addTrigger(CallableReferenceImpl reference) { + this.trigger = reference; + this.forwardResult = reference.getService(); + + } + + public void removeTrigger() { + this.trigger = null; + this.forwardResult = null; + } +} diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b3e2d16c05 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite new file mode 100644 index 0000000000..9a00a8e839 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite @@ -0,0 +1,47 @@ + + + + + + + + + + 4 + 4 + 0 + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b3e2d16c05 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite new file mode 100644 index 0000000000..a71dc9e08a --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite @@ -0,0 +1,38 @@ + + + + + + nodeB + Workpool.composite + workpool.MyWorker + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b3e2d16c05 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite new file mode 100644 index 0000000000..771db5370b --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite @@ -0,0 +1,38 @@ + + + + + + nodeC + Workpool.composite + workpool.MyWorker + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b3e2d16c05 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite new file mode 100644 index 0000000000..55fd48934f --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite @@ -0,0 +1,38 @@ + + + + + + nodeD + Workpool.composite + workpool.MyWorker + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b3e2d16c05 --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite new file mode 100644 index 0000000000..1dc9ccfcea --- /dev/null +++ b/sandbox/axis2-1.4/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite @@ -0,0 +1,38 @@ + + + + + + nodeE + Workpool.composite + workpool.MyWorker + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/workpool-distributed/src/test/java/workpool/AComponent.java b/sandbox/axis2-1.4/demos/workpool-distributed/src/test/java/workpool/AComponent.java new file mode 100644 index 0000000000..5c20537fab --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/workerRules.drl b/sandbox/axis2-1.4/demos/workpool-distributed/workerRules.drl new file mode 100644 index 0000000000..e7ebcad4c0 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/workerRules1.drl b/sandbox/axis2-1.4/demos/workpool-distributed/workerRules1.drl new file mode 100644 index 0000000000..6fa0b85ba2 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/workerRules2.drl b/sandbox/axis2-1.4/demos/workpool-distributed/workerRules2.drl new file mode 100644 index 0000000000..9d9551c3ea --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/workpool-distributed/workerRules3.drl b/sandbox/axis2-1.4/demos/workpool-distributed/workerRules3.drl new file mode 100644 index 0000000000..a67af910a4 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/DISCLAIMER b/sandbox/axis2-1.4/demos/xml-bigbank/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/LICENSE b/sandbox/axis2-1.4/demos/xml-bigbank/LICENSE new file mode 100644 index 0000000000..6e529a25c4 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/NOTICE b/sandbox/axis2-1.4/demos/xml-bigbank/NOTICE new file mode 100644 index 0000000000..1325efd8bf --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/README b/sandbox/axis2-1.4/demos/xml-bigbank/README new file mode 100644 index 0000000000..3bdeeca60a --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/build.xml b/sandbox/axis2-1.4/demos/xml-bigbank/build.xml new file mode 100644 index 0000000000..0ba1b069aa --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/build.xml @@ -0,0 +1,63 @@ + + +]> + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/pom.xml b/sandbox/axis2-1.4/demos/xml-bigbank/pom.xml new file mode 100644 index 0000000000..c86f6d9624 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/pom.xml @@ -0,0 +1,115 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 2.0-incubating-SNAPSHOT + ../pom.xml + + demo-xml-bigbank + jar + Apache Tuscany SCA XML BigBank Demo + Apache Tuscany SCA XML BigBank Demo + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-binding-rss-rome + 2.0-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-databinding-saxon + 2.0-incubating-SNAPSHOT + runtime + + + + + org.apache.tuscany.sca + tuscany-implementation-xquery + 2.0-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-incubating-SNAPSHOT + + + + bigbank.BigBankClient + true + + + generate + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountData.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountData.java new file mode 100644 index 0000000000..c3ae8d0912 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java new file mode 100644 index 0000000000..1c0c612987 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank; + +import java.io.IOException; +import java.net.URL; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(AccountData.class) +public class AccountDataImpl implements AccountData { + private XMLInputFactory factory = XMLInputFactory.newInstance(); + + public XMLStreamReader getAccounts() throws IOException { + URL doc = getClass().getResource("/accounts.xml"); + XMLStreamReader reader = null; + try { + reader = factory.createXMLStreamReader(doc.openStream()); + } catch (Exception e) { + e.printStackTrace(); + } + return reader; + } + +} diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountService.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountService.java new file mode 100644 index 0000000000..4c72384e7b --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java new file mode 100644 index 0000000000..2ce1e86062 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank; + +import java.io.StringReader; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(AccountService.class) +public class AccountServiceImpl implements AccountService { + private static final String STOCK_QUOTE_REQUEST = + "IBM GOOG MSFT"; + + 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/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java new file mode 100644 index 0000000000..a7703787fb --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java new file mode 100644 index 0000000000..f5f1ca90b6 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java new file mode 100644 index 0000000000..bb8ff85f45 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank; + +import org.osoa.sca.annotations.Remotable; + +import com.sun.syndication.feed.synd.SyndFeed; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface CurrencyExchange { + /** + * Get the currency exchange rates as a RSS feed + * @return + */ + SyndFeed getRates(); +} diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java new file mode 100644 index 0000000000..358e5e19a2 --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java new file mode 100644 index 0000000000..fcb3707cfe --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank; + +import java.io.ByteArrayInputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathFactory; + +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.sun.syndication.feed.synd.SyndEntry; +import com.sun.syndication.feed.synd.SyndFeed; + +/** + * @version $Rev$ $Date$ + */ +@Service(ExchangeRate.class) +public class ExchangeRateImpl { + @Reference + protected CurrencyExchange exchangeRate; + + private final DocumentBuilder builder; + + public ExchangeRateImpl() { + try { + builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + } catch (ParserConfigurationException e) { + throw new IllegalArgumentException(e); + } + } + + /** + * Retrieve the live currency exchange rate from a live feed and extract the data for a given + * currecy using XPath + * @param currency The currency + * @return The exchange rate + */ + public double getExchangeRate(String currency) { + try { + System.out.println("Retrieving exchange rate..."); + SyndFeed feed = exchangeRate.getRates(); + SyndEntry entry = (SyndEntry)feed.getEntries().get(0); + String rateTable = entry.getDescription().getValue(); + + Document doc = builder.parse(new ByteArrayInputStream(rateTable.getBytes())); + Node node = doc.getDocumentElement(); + XPath path = XPathFactory.newInstance().newXPath(); + XPathExpression exp = path.compile("/TABLE/TR[TD[1]='" + currency.toUpperCase() + "']/TD[2]"); + Node rateNode = (Node)exp.evaluate(node, XPathConstants.NODE); + double rate = Double.valueOf(rateNode.getTextContent().trim()); + System.out.println("Exchange rate: USD 1.0=" + currency + " " + rate); + return rate; + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + } +} diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java new file mode 100644 index 0000000000..26753a9e9e --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.osoa.sca.annotations.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface StockQuote { + /** + * Invoke the stock quote web service to get the live quotes + * @param input The StAX stream of the request + * @return The StAX stream of the response + */ + public OMElement GetQuote(XMLStreamReader input); +} diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockValue.java b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockValue.java new file mode 100644 index 0000000000..c300103398 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/java/bigbank/StockValue.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank; + +import javax.xml.stream.XMLStreamReader; + +import org.osoa.sca.annotations.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface StockValue { + /** + * Join the quotes and accounts document to calculate the value + * @param quotes The quotes XML document + * @param accounts The accounts XML document + * @return The value + */ + double calculate(XMLStreamReader quotes, XMLStreamReader accounts); +} diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/BigBank.composite b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/BigBank.composite new file mode 100644 index 0000000000..8afde4bf80 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/BigBank.composite @@ -0,0 +1,51 @@ + + + + + + + + + + EUR + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/accounts.xml b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/accounts.xml new file mode 100644 index 0000000000..52ffd41fa7 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/accounts.xml @@ -0,0 +1,29 @@ + + + + John + Smith + + + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/customer.xsd b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/customer.xsd new file mode 100644 index 0000000000..b22efb74c4 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/customer.xsd @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/stock.xq b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/stock.xq new file mode 100644 index 0000000000..03c19e457d --- /dev/null +++ b/sandbox/axis2-1.4/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/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl new file mode 100644 index 0000000000..8411e22ff7 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.png b/sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.png new file mode 100644 index 0000000000..0743a413a3 Binary files /dev/null and b/sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.png differ diff --git a/sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.svg b/sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.svg new file mode 100644 index 0000000000..c7acc03324 --- /dev/null +++ b/sandbox/axis2-1.4/demos/xml-bigbank/xml-bigbank.svg @@ -0,0 +1,447 @@ + + + + + + + + + + image/svg+xml + + + + + + + + BigBank + AccountData(Local file orDatabase) + + StockValue (XQuery) + + + + + + + + + + + + + + WS XML Feed(rss) + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + AccountService (Java) + + + ExchangeRate (Java) + + StockQuote(Live WebService) CurrencyExchangeRate (Live RSS Feed) + + + + -- cgit v1.2.3