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 --- .../samples/bigbank/account/pom.xml | 77 +++++++++ .../services/account/AccountServiceImpl.java | 91 ++++++++++ .../services/accountdata/AccountDataService.java | 26 +++ .../accountdata/AccountDataServiceImpl.java | 51 ++++++ .../services/accountdata/CheckingAccount.java | 39 +++++ .../services/accountdata/SavingsAccount.java | 39 +++++ .../account/services/accountdata/StockAccount.java | 48 ++++++ .../services/stockquote/StockQuoteService.java | 27 +++ .../services/stockquote/StockQuoteServiceImpl.java | 28 +++ .../bigbank/account/src/main/resources/sca.module | 61 +++++++ .../account/src/main/resources/sca.subsystem | 24 +++ .../src/main/resources/wsdl/AccountService.wsdl | 90 ++++++++++ .../main/resources/wsdl/StockQuoteWebService.wsdl | 98 +++++++++++ .../account/src/main/webapp/WEB-INF/axis2.xml | 167 ++++++++++++++++++ .../account/src/main/webapp/WEB-INF/web.xml | 21 +++ .../bigbank/account/client/AccountClient.java | 56 ++++++ .../samples/bigbank/customers/META-INF/MANIFEST.MF | 7 + .../samples/bigbank/customers/pom.xml | 44 +++++ .../samples/bigbank/customers/readme.htm | 190 +++++++++++++++++++++ .../tuscany/samples/customers/CustomerClient.java | 41 +++++ .../customers/CustomerServiceComponent.java | 29 ++++ .../CustomerServiceComponentImpl.componentType | 21 +++ .../customers/CustomerServiceComponentImpl.java | 76 +++++++++ .../bigbank/customers/src/main/java/sca.module | 23 +++ .../bigbank/customers/src/main/webapp/Customer.jsp | 94 ++++++++++ .../customers/src/main/webapp/WEB-INF/web.xml | 38 +++++ .../src/main/webapp/customerdb/log/log.ctrl | Bin 0 -> 48 bytes .../src/main/webapp/customerdb/log/log1.dat | Bin 0 -> 1048576 bytes .../src/main/webapp/customerdb/log/logmirror.ctrl | Bin 0 -> 48 bytes .../src/main/webapp/customerdb/seg0/c10.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c101.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c111.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c121.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c130.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c141.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c150.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c161.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c171.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c180.dat | Bin 0 -> 24576 bytes .../src/main/webapp/customerdb/seg0/c191.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c1a1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c1b1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c1c0.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c1d1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c1e0.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c1f1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c20.dat | Bin 0 -> 20480 bytes .../src/main/webapp/customerdb/seg0/c200.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c211.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c221.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c230.dat | Bin 0 -> 86016 bytes .../src/main/webapp/customerdb/seg0/c241.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c251.dat | Bin 0 -> 12288 bytes .../src/main/webapp/customerdb/seg0/c260.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c271.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c281.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c290.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c2a1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c2b1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c2c1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c2d0.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c2e1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c2f0.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c300.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c31.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c311.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c41.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c51.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c60.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c71.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c81.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/c90.dat | Bin 0 -> 16384 bytes .../src/main/webapp/customerdb/seg0/ca1.dat | Bin 0 -> 16384 bytes .../src/main/webapp/customerdb/seg0/cb1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/cc0.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/cd1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/ce1.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/seg0/cf0.dat | Bin 0 -> 8192 bytes .../src/main/webapp/customerdb/service.properties | 22 +++ tags/java-stable-20060304/samples/bigbank/pom.xml | 35 ++++ .../samples/bigbank/webclient/pom.xml | 89 ++++++++++ .../account/AccountServiceComponentImpl.java | 57 +++++++ .../webclient/services/profile/LoginService.java | 27 +++ .../webclient/services/profile/ProfileService.java | 36 ++++ .../services/profile/ProfileServiceImpl.java | 68 ++++++++ .../services/profile/SimpleLoginServiceImpl.java | 45 +++++ .../webclient/tags/account/AccountStatusTag.java | 125 ++++++++++++++ .../webclient/tags/sca/LoginBarrierTag.java | 87 ++++++++++ .../bigbank/webclient/tags/sca/ServiceTag.java | 100 +++++++++++ .../samples/bigbank/webclient/ui/LoginServlet.java | 67 ++++++++ .../webclient/src/main/resources/sca.module | 55 ++++++ .../webclient/src/main/resources/sca.subsystem | 28 +++ .../src/main/resources/wsdl/AccountService.wsdl | 90 ++++++++++ .../webclient/src/main/webapp/WEB-INF/axis2.xml | 167 ++++++++++++++++++ .../src/main/webapp/WEB-INF/bigbank-tags.tld | 79 +++++++++ .../webclient/src/main/webapp/WEB-INF/web.xml | 35 ++++ .../bigbank/webclient/src/main/webapp/login.html | 24 +++ .../bigbank/webclient/src/main/webapp/summary.jsp | 48 ++++++ .../webclient/client/TestAccountService.java | 51 ++++++ .../bigbank/webclient/client/TestLoginService.java | 49 ++++++ 100 files changed, 2890 insertions(+) create mode 100644 tags/java-stable-20060304/samples/bigbank/account/pom.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/account/AccountServiceImpl.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataService.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataServiceImpl.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/CheckingAccount.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/SavingsAccount.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/StockAccount.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteService.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteServiceImpl.java create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.module create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.subsystem create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/AccountService.wsdl create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/StockQuoteWebService.wsdl create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/axis2.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/web.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/account/src/test/java/org/apache/tuscany/samples/bigbank/account/client/AccountClient.java create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/META-INF/MANIFEST.MF create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/pom.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/readme.htm create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerClient.java create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponent.java create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.componentType create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.java create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/java/sca.module create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/Customer.jsp create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/WEB-INF/web.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log.ctrl create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/logmirror.ctrl create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c10.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c101.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c111.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c121.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c130.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c141.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c150.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c161.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c171.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c180.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c191.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1a1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1b1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1c0.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1d1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1e0.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1f1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c20.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c200.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c211.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c221.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c230.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c241.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c251.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c260.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c271.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c281.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c290.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2a1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2b1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2c1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2d0.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2e1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2f0.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c300.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c31.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c311.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c41.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c51.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c60.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c71.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c81.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c90.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ca1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cb1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cc0.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cd1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ce1.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cf0.dat create mode 100644 tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/service.properties create mode 100644 tags/java-stable-20060304/samples/bigbank/pom.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/pom.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.module create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.subsystem create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/axis2.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/web.xml create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/login.html create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/summary.jsp create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestAccountService.java create mode 100644 tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestLoginService.java (limited to 'tags/java-stable-20060304/samples/bigbank') diff --git a/tags/java-stable-20060304/samples/bigbank/account/pom.xml b/tags/java-stable-20060304/samples/bigbank/account/pom.xml new file mode 100644 index 0000000000..d1a385145f --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/pom.xml @@ -0,0 +1,77 @@ + + + + + org.apache.tuscany.samples.bigbank + bigbank-samples + SNAPSHOT + + 4.0.0 + account + war + Tuscany sample BigBank account + BigBank sample - account module + SNAPSHOT + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + true + true + true + true + + + generate + + + + + + org.apache.tuscany + tuscany-sca-plugin + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + org.apache.tuscany.samples.bigbank.account.services.account + + + generate + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/account/AccountServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..4552615227 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.account; + +import java.util.List; + +import org.apache.tuscany.samples.bigbank.account.AccountFactory; +import org.apache.tuscany.samples.bigbank.account.AccountReport; +import org.apache.tuscany.samples.bigbank.account.AccountSummary; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.AccountDataService; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.CheckingAccount; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.SavingsAccount; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.StockAccount; +import org.apache.tuscany.samples.bigbank.account.services.stockquote.StockQuoteService; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(interfaces=AccountService.class) +public class AccountServiceImpl implements AccountService { + + static { + SDOUtil.registerStaticTypes(AccountFactory.class); + } + + @Property + private String currency = "USD"; + + @Reference + private AccountDataService accountDataService; + @Reference + private StockQuoteService stockQuoteService; + + public AccountServiceImpl() { + } + + public AccountReport getAccountReport(String customerID) { + + AccountFactory accountFactory=new AccountFactory(); + + AccountReport accountReport = accountFactory.createAccountReport(); + List accountSummaries = accountReport.getAccountSummaries(); + + CheckingAccount checkingAccount = accountDataService.getCheckingAccount(customerID); + AccountSummary checkingAccountSummary = accountFactory.createAccountSummary(); + checkingAccountSummary.setAccountNumber(checkingAccount.getAccountNumber()); + checkingAccountSummary.setAccountType("checking"); + checkingAccountSummary.setBalance(fromUSDollarToCurrency(checkingAccount.getBalance())); + accountSummaries.add(checkingAccountSummary); + + SavingsAccount savingsAccount = accountDataService.getSavingsAccount(customerID); + AccountSummary savingsAccountSummary = accountFactory.createAccountSummary(); + savingsAccountSummary.setAccountNumber(savingsAccount.getAccountNumber()); + savingsAccountSummary.setAccountType("savings"); + savingsAccountSummary.setBalance(fromUSDollarToCurrency(savingsAccount.getBalance())); + accountSummaries.add(savingsAccountSummary); + + StockAccount stockAccount = accountDataService.getStockAccount(customerID); + AccountSummary stockAccountSummary = accountFactory.createAccountSummary(); + stockAccountSummary.setAccountNumber(stockAccount.getAccountNumber()); + stockAccountSummary.setAccountType("stock"); + float balance = (stockQuoteService.getQuote(stockAccount.getSymbol())) * stockAccount.getQuantity(); + stockAccountSummary.setBalance(fromUSDollarToCurrency(balance)); + accountSummaries.add(stockAccountSummary); + + return accountReport; + } + + private float fromUSDollarToCurrency(float value) { + + if (currency.equals("USD")) return value; + else if (currency.equals("EURO")) return value * 0.8f; + else + return 0.0f; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataService.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..b0d07ed3e7 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public interface AccountDataService { + + CheckingAccount getCheckingAccount(String customerID); + + SavingsAccount getSavingsAccount(String customerID); + + StockAccount getStockAccount(String customerID); +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..963277ee76 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Service; + +@Service(AccountDataService.class) +public class AccountDataServiceImpl implements AccountDataService { + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID + "_" + "STA12345"); + stockAccount.setSymbol("IBM"); + stockAccount.setQuantity(100); + + return stockAccount; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/CheckingAccount.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..b3dd6185e1 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/CheckingAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public class CheckingAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/SavingsAccount.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..0b7f2e0fd5 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/SavingsAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public class SavingsAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/StockAccount.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/StockAccount.java new file mode 100644 index 0000000000..f6b90259b3 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/StockAccount.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public class StockAccount { + + private String accountNumber; + private String symbol; + private int quantity; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteService.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..80ac8d58be --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.stockquote; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface StockQuoteService { + + public float getQuote(String symbol); +} + + \ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteServiceImpl.java new file mode 100644 index 0000000000..ff4878b10c --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteServiceImpl.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.services.stockquote; + +/* Dummy'd up StockQuoteService, override webservice for now */ + +public class StockQuoteServiceImpl implements StockQuoteService { + + public float getQuote(String symbol) { + // Just hardcode for now + return 83.00f; + } + +} \ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.module b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.module new file mode 100644 index 0000000000..b13d844609 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.module @@ -0,0 +1,61 @@ + + + + + + + + AccountServiceComponent/AccountService + + + + + + EURO + + + AccountDataServiceComponent + StockQuoteService + + + + + + + + + + + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.subsystem b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.subsystem new file mode 100644 index 0000000000..b15fa2bc5c --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.subsystem @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/AccountService.wsdl b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..5d087530dd --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/StockQuoteWebService.wsdl b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/StockQuoteWebService.wsdl new file mode 100644 index 0000000000..9678d9d6ea --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/StockQuoteWebService.wsdl @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/axis2.xml b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/axis2.xml new file mode 100644 index 0000000000..a38cf9864a --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/axis2.xml @@ -0,0 +1,167 @@ + + + + + false + false + false + + + + + admin + axis2 + + . + + 127.0.0.1 + 5555 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + + + + + HTTP/1.1 + chunked + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/web.xml b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..46bed8f4fe --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + + Tuscany Bigbank Account sample + + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/test/java/org/apache/tuscany/samples/bigbank/account/client/AccountClient.java b/tags/java-stable-20060304/samples/bigbank/account/src/test/java/org/apache/tuscany/samples/bigbank/account/client/AccountClient.java new file mode 100644 index 0000000000..b9bf5351c0 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/test/java/org/apache/tuscany/samples/bigbank/account/client/AccountClient.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.account.client; + +import java.util.Iterator; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.samples.bigbank.account.AccountReport; +import org.apache.tuscany.samples.bigbank.account.AccountSummary; +import org.apache.tuscany.samples.bigbank.account.services.account.AccountService; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +public class AccountClient extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.account.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent"); + + AccountReport accountReport = accountService.getAccountReport("12345"); + + for (Iterator i = accountReport.getAccountSummaries().iterator(); i.hasNext();) { + AccountSummary accountSummary = (AccountSummary) i.next(); + + System.out.println(accountSummary.getAccountNumber()); + System.out.println(accountSummary.getAccountType()); + System.out.println(accountSummary.getBalance()); + } + + } + +} diff --git a/tags/java-stable-20060304/samples/bigbank/customers/META-INF/MANIFEST.MF b/tags/java-stable-20060304/samples/bigbank/customers/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..ac6c17f07e --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: sample +Bundle-SymbolicName: sample +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Require-Bundle: org.eclipse.emf.ecore.sdo diff --git a/tags/java-stable-20060304/samples/bigbank/customers/pom.xml b/tags/java-stable-20060304/samples/bigbank/customers/pom.xml new file mode 100644 index 0000000000..a96cfa328f --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/pom.xml @@ -0,0 +1,44 @@ + + + + + org.apache.tuscany.samples.bigbank + bigbank-samples + SNAPSHOT + + 4.0.0 + customers + war + Tuscany sample BigBank customer + DAS example with JSP + SNAPSHOT + + + + org.apache.tuscany.das + tuscany-das-rdb + ${pom.version} + provided + + + org.osoa + sca-api + ${pom.version} + provided + + + diff --git a/tags/java-stable-20060304/samples/bigbank/customers/readme.htm b/tags/java-stable-20060304/samples/bigbank/customers/readme.htm new file mode 100644 index 0000000000..b4c4a8cbad --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/readme.htm @@ -0,0 +1,190 @@ + + + + + + + Tuscany Customers + + + +

Tuscany Customer Sample

+ +

Overview

+ +

This sample employs the Tuscany runtime in collaboration with the RDB DAS to demonstrate a simple read of a customer +record from a relational database in the context of a web application. The user provides a customer +ID and the application responds with the corresponding customer record

+ + +

Setup

Run the Maven 'acceptance' task as described in the Tomcat + Setup.  Running this task will configure and start a Tomcat server and deploy the sample application along with a +canned Derby database for use by the example. Instructions will be posted soon for manually deploying the +sample to an existing Tomcat install.
+ + +
    + +
+ +

Running

+ +As mentioned above, running the Maven acceptance task deploys and runs the sample as part of the Tuscany acceptance testing. After the task has completed +you can manually run the sample by pointing a browser to: http://localhost:8080/tuscany-samples-customerWEB/. +A page is displayed that prompts the user for a customer id. Submit an integer from 1 to 3. + +

Results

+ +

Submitting an integer from 1 to 3 will result in the display of the corresponding employee record
+ +

Code Overview

+ +The following illustrates the structure of the sample application components: + + + + + + + + + + + + +
main
+ + +---java
+ + ¦   ¦   + sca.module
+ + ¦   ¦
+ + ¦   +---org
+ + ¦       + + +---apache
+ + ¦           + +---tuscany
+ + ¦              + +---samples
+ + ¦                   + + +---customers
+ ¦                           + CustomerClient.java
+ ¦                           + CustomerServiceComponent.java
+ ¦                           + CustomerServiceComponentImpl.java
+ + ¦
+ + +---webapp
+ +     ¦   + Customer.jsp
+ +     ¦
+ +     +---customerdb
+ +     ¦     + + + +     ¦   
+ + +     ¦
+ +     +---WEB-INF
+              web.xml + + +


+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sca.module Defines the SCA module and component. Defines for the CustomerServiceComponent.
CustomerClient.java Wraps the get customer service to provide a clean "getCustomer()" API.
CustomerServiceComponent.java Defines the interface of the service.
Customer.jsp Handles Web form input. Instantiates a CustomerClient instance and calls getCustomer()
customerdb The canned Derby database with Customer records
web.xml Standard J2EE web application web.xml
+ + + + diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerClient.java b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerClient.java new file mode 100644 index 0000000000..54603c94d6 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerClient.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.customers; + +import commonj.sdo.DataObject; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * + */ +public class CustomerClient { + + public final DataObject getCustomer(String id) throws Exception { + + ModuleContext moduleContext = CurrentModuleContext.getContext(); + assert moduleContext != null : "CurrentModuleContext.getContext() returned null!"; + + CustomerServiceComponent customerService = (CustomerServiceComponent) moduleContext + .locateService("CustomerServiceComponent"); + assert null != customerService : "SCA locate of CustomerServiceComponent returned null."; + DataObject value = customerService.getCustomer(id); + + return value; + } + +} diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponent.java b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponent.java new file mode 100644 index 0000000000..431b10b0e1 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponent.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.customers; + +import commonj.sdo.DataObject; + +/** + * + */ + +public interface CustomerServiceComponent { + + public DataObject getCustomer(String id); + +} diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.componentType b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.componentType new file mode 100644 index 0000000000..09535eb86b --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.componentType @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.java b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.java new file mode 100644 index 0000000000..d78a5429c1 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/org/apache/tuscany/samples/customers/CustomerServiceComponentImpl.java @@ -0,0 +1,76 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.customers; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.util.List; + +import commonj.sdo.DataObject; +import org.osoa.sca.annotations.Service; + +import org.apache.tuscany.das.rdb.Command; + +/** + * + */ +@Service(CustomerServiceComponent.class) +public class CustomerServiceComponentImpl implements CustomerServiceComponent { + + private static final String driverName = "org.apache.derby.jdbc.EmbeddedDriver"; + + private static final String databaseURL = "jdbc:derby:../webapps/tuscany-samples-customerWEB/customerdb"; + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.samples.helloworldweb.HelloWorldServiceComponent#getGreetings() + */ + public DataObject getCustomer(String id) { + // Create and initialize command to read customers + Command readCustomers = Command.FACTORY + .createCommand("select * from CUSTOMER where ID = :ID"); + readCustomers.setConnection(getConnection()); + readCustomers.setParameterValue("ID", new Integer(id)); + + // Read + DataObject root = readCustomers.executeQuery(); + + readCustomers.close(); + + List customers = root.getList("CUSTOMER"); + if (customers.size() > 0) + return (DataObject) customers.get(0); + else + return null; + + } + + private Connection getConnection() { + try { + + Class.forName(driverName).newInstance(); + Connection connection = DriverManager.getConnection(databaseURL); + connection.setAutoCommit(false); + return connection; + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + } + +} diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/sca.module b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/sca.module new file mode 100644 index 0000000000..64ff9341f2 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/java/sca.module @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/Customer.jsp b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/Customer.jsp new file mode 100644 index 0000000000..8906a54f99 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/Customer.jsp @@ -0,0 +1,94 @@ + +<%-- + * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --%> + + + + <%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" session="true" autoFlush="true" + isThreadSafe="true" isErrorPage="false" + import="org.apache.tuscany.samples.customers.CustomerClient" + import="java.io.PrintWriter" + import="java.io.StringWriter" + import="java.util.Iterator" + import="commonj.sdo.*" + %> + + + Tuscany HelloWorld WEB Example + <% + String id = request.getParameter("id"); + %> + + + +

Tuscany CustomerDB WEB Example

+ +

 

+ +
ID + please:    ">
+
+
+
+ +<% + try { + if (null != id) { +%> +
+ +

+ + <% DataObject obj = (new CustomerClient()).getCustomer(id); + if ( obj == null ) {%> + +

Customer <%= id%> not found

+<%} else {%> + + + + <%Iterator iter = obj.getType().getProperties().iterator(); + while (iter.hasNext()) { + Property p = (Property) iter.next();%> + + <% + } + %> +
IDFirst NameLast Name
<%= obj.get(p)%>
+<% + } + } +} catch (Exception e) { + e.printStackTrace(); + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + + e.printStackTrace(pw); + pw.flush(); + +%> +Whoops!
+
+    Exception "<%=e.getClass().getName()%>" Exception message: "<%=e.getMessage()%>"
+ <%=sw.toString() %> +
+<% + + }%> + + \ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/WEB-INF/web.xml b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..9c377a7f05 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,38 @@ + + + + + + + Tuscany sample Customers WEB + + + wsdl + text/xml + + + + xsd + text/xml + + + + Customer.jsp + + + diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log.ctrl b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log.ctrl new file mode 100644 index 0000000000..07b131b33d Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log.ctrl differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log1.dat new file mode 100644 index 0000000000..a2b39d02ad Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/log1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/logmirror.ctrl b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/logmirror.ctrl new file mode 100644 index 0000000000..07b131b33d Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/log/logmirror.ctrl differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c10.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c10.dat new file mode 100644 index 0000000000..ec5247397b Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c10.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c101.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c101.dat new file mode 100644 index 0000000000..56f1d60c9b Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c101.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c111.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c111.dat new file mode 100644 index 0000000000..d3b8b6f5e1 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c111.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c121.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c121.dat new file mode 100644 index 0000000000..3a207dc135 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c121.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c130.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c130.dat new file mode 100644 index 0000000000..62e5dfb863 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c130.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c141.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c141.dat new file mode 100644 index 0000000000..f695f44cd9 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c141.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c150.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c150.dat new file mode 100644 index 0000000000..2c1e232161 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c150.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c161.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c161.dat new file mode 100644 index 0000000000..9983bb5ba4 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c161.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c171.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c171.dat new file mode 100644 index 0000000000..25800bbf47 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c171.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c180.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c180.dat new file mode 100644 index 0000000000..8f4b0f0b5d Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c180.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c191.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c191.dat new file mode 100644 index 0000000000..b2d149a0f3 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c191.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1a1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1a1.dat new file mode 100644 index 0000000000..9a15a565ca Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1a1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1b1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1b1.dat new file mode 100644 index 0000000000..468738fdf3 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1b1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1c0.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1c0.dat new file mode 100644 index 0000000000..359525a31a Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1c0.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1d1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1d1.dat new file mode 100644 index 0000000000..9f257df932 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1d1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1e0.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1e0.dat new file mode 100644 index 0000000000..e43e52fb7f Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1e0.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1f1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1f1.dat new file mode 100644 index 0000000000..7e6ee3b1e0 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c1f1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c20.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c20.dat new file mode 100644 index 0000000000..1acd3470bd Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c20.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c200.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c200.dat new file mode 100644 index 0000000000..cae919d022 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c200.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c211.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c211.dat new file mode 100644 index 0000000000..c7e311b00e Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c211.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c221.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c221.dat new file mode 100644 index 0000000000..28e89367ce Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c221.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c230.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c230.dat new file mode 100644 index 0000000000..505d1595c5 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c230.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c241.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c241.dat new file mode 100644 index 0000000000..e1de638de2 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c241.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c251.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c251.dat new file mode 100644 index 0000000000..d3d6adf4fb Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c251.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c260.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c260.dat new file mode 100644 index 0000000000..8d7333df7d Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c260.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c271.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c271.dat new file mode 100644 index 0000000000..af722f7d73 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c271.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c281.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c281.dat new file mode 100644 index 0000000000..3972983c2e Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c281.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c290.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c290.dat new file mode 100644 index 0000000000..31577b8124 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c290.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2a1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2a1.dat new file mode 100644 index 0000000000..0f700d13a7 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2a1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2b1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2b1.dat new file mode 100644 index 0000000000..1d6382fb3d Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2b1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2c1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2c1.dat new file mode 100644 index 0000000000..3bc60d886b Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2c1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2d0.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2d0.dat new file mode 100644 index 0000000000..c542d3c91c Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2d0.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2e1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2e1.dat new file mode 100644 index 0000000000..16abd20b5f Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2e1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2f0.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2f0.dat new file mode 100644 index 0000000000..eb26be5932 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c2f0.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c300.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c300.dat new file mode 100644 index 0000000000..f3a3c65388 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c300.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c31.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c31.dat new file mode 100644 index 0000000000..73d5c7fae4 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c31.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c311.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c311.dat new file mode 100644 index 0000000000..f6a7e4f417 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c311.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c41.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c41.dat new file mode 100644 index 0000000000..eb58d83e26 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c41.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c51.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c51.dat new file mode 100644 index 0000000000..7d0eec8334 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c51.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c60.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c60.dat new file mode 100644 index 0000000000..5e3d16c18a Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c60.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c71.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c71.dat new file mode 100644 index 0000000000..9ca2ca97d1 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c71.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c81.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c81.dat new file mode 100644 index 0000000000..434cd610e1 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c81.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c90.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c90.dat new file mode 100644 index 0000000000..a7d7c228fa Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/c90.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ca1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ca1.dat new file mode 100644 index 0000000000..bd89820d88 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ca1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cb1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cb1.dat new file mode 100644 index 0000000000..3fcb1cc026 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cb1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cc0.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cc0.dat new file mode 100644 index 0000000000..5126021a83 Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cc0.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cd1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cd1.dat new file mode 100644 index 0000000000..2e135b64ab Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cd1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ce1.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ce1.dat new file mode 100644 index 0000000000..076423c10a Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/ce1.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cf0.dat b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cf0.dat new file mode 100644 index 0000000000..b2ab11309b Binary files /dev/null and b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/seg0/cf0.dat differ diff --git a/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/service.properties b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/service.properties new file mode 100644 index 0000000000..6a0ce30db7 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/customers/src/main/webapp/customerdb/service.properties @@ -0,0 +1,22 @@ +#C:\ossoa\trunk\samples\customers\src\webapp\customerdb +# ******************************************************************** +# *** Please do NOT edit this file. *** +# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. *** +# ******************************************************************** +#Tue Nov 01 17:28:38 EST 2005 +SysschemasIndex2Identifier=225 +SyscolumnsIdentifier=144 +SysconglomeratesIndex1Identifier=49 +SysconglomeratesIdentifier=32 +SyscolumnsIndex2Identifier=177 +SysschemasIndex1Identifier=209 +SysconglomeratesIndex3Identifier=81 +SystablesIndex2Identifier=129 +SyscolumnsIndex1Identifier=161 +derby.serviceProtocol=org.apache.derby.database.Database +SysschemasIdentifier=192 +derby.storage.propertiesId=16 +SysconglomeratesIndex2Identifier=65 +derby.serviceLocale=en_US +SystablesIdentifier=96 +SystablesIndex1Identifier=113 diff --git a/tags/java-stable-20060304/samples/bigbank/pom.xml b/tags/java-stable-20060304/samples/bigbank/pom.xml new file mode 100644 index 0000000000..0ec1824e0c --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/pom.xml @@ -0,0 +1,35 @@ + + + + + org.apache.tuscany.samples + tuscany-samples + SNAPSHOT + + 4.0.0 + org.apache.tuscany.samples.bigbank + bigbank-samples + pom + Tuscany BigBank Samples + SNAPSHOT + + + customers + account + webclient + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/pom.xml b/tags/java-stable-20060304/samples/bigbank/webclient/pom.xml new file mode 100644 index 0000000000..7503f83246 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.samples.bigbank + bigbank-samples + SNAPSHOT + + 4.0.0 + webclient + war + Tuscany sample BigBank webclient + BigBank sample - webclient module + SNAPSHOT + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + + tomcat + servlet-api + 5.0.18 + provided + + + tomcat + jsp-api + 5.0.18 + provided + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + true + true + true + true + + + generate + + + + + + org.apache.tuscany + tuscany-sca-plugin + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + org.apache.tuscany.samples.bigbank.account.services.account + + generate + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java new file mode 100644 index 0000000000..3a9e7a4e60 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java @@ -0,0 +1,57 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.services.account; + +import org.apache.tuscany.samples.bigbank.account.AccountFactory; +import org.apache.tuscany.samples.bigbank.account.AccountReport; +import org.apache.tuscany.samples.bigbank.account.services.account.AccountService; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.osoa.sca.ServiceUnavailableException; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + */ +@Service(AccountService.class) +public class AccountServiceComponentImpl implements AccountService { + + static { + SDOUtil.registerStaticTypes(AccountFactory.class); + } + + @Reference + public AccountService accountService; + + /** + * + */ + public AccountServiceComponentImpl() { + super(); + } + + /** + * @see org.apache.tuscany.samples.bigbank.webclient.services.account.AccountService#getAccountReport(java.lang.String) + */ + public AccountReport getAccountReport(String customerID) { + try { + return accountService.getAccountReport(customerID); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + +} diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java new file mode 100644 index 0000000000..7bb660082d --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.services.profile; + +public interface LoginService { + + public static final int SUCCESS = 1; + public static final int INVALID_LOGIN = -1; + public static final int INVALID_PASSWORD = -2; + + public int login(String userName, String password); +} + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java new file mode 100644 index 0000000000..affbfe9700 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.services.profile; + +public interface ProfileService { + + public String getFirstName(); + + public void setFirstName(String pName); + + public String getLastName(); + + public void setLastName(String pName); + + public boolean isLoggedIn(); + + public void setLoggedIn(boolean pStatus); + + public String getId(); + + public void setId(String pId); +} diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java new file mode 100644 index 0000000000..7d572154c6 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.services.profile; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ProfileService.class) +@Scope("session") +public class ProfileServiceImpl implements ProfileService { + + @Property + private String firstName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + private String lastName; + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + private boolean loggedIn; + + public boolean isLoggedIn() { + return loggedIn; + } + + public void setLoggedIn(boolean status) { + loggedIn = status; + } + + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java new file mode 100644 index 0000000000..2689dc7020 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.services.profile; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(LoginService.class) +public class SimpleLoginServiceImpl implements LoginService { + + @Reference + public ProfileService profileService; + + public int login(String userName, String password) { + + if (!"test".equals(userName)) { + return INVALID_LOGIN; + } + + if (!"password".equals(password)) { + return INVALID_PASSWORD; + } + + profileService.setLoggedIn(true); + profileService.setFirstName("John"); + profileService.setLastName("Doe"); + profileService.setId("12345"); + + return SUCCESS; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java new file mode 100644 index 0000000000..ecdb0c49b4 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java @@ -0,0 +1,125 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.tags.account; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.apache.tuscany.samples.bigbank.account.services.account.AccountService; +import org.apache.tuscany.samples.bigbank.webclient.services.profile.ProfileService; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * Retrieves and iterates over account summary information for the current + * profile by accessing the remotable account service component + */ + +public class AccountStatusTag extends TagSupport { + + // ---------------------------------- + // Constructors + // ---------------------------------- + + public AccountStatusTag() { + super(); + } + + // ---------------------------------- + // Methods + // ---------------------------------- + + private String mAccountService; + + public String getAccountService() { + return mAccountService; + } + + public void setAccountService(String pAccountService) { + mAccountService = pAccountService; + } + + private String mProfileService; + + public String getProfileService() { + return mProfileService; + } + + public void setProfileService(String pProfileService) { + mProfileService = pProfileService; + } + + private String mId; + + public String getId() { + return mId; + } + + public void setId(String pId) { + mId = pId; + } + + private Iterator mIterator; + + public int doStartTag() throws JspException { + ModuleContext moduleContext = CurrentModuleContext.getContext(); + ProfileService profile = (ProfileService) moduleContext + .locateService(mProfileService); + if (profile == null) { + throw new JspException("Profile [" + mProfileService + + "] not found in current module context"); + } + + AccountService service = (AccountService) moduleContext + .locateService(mAccountService); + if (service == null) { + throw new JspException("Service [" + mAccountService + + "] not found in current module context"); + } + List summaries; + try { + summaries = service.getAccountReport(profile.getId()).getAccountSummaries(); + } catch (Exception e) { + throw new JspException(e); + } + mIterator = summaries.iterator(); + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_INCLUDE; + } else { + return SKIP_BODY; + } + } + + public int doAfterBody() { + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_AGAIN; + } else { + return SKIP_BODY; + } + } + + public void release() { + super.release(); + mId = null; + mIterator = null; + } +} \ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java new file mode 100644 index 0000000000..31fa27fa6f --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java @@ -0,0 +1,87 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.tags.sca; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.samples.bigbank.webclient.services.profile.ProfileService; + +public class LoginBarrierTag extends TagSupport { + + public LoginBarrierTag() { + super(); + } + + private String mProfile; + + public String getProfile() { + return mProfile; + } + + public void setProfile(String pProfile) { + mProfile = pProfile; + } + + private String mUrl; + + public String getUrl() { + return mUrl; + } + + public void setUrl(String pUrl) { + mUrl = pUrl; + } + + public int doStartTag() throws JspException { + if (mProfile == null || mProfile.length() < 1) { + throw new JspException("Invalid profile location specified"); + } + + ModuleContext moduleContext = CurrentModuleContext.getContext(); + ProfileService profile = (ProfileService) moduleContext.locateService(mProfile); + if (profile == null) { + throw new JspException("Profile [" + mProfile + "] not found in current module context"); + } + if (profile.isLoggedIn()) { + return EVAL_BODY_INCLUDE; + } else { + try { + pageContext.forward(mUrl); + return SKIP_BODY; + } catch (ServletException e) { + throw new JspException("Unable to forward to [" + mUrl + "]"); + } catch (IOException e) { + throw new JspException("Unable to forward to [" + mUrl + "]"); + } + } + } + + public int doEndTag() throws JspException { + return EVAL_PAGE; + } + + public void release() { + super.release(); + } + +} diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java new file mode 100644 index 0000000000..df5697c11f --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java @@ -0,0 +1,100 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.tags.sca; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + + +/** + * Places an SCA service in the JSP page context, making it available to other + * tags corresponding to its id value. + */ + +public class ServiceTag extends TagSupport { + + // ---------------------------------- + // Constructors + // ---------------------------------- + + public ServiceTag() { + super(); + } + + // ---------------------------------- + // Methods + // ---------------------------------- + + private String mName; + + /** + * Returns the name of the SCA service to import into the page context. + */ + public String getName() { + return mName; + } + + /** + * Sets name of the SCA service to import into the page context. + */ + public void setName(String pName) { + mName = pName; + } + + private String mId; + + /** + * Returns the id of the service in the page context + */ + public String getId() { + return mId; + } + + /** + * Sets the id of the service for the page context + */ + + public void setId(String pId) { + mId = pId; + } + + public int doStartTag() throws JspException { + ModuleContext moduleContext = CurrentModuleContext.getContext(); + Object service = moduleContext.locateService(mName); + if (service == null) { + throw new JspException("Service [" + mName + "] not found in current module context"); + } + if (mId == null) { + // if the Id name was not specified, default to the basic name of the + // service + mId = mName; + } + pageContext.setAttribute(mId, service); + return EVAL_BODY_INCLUDE; + } + + public int doEndTag() throws JspException { + return EVAL_PAGE; + } + + public void release() { + super.release(); + } +} \ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java new file mode 100644 index 0000000000..78bedbe4f7 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.ui; + +import java.io.IOException; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.tuscany.samples.bigbank.webclient.services.profile.LoginService; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + + +public class LoginServlet extends HttpServlet { + + private ServletContext mContext; + + public void init(ServletConfig pCfg) throws ServletException { + mContext = pCfg.getServletContext(); + } + + public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException { + + ModuleContext moduleContext = CurrentModuleContext.getContext(); + LoginService loginMgr = (LoginService) + moduleContext.locateService("LoginServiceComponent"); + + if (loginMgr == null) { + throw new ServletException("LoginManager not found"); + } + + String login = pReq.getParameter("login"); + String password = pReq.getParameter("password"); + try { + if (login == null || password == null) { + pResp.sendRedirect("summary.jsp"); + } + int resp = loginMgr.login(login, password); + if (resp == LoginService.SUCCESS) { + mContext.getRequestDispatcher("/summary.jsp").forward(pReq, pResp); + } else { + mContext.getRequestDispatcher("/login.html").forward(pReq, pResp); + } + } catch (IOException e) { + throw new ServletException(e); + } + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.module b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.module new file mode 100644 index 0000000000..6b4b17c6a7 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.module @@ -0,0 +1,55 @@ + + + + + + + + ProfileServiceComponent + + + + + + + Anonymous + + + + + + + AccountService + + + + + + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.subsystem b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.subsystem new file mode 100644 index 0000000000..1c12f340c8 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.subsystem @@ -0,0 +1,28 @@ + + + + + + + bigbank.accountsunbsystem/AccountModuleComponent/AccountService + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..5d087530dd --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/axis2.xml b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/axis2.xml new file mode 100644 index 0000000000..a38cf9864a --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/axis2.xml @@ -0,0 +1,167 @@ + + + + + false + false + false + + + + + admin + axis2 + + . + + 127.0.0.1 + 5555 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + + + + + HTTP/1.1 + chunked + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld new file mode 100644 index 0000000000..c8a4451691 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld @@ -0,0 +1,79 @@ + + + + 1.0 + 2.0 + BigBank Tags + Tag library containing BigBank tags + + service + org.apache.tuscany.samples.bigbank.webclient.tags.sca.ServiceTag + JSP + Places a reference to an SCA Service in the page context + + id + true + false + + + name + true + false + + + + login + org.apache.tuscany.samples.bigbank.webclient.tags.sca.LoginBarrierTag + JSP + Redirects if user is not logged in + + profile + true + false + + + url + true + false + + + + + accountStatus + org.apache.tuscany.samples.bigbank.webclient.tags.account.AccountStatusTag + JSP + Accesses and iterates the account service + + id + true + false + + + accountService + true + false + + + profileService + true + false + + + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/web.xml b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..859fb927af --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + + Tuscany Bigbank Web UI sample + + login.html + + + + LoginServlet + org.apache.tuscany.samples.bigbank.webclient.ui.LoginServlet + 1 + + + + LoginServlet + /loginAction/* + + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/login.html b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/login.html new file mode 100644 index 0000000000..72b180a29c --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/login.html @@ -0,0 +1,24 @@ + +Welcome to Big Bank + + +
+ + + + +
Please login in to access your account
+ + + + + + + + + + +
Login
Password
+
+ + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/summary.jsp b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/summary.jsp new file mode 100644 index 0000000000..be56e2547c --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/summary.jsp @@ -0,0 +1,48 @@ +<%-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --%> +<%@ taglib uri="/WEB-INF/bigbank-tags.tld" prefix="sca" %> + + + + + BigBank Account Summary + + + + Account Information for + + +
+ + + + + + + + + + + + +
AccountBalance
+ + + +
+ + + diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestAccountService.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestAccountService.java new file mode 100644 index 0000000000..de18ee0db2 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestAccountService.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.client; + +import java.util.List; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.samples.bigbank.account.AccountReport; +import org.apache.tuscany.samples.bigbank.account.services.account.AccountService; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + + +public class TestAccountService extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent"); + + AccountReport report = accountService.getAccountReport("12345"); + List summaries = report.getAccountSummaries(); + + System.out.println("retrieved " + summaries.size() + " summaries"); + + tuscany.stop(); + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestLoginService.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestLoginService.java new file mode 100644 index 0000000000..ac16890127 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestLoginService.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.bigbank.webclient.client; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.samples.bigbank.webclient.services.profile.LoginService; + + +public class TestLoginService extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + + + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + LoginService loginService = (LoginService) + moduleContext.locateService("LoginServiceComponent"); + + if (loginService.login("test", "password") == LoginService.SUCCESS) + System.out.println("Success"); + else + System.out.println("Failure"); + } +} -- cgit v1.2.3