You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/12/26 11:59:48 UTC
svn commit: r606878 - in
/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main:
java/bigbank/account/ java/bigbank/account/checking/
java/bigbank/account/savings/ java/bigbank/account/stock/
java/bigbank/accountdata/ java/big...
Author: svkrish
Date: Wed Dec 26 02:59:46 2007
New Revision: 606878
URL: http://svn.apache.org/viewvc?rev=606878&view=rev
Log:
splitting up account data into three composites - savings, checkings, stock with checkingsAc service enabled for ws authentication
Added:
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite
Removed:
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/accountdata/
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/AccountData.composite
Modified:
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite
incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html
Modified: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java?rev=606878&r1=606877&r2=606878&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java (original)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java Wed Dec 26 02:59:46 2007
@@ -23,10 +23,12 @@
import org.osoa.sca.annotations.Service;
import stockquote.StockQuoteService;
-import bigbank.accountdata.AccountDataService;
-import bigbank.accountdata.CheckingAccount;
-import bigbank.accountdata.SavingsAccount;
-import bigbank.accountdata.StockAccount;
+import bigbank.account.checking.CheckingAccountDetails;
+import bigbank.account.checking.CheckingAccountService;
+import bigbank.account.savings.SavingsAccountDetails;
+import bigbank.account.savings.SavingsAccountService;
+import bigbank.account.stock.StockAccountDetails;
+import bigbank.account.stock.StockAccountService;
import calculator.CalculatorService;
/**
@@ -37,7 +39,13 @@
public class AccountServiceImpl implements AccountService {
@Reference
- protected AccountDataService accountDataService;
+ protected SavingsAccountService savingsAcService;
+
+ @Reference
+ protected CheckingAccountService checkingAcService;
+
+ @Reference
+ protected StockAccountService stockAcService;
@Reference
protected StockQuoteService stockQuoteService;
@@ -52,38 +60,37 @@
// Get the checking, savings and stock accounts from the AccountData
// service component
- CheckingAccount checking = null;
+ CheckingAccountDetails checking = null;
try {
- checking = accountDataService.getCheckingAccount(customerID);
-
- System.out.println("Checking account: " + checking);
+ checking = checkingAcService.getAccountDetails(customerID);
+ System.out.println("Checking account: " + checking);
- SavingsAccount savings = accountDataService.getSavingsAccount(customerID);
- System.out.println("Savings account: " + savings);
+ SavingsAccountDetails savings = savingsAcService.getAccountDetails(customerID);
+ System.out.println("Savings account: " + savings);
- StockAccount stock = accountDataService.getStockAccount(customerID);
- System.out.println("Stock account: " + stock);
-
- // Get the stock price in USD
- double price = stockQuoteService.getQuote(stock.getSymbol());
- System.out.println("Stock price for " + stock.getSymbol() + ": " + price);
+ StockAccountDetails stock = stockAcService.getAccountDetails(customerID);
+ System.out.println("Stock account: " + stock);
- // Convert to the configured currency
- if (currency.equals("EURO")) {
+ // Get the stock price in USD
+ double price = stockQuoteService.getQuote(stock.getSymbol());
+ System.out.println("Stock price for " + stock.getSymbol() + ": " + price);
+
+ // Convert to the configured currency
+ if (currency.equals("EURO")) {
+
+ // Use our fancy calculator service to convert to the target currency
+ price = calculatorService.multiply(price, 0.70);
+
+ System.out.println("Converted to " + currency + ": " + price);
+ }
- // Use our fancy calculator service to convert to the target currency
- price = calculatorService.multiply(price, 0.70);
+ // Calculate the value of the stock account
+ double stockValue = price * stock.getQuantity();
- System.out.println("Converted to " + currency + ": " + price);
- }
-
- // Calculate the value of the stock account
- double stockValue = price * stock.getQuantity();
-
- // Calculate the total balance of all accounts and return it
- double balance = checking.getBalance() + savings.getBalance() + stockValue;
-
- return balance;
+ // Calculate the total balance of all accounts and return it
+ double balance = checking.getBalance() + savings.getBalance() + stockValue;
+
+ return balance;
} catch ( Throwable e ) {
e.printStackTrace();
return 0;
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+/**
+ * @version $$Rev: 567543 $$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
+ * 2007) $$
+ */
+
+public class CheckingAccountDetails {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String n) {
+ this.accountNumber = n;
+ }
+
+ public double getBalance() {
+ return balance;
+ }
+
+ public void setBalance(double b) {
+ this.balance = b;
+ }
+
+ @Override
+ public String toString() {
+ return accountNumber + ", balance:" + balance;
+ }
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $$Rev: 540764 $$ $$Date: 2007-05-23 03:17:57 +0530 (Wed, 23 May 2007) $$
+ */
+@Remotable
+public interface CheckingAccountService {
+
+ public CheckingAccountDetails getAccountDetails(String customerID);
+
+ public double deposit(String accountNo, double depositAmt);
+
+ public double withdraw(String accountNo, double withdrawalAmount);
+
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(CheckingAccountService.class)
+public class CheckingAccountServiceImpl implements CheckingAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, Double> checkingAccts = new HashMap<String, Double>();
+
+ public CheckingAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "CHA_Customer_01");
+ custAcctMap.put("Customer_02", "CHA_Customer_02");
+ custAcctMap.put("Customer_03", "CHA_Customer_03");
+
+ checkingAccts.put("CHA_Customer_01", new Double(1000));
+ checkingAccts.put("CHA_Customer_02", new Double(1500));
+ checkingAccts.put("CHA_Customer_03", new Double(2000));
+ }
+
+ public double deposit(String accountNo, double depositAmt) {
+ checkingAccts.put(accountNo, new Double(checkingAccts.get(accountNo).doubleValue() + depositAmt));
+ return checkingAccts.get(accountNo).doubleValue();
+ }
+
+ public CheckingAccountDetails getAccountDetails(String customerID) {
+ CheckingAccountDetails checkingAccount = new CheckingAccountDetails();
+ checkingAccount.setAccountNumber(custAcctMap.get(customerID));
+ checkingAccount.setBalance(checkingAccts.get(checkingAccount.getAccountNumber()).doubleValue());
+
+ return checkingAccount;
+ }
+
+ public double withdraw(String accountNo, double withdrawalAmount) {
+ double balance = checkingAccts.get(accountNo).doubleValue();
+ if ( balance - withdrawalAmount > 0 ) {
+ balance = balance - withdrawalAmount;
+ checkingAccts.put(accountNo, balance);
+ }
+ return balance;
+ }
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import java.io.Serializable;
+
+/**
+ * @version $$Rev: 567543 $$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
+ * 2007) $$
+ */
+
+public class SavingsAccountDetails implements Serializable {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String n) {
+ this.accountNumber = n;
+ }
+
+ public double getBalance() {
+ return balance;
+ }
+
+ public void setBalance(double b) {
+ this.balance = b;
+ }
+
+ @Override
+ public String toString() {
+ return accountNumber + ", balance:" + balance;
+ }
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $$Rev: 540764 $$ $$Date: 2007-05-23 03:17:57 +0530 (Wed, 23 May 2007) $$
+ */
+@Remotable
+public interface SavingsAccountService {
+
+ public SavingsAccountDetails getAccountDetails(String customerID);
+
+ public double deposit(String accountNo, double depositAmt);
+
+ public double withdraw(String accountNo, double withdrawalAmount);
+
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(SavingsAccountService.class)
+public class SavingsAccountServiceImpl implements SavingsAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, Double> savingsAccts = new HashMap<String, Double>();
+
+ public SavingsAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "SVA_Customer_01");
+ custAcctMap.put("Customer_02", "SVA_Customer_02");
+ custAcctMap.put("Customer_03", "SVA_Customer_03");
+
+ savingsAccts.put("SVA_Customer_01", new Double(1000));
+ savingsAccts.put("SVA_Customer_02", new Double(1500));
+ savingsAccts.put("SVA_Customer_03", new Double(2000));
+ }
+
+ public double deposit(String accountNo, double depositAmt) {
+ savingsAccts.put(accountNo, new Double(savingsAccts.get(accountNo).doubleValue() + depositAmt));
+ return savingsAccts.get(accountNo).doubleValue();
+ }
+
+ public SavingsAccountDetails getAccountDetails(String customerID) {
+ SavingsAccountDetails savingsAccount = new SavingsAccountDetails();
+ savingsAccount.setAccountNumber(custAcctMap.get(customerID));
+ savingsAccount.setBalance(savingsAccts.get(savingsAccount.getAccountNumber()).doubleValue());
+
+ return savingsAccount;
+ }
+
+ public double withdraw(String accountNo, double withdrawalAmount) {
+ double balance = savingsAccts.get(accountNo).doubleValue();
+ if ( balance - withdrawalAmount > 0 ) {
+ balance = balance - withdrawalAmount;
+ savingsAccts.put(accountNo, balance);
+ }
+ return balance;
+ }
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.stock;
+
+/**
+ * @version $$Rev: 567543 $$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
+ * 2007) $$
+ */
+
+public class StockAccountDetails {
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+
+ public StockAccountDetails() {
+ }
+
+ public StockAccountDetails(String acNo, String symbol, int qty) {
+ this.accountNumber = acNo;
+ this.symbol = symbol;
+ this.quantity = qty;
+ }
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String n) {
+ this.accountNumber = n;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int a) {
+ this.quantity = a;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String s) {
+ this.symbol = s;
+ }
+
+ @Override
+ public String toString() {
+ return accountNumber + ", symbol:" + symbol + ", quantity:" + quantity;
+ }
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.stock;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface StockAccountService {
+
+ public StockAccountDetails getAccountDetails(String customerID);
+
+ public StockAccountDetails buy(String accountNo, String symbol, int quantity);
+
+ public StockAccountDetails sell(String accountNo, String symbol, int quantity);
+
+
+}
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java Wed Dec 26 02:59:46 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.stock;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(StockAccountService.class)
+public class StockAccountServiceImpl implements StockAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, StockAccountDetails> stockAccts = new HashMap<String, StockAccountDetails>();
+
+ public StockAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "STA_Customer_01");
+ custAcctMap.put("Customer_02", "STA_Customer_02");
+ custAcctMap.put("Customer_03", "STA_Customer_03");
+
+ stockAccts.put("STA_Customer_01", new StockAccountDetails("STA_Customer_01", "IBM", 100));
+ stockAccts.put("STA_Customer_02", new StockAccountDetails("STA_Customer_02", "IBM", 200));
+ stockAccts.put("STA_Customer_03", new StockAccountDetails("STA_Customer_03", "SYM_3", 125));
+ }
+
+
+ public StockAccountDetails buy(String accountNo, String symbol, int quantity) {
+ return null;
+ }
+
+ public StockAccountDetails getAccountDetails(String customerID) {
+ return stockAccts.get(custAcctMap.get(customerID));
+ }
+
+ public StockAccountDetails sell(String accountNo, String symbol, int quantity) {
+ return null;
+ }
+
+
+
+}
Modified: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java?rev=606878&r1=606877&r2=606878&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java (original)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java Wed Dec 26 02:59:46 2007
@@ -35,7 +35,7 @@
AccountService accountService = domain.getService(AccountService.class, "AccountServiceComponent");
- String customerID = "1234";
+ String customerID = "Customer_01";
System.out.println("Calling account service for customer: " + customerID);
System.out.println();
Modified: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java?rev=606878&r1=606877&r2=606878&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java (original)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java Wed Dec 26 02:59:46 2007
@@ -33,7 +33,7 @@
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
+ for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
System.out.println(" Usage is SIGNATURE ... ");
Modified: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite?rev=606878&r1=606877&r2=606878&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite (original)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite Wed Dec 26 02:59:46 2007
@@ -21,6 +21,9 @@
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
targetNamespace="http://bigbank"
xmlns:bb="http://bigbank"
+ xmlns:bbsv="http://bigbank/savings"
+ xmlns:bbst="http://bigbank/stock"
+ xmlns:bbck="http://bigbank/checkings"
name="BigBank">
<component name="AccountServiceComponent">
@@ -33,9 +36,14 @@
</service>
<!-- reference name="accountDataService" target="AccountDataServiceComponent"/-->
+ <reference name="savingsAcService" target="SavingsAccountServiceComponent"/>
- <reference name="accountDataService">
- <binding.ws uri="http://localhost:8084/services/AccountDataWebService" requires="tuscany:wsAuthentication"/>
+ <reference name="checkingAcService" requires="tuscany:wsAuthentication">
+ <binding.ws uri="http://localhost:8085/services/CheckingAcWebService"/>
+ </reference>
+
+ <reference name="stockAcService">
+ <binding.ws uri="http://localhost:8086/services/StockAcWebService"/>
</reference>
<reference name="calculatorService">
@@ -57,9 +65,17 @@
<reference name="accountService" target="AccountServiceComponent"/>
</component>
- <component name="AccountDataServiceComponent">
- <implementation.composite name="bb:AccountData"/>
- </component>
+ <component name="SavingsAccountServiceComponent">
+ <implementation.composite name="bbsv:SavingsAccountDept"/>
+ </component>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.composite name="bbck:CheckingsAccountDept"/>
+ </component>
+
+ <component name="StockAccountServiceComponent">
+ <implementation.composite name="bbst:StockAccountDept"/>
+ </component>
<component name="WebResourceComponent">
<tuscany:implementation.resource location="web"/>
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite Wed Dec 26 02:59:46 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank/checkings"
+ xmlns:bbck="http://bigbank/checkings"
+ name="CheckingsAccountDept">
+
+ <service name="CheckingsAccountService" promote="CheckingAccountServiceComponent" requires="authentication">
+ <interface.java interface="bigbank.account.checking.CheckingAccountService"/>
+ <binding.ws uri="http://localhost:8085/services/CheckingAcWebService"/>
+ </service>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.java class="bigbank.account.checking.CheckingAccountServiceImpl"/>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite Wed Dec 26 02:59:46 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank/savings"
+ xmlns:bbsv="http://bigbank/savings"
+ name="SavingsAccountDept">
+
+ <service name="SavingsAccountService" promote="SavingsAccountServiceComponent">
+ <interface.java interface="bigbank.account.savings.SavingsAccountService"/>
+ </service>
+
+ <component name="SavingsAccountServiceComponent">
+ <implementation.java class="bigbank.account.savings.SavingsAccountServiceImpl"/>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite?rev=606878&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite (added)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite Wed Dec 26 02:59:46 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank/stock"
+ xmlns:bbst="http://bigbank/stock"
+ name="StockAccountDept">
+
+ <service name="StockAccountService" promote="StockAccountServiceComponent">
+ <interface.java interface="bigbank.account.stock.StockAccountService"/>
+ <binding.ws uri="http://localhost:8086/services/StockAcWebService"/>
+ </service>
+
+ <component name="StockAccountServiceComponent">
+ <implementation.java class="bigbank.account.stock.StockAccountServiceImpl"/>
+ </component>
+
+</composite>
Modified: incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html?rev=606878&r1=606877&r2=606878&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html (original)
+++ incubator/tuscany/java/sca/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html Wed Dec 26 02:59:46 2007
@@ -63,7 +63,7 @@
<tr>
<td><br>
<button id="myaccount" dojoType="dijit.form.Button"
- onClick='accountService.getAccountReport("Dojo1234").addCallback(contentCallBack);'>getAccountReport("Dojo1234")</button>
+ onClick='accountService.getAccountReport("Customer_01").addCallback(contentCallBack);'>getAccountReport("Customer_01")</button>
<br>
</td>
<td>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org