summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account')
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountService.java32
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java99
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java50
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java35
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java66
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/feed/AccountFeedImpl.java94
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java52
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java35
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java66
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java68
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java36
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java60
12 files changed, 693 insertions, 0 deletions
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountService.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..1ae9c9f682
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $$Rev: 573144 $$ $$Date: 2007-09-06 09:25:24 +0530 (Thu, 06 Sep 2007) $$
+ */
+
+@Remotable
+public interface AccountService {
+
+ public double getAccountReport(String customerID);
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..aca34669cc
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/AccountServiceImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import stockquote.StockQuoteService;
+import bigbank.account.checking.CheckingAccountDetails;
+import bigbank.account.checking.CheckingAccountService;
+import bigbank.account.savings.SavingsAccountDetails;
+import bigbank.account.savings.SavingsAccountService;
+import bigbank.account.stock.StockAccountDetails;
+import bigbank.account.stock.StockAccountService;
+import calculator.CalculatorService;
+
+/**
+ * @version $$Rev: 540764 $$ $$Date: 2007-05-23 03:17:57 +0530 (Wed, 23 May 2007) $$
+ */
+
+@Service(AccountService.class)
+public class AccountServiceImpl implements AccountService {
+
+ @Reference
+ protected SavingsAccountService savingsAcService;
+
+ @Reference
+ protected CheckingAccountService checkingAcService;
+
+ @Reference
+ protected StockAccountService stockAcService;
+
+ @Reference
+ protected StockQuoteService stockQuoteService;
+
+ @Reference
+ protected CalculatorService calculatorService;
+
+ @Property
+ protected String currency;
+
+ public double getAccountReport(String customerID) {
+
+ // Get the checking, savings and stock accounts from the AccountData
+ // service component
+ CheckingAccountDetails checking = null;
+ try {
+ checking = checkingAcService.getAccountDetails(customerID);
+ System.out.println("Checking account: " + checking);
+
+ SavingsAccountDetails savings = savingsAcService.getAccountDetails(customerID);
+ System.out.println("Savings account: " + savings);
+
+ StockAccountDetails stock = stockAcService.getAccountDetails(customerID);
+ System.out.println("Stock account: " + stock);
+
+ // Get the stock price in USD
+ double price = stockQuoteService.getQuote(stock.getSymbol());
+ System.out.println("Stock price for " + stock.getSymbol() + ": " + price);
+
+ // Convert to the configured currency
+ if (currency.equals("EURO")) {
+
+ // Use our fancy calculator service to convert to the target currency
+ price = calculatorService.multiply(price, 0.70);
+
+ System.out.println("Converted to " + currency + ": " + price);
+ }
+
+ // Calculate the value of the stock account
+ double stockValue = price * stock.getQuantity();
+
+ // Calculate the total balance of all accounts and return it
+ double balance = checking.getBalance() + savings.getBalance() + stockValue;
+
+ return balance;
+ } catch ( Throwable e ) {
+ e.printStackTrace();
+ return 0;
+ }
+ }
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
new file mode 100644
index 0000000000..2a1d26a275
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+/**
+ * @version $$Rev: 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;
+ }
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java
new file mode 100644
index 0000000000..7017cc076c
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.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);
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
new file mode 100644
index 0000000000..a18a4920b8
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(CheckingAccountService.class)
+public class CheckingAccountServiceImpl implements CheckingAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, Double> checkingAccts = new HashMap<String, Double>();
+
+ public CheckingAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "CHA_Customer_01");
+ custAcctMap.put("Customer_02", "CHA_Customer_02");
+ custAcctMap.put("Customer_03", "CHA_Customer_03");
+
+ checkingAccts.put("CHA_Customer_01", new Double(1000));
+ checkingAccts.put("CHA_Customer_02", new Double(1500));
+ checkingAccts.put("CHA_Customer_03", new Double(2000));
+ }
+
+ public double deposit(String accountNo, double depositAmt) {
+ checkingAccts.put(accountNo, new Double(checkingAccts.get(accountNo).doubleValue() + depositAmt));
+ return checkingAccts.get(accountNo).doubleValue();
+ }
+
+ public CheckingAccountDetails getAccountDetails(String customerID) {
+ CheckingAccountDetails checkingAccount = new CheckingAccountDetails();
+ checkingAccount.setAccountNumber(custAcctMap.get(customerID));
+ checkingAccount.setBalance(checkingAccts.get(checkingAccount.getAccountNumber()).doubleValue());
+
+ return checkingAccount;
+ }
+
+ public double withdraw(String accountNo, double withdrawalAmount) {
+ double balance = checkingAccts.get(accountNo).doubleValue();
+ if ( balance - withdrawalAmount > 0 ) {
+ balance = balance - withdrawalAmount;
+ checkingAccts.put(accountNo, balance);
+ }
+ return balance;
+ }
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/feed/AccountFeedImpl.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/feed/AccountFeedImpl.java
new file mode 100644
index 0000000000..4c9decf5c6
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/feed/AccountFeedImpl.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.feed;
+
+import java.util.Collections;
+
+import org.apache.tuscany.sca.binding.feed.collection.Collection;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import bigbank.account.AccountService;
+
+import com.sun.syndication.feed.atom.Content;
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.feed.atom.Link;
+
+/**
+ * @version $$Rev: 592280 $$ $$Date: 2007-11-06 10:29:48 +0530 (Tue, 06 Nov 2007) $$
+ */
+
+@Service(Collection.class)
+public class AccountFeedImpl implements Collection {
+
+ @Reference
+ protected AccountService accountService;
+
+ @SuppressWarnings("unchecked")
+ public com.sun.syndication.feed.atom.Feed getFeed() {
+
+ // Create a new Feed
+ Feed feed = new Feed();
+ feed.setId("accounts");
+ feed.setTitle("Account Report Feed");
+ Content subtitle = new Content();
+ subtitle.setValue("This is a sample feed");
+ feed.setSubtitle(subtitle);
+ Link link = new Link();
+ link.setHref("http://incubator.apache.org/tuscany");
+ feed.getAlternateLinks().add(link);
+
+ // Add the Account report entry
+ Entry entry = get("1234");
+ feed.getEntries().add(entry);
+
+ return feed;
+ }
+
+ public void delete(String id) {
+ }
+
+ public Entry get(String id) {
+
+ // Get the account report for the specified customer ID
+ double balance = accountService.getAccountReport(id);
+ String value = Double.toString(balance);
+
+ Entry entry = new Entry();
+ entry.setId("account-" + id);
+ entry.setTitle("Account Report Entry");
+ Content summary = new Content();
+ summary.setType(Content.HTML);
+ summary.setValue("This is your account report: <b>" + value + "</b>");
+ entry.setSummary(summary);
+ Content content = new Content();
+ content.setValue(value);
+ entry.setContents(Collections.singletonList(content));
+ return entry;
+ }
+
+ public Entry post(Entry entry) {
+ return null;
+ }
+
+ public void put(String id, Entry entry) {
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java
new file mode 100644
index 0000000000..815b26dc4c
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import java.io.Serializable;
+
+/**
+ * @version $$Rev: 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;
+ }
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java
new file mode 100644
index 0000000000..b7f375e859
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $$Rev: 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);
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java
new file mode 100644
index 0000000000..fc01bc90c0
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(SavingsAccountService.class)
+public class SavingsAccountServiceImpl implements SavingsAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, Double> savingsAccts = new HashMap<String, Double>();
+
+ public SavingsAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "SVA_Customer_01");
+ custAcctMap.put("Customer_02", "SVA_Customer_02");
+ custAcctMap.put("Customer_03", "SVA_Customer_03");
+
+ savingsAccts.put("SVA_Customer_01", new Double(1000));
+ savingsAccts.put("SVA_Customer_02", new Double(1500));
+ savingsAccts.put("SVA_Customer_03", new Double(2000));
+ }
+
+ public double deposit(String accountNo, double depositAmt) {
+ savingsAccts.put(accountNo, new Double(savingsAccts.get(accountNo).doubleValue() + depositAmt));
+ return savingsAccts.get(accountNo).doubleValue();
+ }
+
+ public SavingsAccountDetails getAccountDetails(String customerID) {
+ SavingsAccountDetails savingsAccount = new SavingsAccountDetails();
+ savingsAccount.setAccountNumber(custAcctMap.get(customerID));
+ savingsAccount.setBalance(savingsAccts.get(savingsAccount.getAccountNumber()).doubleValue());
+
+ return savingsAccount;
+ }
+
+ public double withdraw(String accountNo, double withdrawalAmount) {
+ double balance = savingsAccts.get(accountNo).doubleValue();
+ if ( balance - withdrawalAmount > 0 ) {
+ balance = balance - withdrawalAmount;
+ savingsAccts.put(accountNo, balance);
+ }
+ return balance;
+ }
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java
new file mode 100644
index 0000000000..22eac41cc6
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.stock;
+
+/**
+ * @version $$Rev: 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;
+ }
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java
new file mode 100644
index 0000000000..f4503ff672
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.stock;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface StockAccountService {
+
+ public StockAccountDetails getAccountDetails(String customerID);
+
+ public StockAccountDetails buy(String accountNo, String symbol, int quantity);
+
+ public StockAccountDetails sell(String accountNo, String symbol, int quantity);
+
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java
new file mode 100644
index 0000000000..505bff8826
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.stock;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(StockAccountService.class)
+public class StockAccountServiceImpl implements StockAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, StockAccountDetails> stockAccts = new HashMap<String, StockAccountDetails>();
+
+ public StockAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "STA_Customer_01");
+ custAcctMap.put("Customer_02", "STA_Customer_02");
+ custAcctMap.put("Customer_03", "STA_Customer_03");
+
+ stockAccts.put("STA_Customer_01", new StockAccountDetails("STA_Customer_01", "IBM", 100));
+ stockAccts.put("STA_Customer_02", new StockAccountDetails("STA_Customer_02", "IBM", 200));
+ stockAccts.put("STA_Customer_03", new StockAccountDetails("STA_Customer_03", "SYM_3", 125));
+ }
+
+
+ public StockAccountDetails buy(String accountNo, String symbol, int quantity) {
+ return null;
+ }
+
+ public StockAccountDetails getAccountDetails(String customerID) {
+ return stockAccts.get(custAcctMap.get(customerID));
+ }
+
+ public StockAccountDetails sell(String accountNo, String symbol, int quantity) {
+ return null;
+ }
+
+
+
+}