summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main')
-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
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java50
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/demo/BigBankServer.java51
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java54
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankCheckingsAcl.java48
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java51
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthPolicy.java27
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyHandler.java65
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyProcessor.java81
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/calculator/CalculatorService.java34
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/stockquote/StockQuoteService.java29
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite87
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite33
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler20
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite33
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite34
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/bbaccount.jksbin0 -> 1993 bytes
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/definitions.xml137
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/security.properties4
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html92
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/style.css22
-rw-r--r--branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/wsdl/AccountService.wsdl91
34 files changed, 1755 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;
+ }
+
+
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java
new file mode 100644
index 0000000000..d5ebff5f13
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/client/BigBankClient.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.client;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("BigBank.composite");
+
+ AccountService accountService = domain.getService(AccountService.class, "AccountServiceComponent");
+
+ String customerID = "Customer_01";
+
+ System.out.println("Calling account service for customer: " + customerID);
+ System.out.println();
+ double balance = accountService.getAccountReport(customerID);
+
+ System.out.println();
+ System.out.println("Balance: " + balance);
+
+ domain.close();
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/demo/BigBankServer.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/demo/BigBankServer.java
new file mode 100644
index 0000000000..cb8da15686
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/demo/BigBankServer.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.demo;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankServer {
+
+ public static void main(String[] args) throws Exception {
+ long timeout = -1L;
+ if (args.length > 0) {
+ timeout = Long.parseLong(args[0]);
+ }
+ System.out.println("Starting the Sample SCA BigBank server...");
+
+ SCADomain domain = SCADomain.newInstance("BigBank.composite");
+
+ if (timeout < 0) {
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+ } else {
+ Thread.sleep(timeout);
+ }
+
+ domain.close();
+
+ System.out.println("Bye");
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java
new file mode 100644
index 0000000000..2e34fc6865
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/AccountsDataPasswordCallbackHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class AccountsDataPasswordCallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ System.out.println(" Usage is SIGNATURE ... ");
+ pwcb.setPassword("bbservice");
+ } else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) {
+ System.out.println("*** Calling ACCOUNTS-DATA Passwd Handler for AUTHENTICATING userID = "
+ + pwcb.getIdentifer() + " and password = " + pwcb.getPassword() );
+ if ( pwcb.getIdentifer().equals("bbaservice") && pwcb.getPassword().equals("bbaservice")) {
+ System.out.println("AUTHENTICATION SUCCESSFUL!");
+ } else {
+ System.out.println("AUTHENTICATION FAILED!");
+ throw new UnsupportedCallbackException(pwcb, "UserId - Password Authentication Failed!");
+ }
+ }
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankCheckingsAcl.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankCheckingsAcl.java
new file mode 100644
index 0000000000..272999ae98
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankCheckingsAcl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.security;
+
+import java.security.Principal;
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BigbankCheckingsAcl {
+ private static Map<String, String>checkingsAcl = new Hashtable<String, String>();
+
+ static {
+ checkingsAcl.put("bbaservice", "Customer_01");
+ checkingsAcl.put("bbUser01", "Customer_01");
+ }
+
+
+ public static void authorize(Principal principal, String resource) {
+ if ( checkingsAcl.get(principal.getName()) == null ||
+ !checkingsAcl.get(principal.getName()).equals(resource) ) {
+ throw new RuntimeException("User - " + principal.getName() + " not authorized to access account " +
+ resource);
+ } else {
+ System.out.println("Successfully Authorized '" + principal.getName() + " to access accounts of " + resource);
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java
new file mode 100644
index 0000000000..c21a4fec5c
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class BigbankPasswordCallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ //System.out.println("*** Getting password for user ...." + pwcb.getIdentifer() + " & " + pwcb.getKey());
+ if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ System.out.println("*** Calling BIG-BANK Passwd Handler for SIGNING...." );
+ pwcb.setPassword("bbservice");
+ } else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) {
+ if ( pwcb.getIdentifer().equals("bbaservice")) {
+ System.out.println("*** Calling BIG-BANK Passwd Handler for setting AUTHENTICATION password...." );
+ pwcb.setPassword("bbaservice");
+ }
+ }
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthPolicy.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthPolicy.java
new file mode 100644
index 0000000000..27a1f93374
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthPolicy.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.security;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckingsDeptAuthPolicy {
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyHandler.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyHandler.java
new file mode 100644
index 0000000000..c0882b822b
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyHandler.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.security;
+
+import java.security.Principal;
+
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... context) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( int count = 0 ; count < context.length ; ++count ) {
+ if ( context[count] instanceof Message ) {
+ Message msg = (Message)context[count];
+ Object args[] = (Object[])msg.getBody();
+ if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) {
+ BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL),
+ (String)args[0]);
+ }
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return this.applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet policySet) {
+ this.applicablePolicySet = policySet;
+ }
+
+ public void setUp(Object... arg0) {
+
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyProcessor.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyProcessor.java
new file mode 100644
index 0000000000..7f22e2e141
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/bigbank/security/CheckingsDeptAuthorizationPolicyProcessor.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.security;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.logging.Level;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * @author administrator
+ *
+ */
+public class CheckingsDeptAuthorizationPolicyProcessor implements StAXArtifactProcessor<CheckingsDeptAuthPolicy> {
+ private static final QName CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME = new QName("http://bigbank/checkings", "AuthPolicy");
+ private static final String callbackHandler = "callbackHandler";
+ public static final QName CALLBACK_HANDLER_QNAME = new QName(Constants.SCA10_TUSCANY_NS,
+ callbackHandler);
+ public QName getArtifactType() {
+ return CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME;
+ }
+
+ public CheckingsDeptAuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+
+ public CheckingsDeptAuthPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ CheckingsDeptAuthPolicy policy = new CheckingsDeptAuthPolicy();
+ return policy;
+ }
+
+ public void write(CheckingsDeptAuthPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ String prefix = "tuscany";
+ writer.writeStartElement(prefix,
+ CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getLocalPart(),
+ CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getNamespaceURI());
+ writer.writeNamespace("chk", "http://bigbank/checkings");
+
+
+ writer.writeEndElement();
+ }
+
+ public Class<CheckingsDeptAuthPolicy> getModelType() {
+ return CheckingsDeptAuthPolicy.class;
+ }
+
+ public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/calculator/CalculatorService.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..f5df6a42e8
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/stockquote/StockQuoteService.java b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..aa6eded59a
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/java/stockquote/StockQuoteService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+ public double getQuote(String symbol);
+}
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..4462b52250
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/BigBank.composite
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank"
+ xmlns:bb="http://bigbank"
+ xmlns:bbsv="http://bigbank/savings"
+ xmlns:bbst="http://bigbank/stock"
+ xmlns:bbck="http://bigbank/checkings"
+ name="BigBank">
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.AccountServiceImpl"/>
+
+ <service name="AccountService">
+ <tuscany:binding.jsonrpc uri="/AccountJSONService"/>
+ <binding.ws wsdlElement="http://bigbank#wsdl.port(AccountService/AccountServiceSoap)"/>
+ <binding.sca/>
+ </service>
+
+ <!-- reference name="accountDataService" target="AccountDataServiceComponent"/-->
+ <reference name="savingsAcService" target="SavingsAccountServiceComponent"/>
+
+ <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">
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="stockQuoteService" requires="integrity">
+ <binding.ws uri="http://localhost:8081/services/StockQuoteWebService"/>
+ </reference>
+
+ <property name="currency">EURO</property>
+ </component>
+
+ <component name="AccountFeedComponent">
+ <implementation.java class="bigbank.account.feed.AccountFeedImpl"/>
+ <service name="Collection">
+ <tuscany:binding.rss uri="/rss"/>
+ <tuscany:binding.atom uri="/atom"/>
+ </service>
+ <reference name="accountService" target="AccountServiceComponent"/>
+ </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"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="/"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite
new file mode 100644
index 0000000000..18431b10fa
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/CheckingsAccount.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://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" requires="bbck:chkDeptAuthorization"/>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..4606ab9636
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+bigbank.security.CheckingsDeptAuthorizationPolicyProcessor;qname=http://bigbank/checkings#AuthPolicy,model=bigbank.security.CheckingsDeptAuthPolicy
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..4b15ad55d1
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+bigbank.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbank/checkings#chkDeptAuthorization,model=bigbank.security.CheckingsDeptAuthPolicy
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite
new file mode 100644
index 0000000000..6aedc2387e
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/SavingsAccount.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://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>
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite
new file mode 100644
index 0000000000..94f6491704
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/StockAccount.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank/stock"
+ xmlns:bbst="http://bigbank/stock"
+ 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>
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/bbaccount.jks b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/bbaccount.jks
new file mode 100644
index 0000000000..daa3cc8009
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/bbaccount.jks
Binary files differ
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/definitions.xml b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..2280bca950
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/definitions.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:chk="http://bigbank/checkings"
+ xmlns:bb="http://bigbank">
+
+ <sca:intent name="soap"
+ constrains="sca:binding.ws">
+ <sca:description>
+ Communitcation thro this binding requires SOAP
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="soap11"
+ constrains="sca:binding.ws">
+ <sca:description>
+ Communitcation thro this binding requires SOAP 1.1
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="soap12"
+ constrains="sca:binding.ws">
+ <sca:description>
+ Communitcation thro this binding requires SOAP 1.2
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="integrity"
+ constrains="sca:binding.ws">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </sca:intent>
+
+ <sca:intent name="authentication"
+ constrains="sca:binding.ws">
+ <description>
+ Communitcation thro this binding required Authentication.
+ </description>
+ </sca:intent>
+
+ <sca:intent name="tuscany:wsAuthentication"
+ constrains="sca:binding.ws">
+ <description>
+ Communitcation thro this binding required Authentication.
+ </description>
+ </sca:intent>
+
+ <sca:intent name="chk:chkDeptAuthorization"
+ constrains="sca:implementation.java">
+ <description>
+ Authorization enforced by checkings dept of bigbank
+ </description>
+ </sca:intent>
+
+
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="tuscany:wsIntegrityPolicy"
+ provides="integrity"
+ appliesTo="sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <signaturePropFile>security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <user>bbservice</user>
+ <signaturePropFile>security.properties</signaturePropFile>
+ <passwordCallbackClass>bigbank.security.BigbankPasswordCallbackHandler</passwordCallbackClass>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:wsAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>bigbank.security.AccountsDataPasswordCallbackHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:wsClientAuthenticationPolicy"
+ provides="tuscany:wsAuthentication"
+ appliesTo="sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <user>bbaservice</user>
+ <passwordCallbackClass>bigbank.security.BigbankPasswordCallbackHandler</passwordCallbackClass>
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="chk:chkDeptAuthorizationPolicy"
+ provides="chk:chkDeptAuthorization"
+ appliesTo="sca:implementation.java">
+ <chk:AuthPolicy>
+ <!-- need to evolve what should go in here -->
+ </chk:AuthPolicy>
+ </sca:policySet>
+
+</sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/security.properties b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/security.properties
new file mode 100644
index 0000000000..7e41ae347c
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/security.properties
@@ -0,0 +1,4 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=bbakeystore
+org.apache.ws.security.crypto.merlin.file=bbaccount.jks \ No newline at end of file
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html
new file mode 100644
index 0000000000..5b57126362
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/AccountJSON.html
@@ -0,0 +1,92 @@
+<html>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<head>
+<title>Tuscany JSON-RPC BigBank Client</TITLE>
+
+<script type="text/javascript">
+ var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
+ djConfig.usePlainJson=true ;
+ //djConfig.debugAtAllCosts = true;
+ </script>
+<script type="text/javascript" src="dojo/dojo/dojo.js">
+ </script>
+<script type="text/javascript" src="dojo/dijit/dijit.js">
+ </script>
+
+<script type="text/javascript">
+ dojo.require("dijit.form.Button");
+ dojo.require("dojo.rpc.JsonService");
+ </script>
+
+<link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body>
+
+<table>
+ <tr>
+ <th colspan="2">Tuscany JSON-RPC BigBank Client</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p>This example uses the <a href="http://dojotoolkit.org/">Dojo
+ Toolkit</a> to create a JavaScript object <code>accountService</code> for
+ the service at <b>http://localhost:8080/AccountJSONService</b> using <a
+ href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9">Dojo's
+ RPC classes</a> and providing them with <a href="AccountJSONService?smd">http://localhost:8080/AccountJSONService?smd</a>
+ for <a href="http://dojo.jot.com/SMD">Simple Method Description
+ (SMD)</a> input.</p>
+ <p>It then creates a Dojo button that will envoke the <code>getAccountReport</code>
+ method of the <code>accountService</code> object.</p>
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td><br>
+ <button id="myaccount" dojoType="dijit.form.Button"
+ onClick='accountService.getAccountReport("Customer_01").addCallback(contentCallBack);'>getAccountReport("Customer_01")</button>
+ <br>
+ </td>
+ <td>
+ <div id="ReturnedContent">None Yet.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div id="dojoDebug">Dojo Debug:</div>
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+
+ function contentCallBack(result) {
+ var handlerNode = document.getElementById("ReturnedContent");
+ handlerNode.innerHTML = "<p>" + result + "</p>" ;
+ }
+
+ var accountService = new dojo.rpc.JsonService("AccountJSONService?smd");
+
+ </script>
+
+</body>
+</html>
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/style.css b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/style.css
new file mode 100644
index 0000000000..1071583264
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/style.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+* { font-family: arial; }
+
+table, th, td { border: 2px solid blue; border-collapse: collapse; }
+th { color: white; background-color: blue; }
diff --git a/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/wsdl/AccountService.wsdl b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..21c3c97ec8
--- /dev/null
+++ b/branches/sca-java-1.1/demos/secure-bigbank/secure-bigbank-account/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://bigbank"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://bigbank"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://bigbank"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:double" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest" />
+ <wsdl:output message="tns:getAccountReportResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AccountServiceSoap" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSoap"
+ name="AccountServiceSoap">
+ <soap:address
+ location="http://localhost:8082/services/AccountWebService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>