From 7d34713fecd6b842bb4abd78f3bbc5bac6dad3bf Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 29 Aug 2008 08:31:14 +0000 Subject: Branch for 1.3.2 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@690149 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca-java-1.3.2/demos/bigbank-account/LICENSE | 205 ++++++++ .../sca-java-1.3.2/demos/bigbank-account/NOTICE | 6 + .../sca-java-1.3.2/demos/bigbank-account/README | 4 + .../demos/bigbank-account/bigbank.png | Bin 0 -> 100070 bytes .../demos/bigbank-account/bigbank.svg | 537 +++++++++++++++++++++ .../demos/bigbank-account/build-dojo.xml | 92 ++++ .../sca-java-1.3.2/demos/bigbank-account/build.xml | 85 ++++ .../sca-java-1.3.2/demos/bigbank-account/pom.xml | 71 +++ .../account/checking/CheckingAccountDetails.java | 50 ++ .../account/checking/CheckingAccountService.java | 37 ++ .../checking/CheckingAccountServiceImpl.java | 66 +++ .../account/savings/SavingsAccountDetails.java | 52 ++ .../account/savings/SavingsAccountService.java | 35 ++ .../account/savings/SavingsAccountServiceImpl.java | 66 +++ .../AccountsDataPasswordCallbackHandler.java | 54 +++ .../account/security/BigbankCheckingsAcl.java | 48 ++ ...ckingsDeptAuthImplementationPolicyProvider.java | 90 ++++ .../account/security/CheckingsDeptAuthPolicy.java | 46 ++ .../CheckingsDeptAuthPolicyInterceptor.java | 77 +++ .../CheckingsDeptAuthPolicyProviderFactory.java | 75 +++ .../CheckingsDeptAuthorizationPolicyHandler.java | 65 +++ .../CheckingsDeptAuthorizationPolicyProcessor.java | 72 +++ .../bigbank/account/stock/StockAccountDetails.java | 68 +++ .../bigbank/account/stock/StockAccountService.java | 36 ++ .../account/stock/StockAccountServiceImpl.java | 60 +++ .../src/main/resources/CheckingsAccount.composite | 35 ++ .../main/resources/META-INF/sca-contribution.xml | 42 ++ ...ca.contribution.processor.StAXArtifactProcessor | 19 + ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 20 + ...ache.tuscany.sca.provider.PolicyProviderFactory | 19 + .../src/main/resources/SavingsAccount.composite | 34 ++ .../src/main/resources/StockAccount.composite | 34 ++ .../src/main/resources/definitions.xml | 58 +++ .../src/main/resources/web/AccountJSON.html | 92 ++++ .../src/main/resources/web/style.css | 22 + .../src/main/resources/wsdl/AccountService.wsdl | 91 ++++ 36 files changed, 2463 insertions(+) create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/LICENSE create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/NOTICE create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/README create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/bigbank.png create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/bigbank.svg create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/build-dojo.xml create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/build.xml create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/pom.xml create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/CheckingsAccount.composite create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/SavingsAccount.composite create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/StockAccount.composite create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/definitions.xml create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/style.css create mode 100644 branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl (limited to 'branches/sca-java-1.3.2/demos/bigbank-account') diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/LICENSE b/branches/sca-java-1.3.2/demos/bigbank-account/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/LICENSE @@ -0,0 +1,205 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/NOTICE b/branches/sca-java-1.3.2/demos/bigbank-account/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/README b/branches/sca-java-1.3.2/demos/bigbank-account/README new file mode 100644 index 0000000000..5c0d850c5e --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/README @@ -0,0 +1,4 @@ +bigbank-account is part of a larger demo called bigbank. +Please see the Readme file under bigbank to understand how bigbank-account fits into the overall demo. + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/bigbank.png b/branches/sca-java-1.3.2/demos/bigbank-account/bigbank.png new file mode 100644 index 0000000000..985cc6bd05 Binary files /dev/null and b/branches/sca-java-1.3.2/demos/bigbank-account/bigbank.png differ diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/bigbank.svg b/branches/sca-java-1.3.2/demos/bigbank-account/bigbank.svg new file mode 100644 index 0000000000..0650075d48 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/bigbank.svg @@ -0,0 +1,537 @@ + + + + + + + + + + image/svg+xml + + + + + + + + CompositeBigBank WebApp + + Component AccountJava + + + + Component AccountDataJava + binding.jsonrpc + binding.ws + binding.rmi + + + + CompositeStockQuote + + CompositeCalculator + + Component CalculatorJava + + + + Component AddJavascript + binding.rmi + + + Component SubtractRuby + + Component MultiplyPython + + Component DivideGroovy + + + + Component StockQuoteJava + + binding.ws + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/build-dojo.xml b/branches/sca-java-1.3.2/demos/bigbank-account/build-dojo.xml new file mode 100644 index 0000000000..0e029c6335 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/build.xml b/branches/sca-java-1.3.2/demos/bigbank-account/build.xml new file mode 100644 index 0000000000..3c324030e5 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/build.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/pom.xml b/branches/sca-java-1.3.2/demos/bigbank-account/pom.xml new file mode 100644 index 0000000000..158fa06170 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-demos + 1.3.1-SNAPSHOT + ../pom.xml + + demo-bigbank-account + jar + Apache Tuscany SCA BigBank Account Demo + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-core-spi + 1.3.1-SNAPSHOT + + + + + org.apache.ws.security + wss4j + 1.5.3 + + + + + demo-bigbank-account + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java new file mode 100644 index 0000000000..57c1adcba0 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +/** + * @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr + * 2007) $$ + */ + +public class CheckingAccountDetails { + private String accountNumber; + private double balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public double getBalance() { + return balance; + } + + public void setBalance(double b) { + this.balance = b; + } + + @Override + public String toString() { + return accountNumber + ", balance:" + balance; + } +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java new file mode 100644 index 0000000000..bf919525c4 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Service +@Remotable +public interface CheckingAccountService { + + public CheckingAccountDetails getAccountDetails(String customerID); + + public double deposit(String accountNo, double depositAmt); + + public double withdraw(String accountNo, double withdrawalAmount); + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java new file mode 100644 index 0000000000..0ed4b1dd2e --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Service; + +/** + * + * */ + +@Service(CheckingAccountService.class) +public class CheckingAccountServiceImpl implements CheckingAccountService { + private Map custAcctMap = new HashMap(); + private Map checkingAccts = new HashMap(); + + public CheckingAccountServiceImpl() { + custAcctMap.put("Customer_01", "CHA_Customer_01"); + custAcctMap.put("Customer_02", "CHA_Customer_02"); + custAcctMap.put("Customer_03", "CHA_Customer_03"); + + checkingAccts.put("CHA_Customer_01", new Double(1000)); + checkingAccts.put("CHA_Customer_02", new Double(1500)); + checkingAccts.put("CHA_Customer_03", new Double(2000)); + } + + public double deposit(String accountNo, double depositAmt) { + checkingAccts.put(accountNo, new Double(checkingAccts.get(accountNo).doubleValue() + depositAmt)); + return checkingAccts.get(accountNo).doubleValue(); + } + + public CheckingAccountDetails getAccountDetails(String customerID) { + CheckingAccountDetails checkingAccount = new CheckingAccountDetails(); + checkingAccount.setAccountNumber(custAcctMap.get(customerID)); + checkingAccount.setBalance(checkingAccts.get(checkingAccount.getAccountNumber()).doubleValue()); + + return checkingAccount; + } + + public double withdraw(String accountNo, double withdrawalAmount) { + double balance = checkingAccts.get(accountNo).doubleValue(); + if ( balance - withdrawalAmount > 0 ) { + balance = balance - withdrawalAmount; + checkingAccts.put(accountNo, balance); + } + return balance; + } +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java new file mode 100644 index 0000000000..cc9023da60 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import java.io.Serializable; + +/** + * @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr + * 2007) $$ + */ + +public class SavingsAccountDetails implements Serializable { + private String accountNumber; + private double balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public double getBalance() { + return balance; + } + + public void setBalance(double b) { + this.balance = b; + } + + @Override + public String toString() { + return accountNumber + ", balance:" + balance; + } +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java new file mode 100644 index 0000000000..5bf6e6d26b --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import org.osoa.sca.annotations.Remotable; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Remotable +public interface SavingsAccountService { + + public SavingsAccountDetails getAccountDetails(String customerID); + + public double deposit(String accountNo, double depositAmt); + + public double withdraw(String accountNo, double withdrawalAmount); + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java new file mode 100644 index 0000000000..1f4f02ea6d --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Service; + +/** + * + * */ + +@Service(SavingsAccountService.class) +public class SavingsAccountServiceImpl implements SavingsAccountService { + private Map custAcctMap = new HashMap(); + private Map savingsAccts = new HashMap(); + + public SavingsAccountServiceImpl() { + custAcctMap.put("Customer_01", "SVA_Customer_01"); + custAcctMap.put("Customer_02", "SVA_Customer_02"); + custAcctMap.put("Customer_03", "SVA_Customer_03"); + + savingsAccts.put("SVA_Customer_01", new Double(1000)); + savingsAccts.put("SVA_Customer_02", new Double(1500)); + savingsAccts.put("SVA_Customer_03", new Double(2000)); + } + + public double deposit(String accountNo, double depositAmt) { + savingsAccts.put(accountNo, new Double(savingsAccts.get(accountNo).doubleValue() + depositAmt)); + return savingsAccts.get(accountNo).doubleValue(); + } + + public SavingsAccountDetails getAccountDetails(String customerID) { + SavingsAccountDetails savingsAccount = new SavingsAccountDetails(); + savingsAccount.setAccountNumber(custAcctMap.get(customerID)); + savingsAccount.setBalance(savingsAccts.get(savingsAccount.getAccountNumber()).doubleValue()); + + return savingsAccount; + } + + public double withdraw(String accountNo, double withdrawalAmount) { + double balance = savingsAccts.get(accountNo).doubleValue(); + if ( balance - withdrawalAmount > 0 ) { + balance = balance - withdrawalAmount; + savingsAccts.put(accountNo, balance); + } + return balance; + } +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java new file mode 100644 index 0000000000..579b4ee64b --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.security; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class AccountsDataPasswordCallbackHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { + System.out.println(" Usage is SIGNATURE ... "); + pwcb.setPassword("bbservice"); + } else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) { + System.out.println("*** Calling ACCOUNTS-DATA Passwd Handler for AUTHENTICATING userID = " + + pwcb.getIdentifer() + " and password = " + pwcb.getPassword() ); + if ( pwcb.getIdentifer().equals("bbaservice") && pwcb.getPassword().equals("bbaservice")) { + System.out.println("AUTHENTICATION SUCCESSFUL!"); + } else { + System.out.println("AUTHENTICATION FAILED!"); + throw new UnsupportedCallbackException(pwcb, "UserId - Password Authentication Failed!"); + } + } + } + } + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java new file mode 100644 index 0000000000..5c64e11d10 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import java.security.Principal; +import java.util.Hashtable; +import java.util.Map; + +/** + * @version $Rev$ $Date$ + */ +public class BigbankCheckingsAcl { + private static MapcheckingsAcl = new Hashtable(); + + static { + checkingsAcl.put("bbaservice", "Customer_01"); + checkingsAcl.put("bbUser01", "Customer_01"); + } + + + public static void authorize(Principal principal, String resource) { + if ( checkingsAcl.get(principal.getName()) == null || + !checkingsAcl.get(principal.getName()).equals(resource) ) { + throw new RuntimeException("User - " + principal.getName() + " not authorized to access account " + + resource); + } else { + System.out.println("Successfully Authorized '" + principal.getName() + " to access accounts of " + resource); + } + } + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java new file mode 100644 index 0000000000..c98dcacbf3 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import org.apache.tuscany.sca.assembly.ConfiguredOperation; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.OperationsConfigurator; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.provider.PolicyProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * @version $Rev$ $Date$ + */ +public class CheckingsDeptAuthImplementationPolicyProvider implements PolicyProvider { + private RuntimeComponent component; + private Implementation implementation; + + public CheckingsDeptAuthImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { + super(); + this.component = component; + this.implementation = implementation; + } + + private String getContext() { + return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")"; + } + + private PolicySet findPolicySet(Operation operation) { + for (PolicySet ps : component.getPolicySets()) { + for (Object p : ps.getPolicies()) { + if (CheckingsDeptAuthPolicy.class.isInstance(p)) { + return ps; + } + } + } + + if ( component instanceof OperationsConfigurator ) { + for ( ConfiguredOperation confOp : ((OperationsConfigurator)component).getConfiguredOperations() ) { + if ( confOp.getName().equals(operation.getName())) { + for (PolicySet ps : confOp.getPolicySets()) { + for (Object p : ps.getPolicies()) { + if (CheckingsDeptAuthPolicy.class.isInstance(p)) { + return ps; + } + } + } + } + } + } + + return null; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) + */ + public Interceptor createInterceptor(Operation operation) { + PolicySet ps = findPolicySet(operation); + return ps == null ? null : new CheckingsDeptAuthPolicyInterceptor(getContext(), operation, ps); + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() + */ + public String getPhase() { + return Phase.IMPLEMENTATION_POLICY; + } + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java new file mode 100644 index 0000000000..121ee9a3f8 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.policy.Policy; + +/** + * @version $Rev$ $Date$ + */ +public class CheckingsDeptAuthPolicy implements Policy { + + public QName getSchemaName() { + // TODO Auto-generated method stub + return null; + } + + public boolean isUnresolved() { + // TODO Auto-generated method stub + return false; + } + + public void setUnresolved(boolean unresolved) { + // TODO Auto-generated method stub + + } + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java new file mode 100644 index 0000000000..c8b73d4ed4 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java @@ -0,0 +1,77 @@ +package bigbank.account.security; + +import java.security.Principal; +import java.util.logging.ConsoleHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.PolicySet; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Policy handler to handle PolicySet related to Logging with the QName + * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy + */ +public class CheckingsDeptAuthPolicyInterceptor implements Interceptor { + private Invoker next; + + public CheckingsDeptAuthPolicyInterceptor(String context, Operation operation, PolicySet policySet) { + super(); + init(); + } + + private final void init() { + } + + public Message invoke(Message msg) { + Object msgBody = msg.getBody(); + if (msgBody instanceof Object[]) { + Object args[] = (Object[])msg.getBody(); + if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) { + BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL), + (String)args[0]); + } + } + + Message responseMsg = null; + try { + responseMsg = getNext().invoke(msg); + return responseMsg; + } catch (RuntimeException e) { + throw e; + } + } + + public Invoker getNext() { + return next; + } + + public void setNext(Invoker next) { + this.next = next; + } +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java new file mode 100644 index 0000000000..5fecef691e --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.provider.PolicyProvider; +import org.apache.tuscany.sca.provider.PolicyProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * @version $Rev$ $Date$ + */ +public class CheckingsDeptAuthPolicyProviderFactory implements PolicyProviderFactory { + private ExtensionPointRegistry registry; + + public CheckingsDeptAuthPolicyProviderFactory(ExtensionPointRegistry registry) { + super(); + this.registry = registry; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) + */ + public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { + return new CheckingsDeptAuthImplementationPolicyProvider(component, implementation); + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) + */ + public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, + RuntimeComponentReference reference, + Binding binding) { + return null; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) + */ + public PolicyProvider createServicePolicyProvider(RuntimeComponent component, + RuntimeComponentService service, + Binding binding) { + return null; + } + + /** + * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() + */ + public Class getModelType() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java new file mode 100644 index 0000000000..419b5def58 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import java.security.Principal; + +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.util.PolicyHandler; + +/** + * @version $Rev$ $Date$ + */ +public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler { + private PolicySet applicablePolicySet = null; + + public void afterInvoke(Object... context) { + } + + public void beforeInvoke(Object... context) { + for ( int count = 0 ; count < context.length ; ++count ) { + if ( context[count] instanceof Message ) { + Message msg = (Message)context[count]; + Object args[] = (Object[])msg.getBody(); + if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) { + BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL), + (String)args[0]); + } + } + } + } + + public void cleanUp(Object... arg0) { + } + + public PolicySet getApplicablePolicySet() { + return this.applicablePolicySet; + } + + public void setApplicablePolicySet(PolicySet policySet) { + this.applicablePolicySet = policySet; + } + + public void setUp(Object... arg0) { + + } + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java new file mode 100644 index 0000000000..da1b6e1d06 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.security; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.service.ContributionReadException; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; + +/** + * Implementation of a Policy Processor + * + */ +public class CheckingsDeptAuthorizationPolicyProcessor implements StAXArtifactProcessor { + private static final QName CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME = new QName("http://bigbank/checkings", "AuthPolicy"); + public QName getArtifactType() { + return CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME; + } + + public CheckingsDeptAuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) { + } + + + public CheckingsDeptAuthPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + CheckingsDeptAuthPolicy policy = new CheckingsDeptAuthPolicy(); + return policy; + } + + public void write(CheckingsDeptAuthPolicy policy, XMLStreamWriter writer) throws ContributionWriteException, + XMLStreamException { + String prefix = "tuscany"; + writer.writeStartElement(prefix, + CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getLocalPart(), + CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getNamespaceURI()); + writer.writeNamespace("chk", "http://bigbank/checkings"); + + + writer.writeEndElement(); + } + + public Class getModelType() { + return CheckingsDeptAuthPolicy.class; + } + + public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException { + + } + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java new file mode 100644 index 0000000000..1473436000 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +/** + * @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr + * 2007) $$ + */ + +public class StockAccountDetails { + private String accountNumber; + private String symbol; + private int quantity; + + public StockAccountDetails() { + } + + public StockAccountDetails(String acNo, String symbol, int qty) { + this.accountNumber = acNo; + this.symbol = symbol; + this.quantity = qty; + } + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int a) { + this.quantity = a; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String s) { + this.symbol = s; + } + + @Override + public String toString() { + return accountNumber + ", symbol:" + symbol + ", quantity:" + quantity; + } +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java new file mode 100644 index 0000000000..fcbf8a4831 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +import org.osoa.sca.annotations.Remotable; + +/** + * + */ +@Remotable +public interface StockAccountService { + + public StockAccountDetails getAccountDetails(String customerID); + + public StockAccountDetails buy(String accountNo, String symbol, int quantity); + + public StockAccountDetails sell(String accountNo, String symbol, int quantity); + + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java new file mode 100644 index 0000000000..28101a1986 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Service; + +/** + * + * */ + +@Service(StockAccountService.class) +public class StockAccountServiceImpl implements StockAccountService { + private Map custAcctMap = new HashMap(); + private Map stockAccts = new HashMap(); + + public StockAccountServiceImpl() { + custAcctMap.put("Customer_01", "STA_Customer_01"); + custAcctMap.put("Customer_02", "STA_Customer_02"); + custAcctMap.put("Customer_03", "STA_Customer_03"); + + stockAccts.put("STA_Customer_01", new StockAccountDetails("STA_Customer_01", "IBM", 100)); + stockAccts.put("STA_Customer_02", new StockAccountDetails("STA_Customer_02", "IBM", 200)); + stockAccts.put("STA_Customer_03", new StockAccountDetails("STA_Customer_03", "SYM_3", 125)); + } + + + public StockAccountDetails buy(String accountNo, String symbol, int quantity) { + return null; + } + + public StockAccountDetails getAccountDetails(String customerID) { + return stockAccts.get(custAcctMap.get(customerID)); + } + + public StockAccountDetails sell(String accountNo, String symbol, int quantity) { + return null; + } + + + +} diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/CheckingsAccount.composite b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/CheckingsAccount.composite new file mode 100644 index 0000000000..cc76e30a75 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/CheckingsAccount.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c5532b879d --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..6491a0d326 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the artifact processor extension +bigbank.account.security.CheckingsDeptAuthorizationPolicyProcessor;qname=http://bigbank/checkings#AuthPolicy,model=bigbank.account.security.CheckingsDeptAuthPolicy diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler new file mode 100644 index 0000000000..b1bce4339d --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures +# handler classname;qname=;model= +bigbank.account.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbankAccount#authorization,model=bigbank.account.security.CheckingsDeptAuthPolicy diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory new file mode 100644 index 0000000000..d6bfe2167e --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the policy extension +bigbank.account.security.CheckingsDeptAuthPolicyProviderFactory;model=bigbank.account.security.CheckingsDeptAuthPolicy \ No newline at end of file diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/SavingsAccount.composite b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/SavingsAccount.composite new file mode 100644 index 0000000000..696b96d6e6 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/SavingsAccount.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/StockAccount.composite b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/StockAccount.composite new file mode 100644 index 0000000000..62c0b63003 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/StockAccount.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/definitions.xml b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/definitions.xml new file mode 100644 index 0000000000..31a8798f8b --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/definitions.xml @@ -0,0 +1,58 @@ + + + + + + + + Authorization Intent + + + + + + + + + UsernameToken + bigbank.account.security.AccountsDataPasswordCallbackHandler + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html new file mode 100644 index 0000000000..1609bf4b43 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html @@ -0,0 +1,92 @@ + + + +Tuscany JSON-RPC BigBank Client + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tuscany JSON-RPC BigBank Client
+

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

+

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

+
RequestResponse

+ +
+
+
None Yet.
+
+
Dojo Debug:
+
+ + + + + diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/style.css b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/web/style.css @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +* { font-family: arial; } + +table, th, td { border: 2px solid blue; border-collapse: collapse; } +th { color: white; background-color: blue; } diff --git a/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..ac4d987a57 --- /dev/null +++ b/branches/sca-java-1.3.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3