summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/README2
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/build.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/pom.xml145
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java50
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java37
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java70
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java54
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java48
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java90
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java46
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java73
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java75
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java67
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java72
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite41
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler20
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml58
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml33
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java33
22 files changed, 1189 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/README b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/README
new file mode 100644
index 0000000000..3359bb74d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/README
@@ -0,0 +1,2 @@
+The spring-bigbank-checkaccount module is part of the simple-bigbank-spring sample.
+Please see the README file under simple-bigbank-spring to understand how spring-bigbank-checkaccount fits into the overall picture.
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/build.xml b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/build.xml
new file mode 100644
index 0000000000..dbf2addcc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/build.xml
@@ -0,0 +1,71 @@
+<?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.
+-->
+<project name="spring-bigbank-checkaccount" default="compile">
+ <property name="test.class" value="bigbank.account.checking.server.CheckingAccountServer" />
+ <property name="test.jar" value="sample-spring-bigbank-checkaccount.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="target" includeemptydirs="true"/>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/pom.xml b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/pom.xml
new file mode 100644
index 0000000000..3a25ac1a57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/pom.xml
@@ -0,0 +1,145 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-spring-bigbank-checkaccount</artifactId>
+ <name>Apache Tuscany SCA Sample Spring-Based BigBank Checking Accounts</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring-runtime</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>1.6.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.5.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.5.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.5.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>3.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
new file mode 100644
index 0000000000..9737ac27eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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: 635619 $$ $$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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java
new file mode 100644
index 0000000000..a8b958010a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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: 636465 $$ $$Date: 2008-03-13 00:49:26 +0530 (Thu, 13 Mar 2008) $$
+ */
+@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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
new file mode 100644
index 0000000000..a18a4920b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java
new file mode 100644
index 0000000000..562314230a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java
@@ -0,0 +1,70 @@
+/*
+ * 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.server;
+
+import java.io.IOException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the Spring BigBank CheckingsAccount JMS endpoint.
+ */
+public class CheckingAccountServer {
+
+ public static void main(String[] args) {
+ long timeout = -1L;
+ if (args.length > 0) {
+ timeout = Long.parseLong(args[0]);
+ }
+
+ try {
+ BrokerService jmsBroker;
+ jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ SCANode node = factory.createSCANodeFromClassLoader("CheckingsAccount.composite", CheckingAccountServer.class.getClassLoader());
+ node.start();
+
+ if (timeout < 0) {
+ System.out.println("CheckingsAccount server started (press enter to shutdown)");
+ System.in.read();
+ } else {
+ Thread.sleep(timeout);
+ }
+
+ node.stop();
+
+ jmsBroker.stop();
+ System.out.println("CheckingsAccount server stopped");
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java
new file mode 100644
index 0000000000..ad17ab8cf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java
new file mode 100644
index 0000000000..7b44a28bc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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: 635619 $ $Date: 2008-03-10 23:24:29 +0530 (Mon, 10 Mar 2008) $
+ */
+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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java
new file mode 100644
index 0000000000..bbd5b0c325
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $
+ */
+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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java
new file mode 100644
index 0000000000..cb26ca809d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $
+ */
+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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
new file mode 100644
index 0000000000..5c692df4ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
@@ -0,0 +1,73 @@
+package bigbank.account.security;
+
+import java.security.Principal;
+
+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;
+import org.apache.tuscany.sca.policy.SecurityUtil;
+
+/*
+ * 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();
+ Principal principal = SecurityUtil.getPrincipal(msg);
+ if (principal != null){
+ BigbankCheckingsAcl.authorize(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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java
new file mode 100644
index 0000000000..24da9878a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $
+ */
+public class CheckingsDeptAuthPolicyProviderFactory implements PolicyProviderFactory<CheckingsDeptAuthPolicy> {
+ 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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
new file mode 100644
index 0000000000..b023adf907
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
@@ -0,0 +1,67 @@
+/*
+ * 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.SecurityUtil;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * @version $Rev: 635619 $ $Date: 2008-03-10 23:24:29 +0530 (Mon, 10 Mar 2008) $
+ */
+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();
+ Principal principal = SecurityUtil.getPrincipal(msg);
+ if (principal != null){
+ BigbankCheckingsAcl.authorize(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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java
new file mode 100644
index 0000000000..96a5b2ca1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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<CheckingsDeptAuthPolicy> {
+ 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<CheckingsDeptAuthPolicy> getModelType() {
+ return CheckingsDeptAuthPolicy.class;
+ }
+
+ public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite
new file mode 100644
index 0000000000..371a1afd32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite
@@ -0,0 +1,41 @@
+<?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"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:bba="http://bigbankAccount"
+ name="CheckingsAccountDept">
+
+ <service name="CheckingsAccountService" promote="CheckingAccountServiceComponent" requires="authentication">
+ <interface.java interface="bigbank.account.checking.CheckingAccountService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61619">
+ <destination name="RequestQueue" create="ifnotexist"/>
+ <response>
+ <destination name="ResponseQueue" create="ifnotexist"/>
+ </response>
+ </binding.jms>
+ </service>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.spring location="spring-context/META-INF/spring/CheckingAccountService-context.xml" requires="bba:authorization"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..6491a0d326
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..b1bce4339d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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.account.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbankAccount#authorization,model=bigbank.account.security.CheckingsDeptAuthPolicy
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..d6bfe2167e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..0ce1440ddf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml
@@ -0,0 +1,58 @@
+<?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://bigbankAccount"
+ 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"
+ xmlns:bba="http://bigbankAccount">
+
+
+<sca:intent name="authorization"
+ constrains="sca:implementation.spring">
+ <description>
+ Authorization Intent
+ </description>
+</sca:intent>
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="wsAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:service/sca:binding.jms">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>bigbank.account.security.AccountsDataPasswordCallbackHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="chkDeptAuthorizationPolicy"
+ provides="bba:authorization"
+ appliesTo="sca:implementation.spring">
+ <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/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml
new file mode 100644
index 0000000000..6b2338f611
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+ <sca:service name="CheckingsAccountService"
+ type="bigbank.account.checking.CheckingAccountService" target="CheckingAccountServiceBean"/>
+
+ <bean id="CheckingAccountServiceBean" class="bigbank.account.checking.CheckingAccountServiceImpl">
+ </bean>
+
+</beans>
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java
new file mode 100644
index 0000000000..a45630278b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java
@@ -0,0 +1,33 @@
+/*
+ * 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.checkaccount;
+
+import junit.framework.TestCase;
+import bigbank.account.checking.server.CheckingAccountServer;
+
+/**
+ * Tests out the big bank service
+ *
+ */
+public class CheckAccountServiceTestCase extends TestCase {
+
+ public void testServer() throws Exception {
+ CheckingAccountServer.main(new String[] {"1000"});
+ }
+}