You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2008/03/27 08:24:39 UTC

svn commit: r641726 - in /incubator/tuscany/java/sca: demos/bigbank-account/ demos/bigbank-account/src/main/java/bigbank/account/security/ demos/bigbank-account/src/main/resources/META-INF/services/ demos/bigbank-calculator/ demos/bigbank-stockquote/ d...

Author: svkrish
Date: Thu Mar 27 00:24:37 2008
New Revision: 641726

URL: http://svn.apache.org/viewvc?rev=641726&view=rev
Log:
syncing up changes from the 1.2 branch

Added:
    incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java   (with props)
    incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java   (with props)
    incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java   (with props)
    incubator/tuscany/java/sca/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
Modified:
    incubator/tuscany/java/sca/demos/bigbank-account/README
    incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java
    incubator/tuscany/java/sca/demos/bigbank-calculator/README
    incubator/tuscany/java/sca/demos/bigbank-stockquote/README
    incubator/tuscany/java/sca/demos/bigbank/README
    incubator/tuscany/java/sca/distribution/bundle/pom.xml
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
    incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java

Modified: incubator/tuscany/java/sca/demos/bigbank-account/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-account/README?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-account/README (original)
+++ incubator/tuscany/java/sca/demos/bigbank-account/README Thu Mar 27 00:24:37 2008
@@ -1,72 +1,4 @@
-BigBank Demo
-============
-
-This application is made of 3 modules that represent the different aspects 
-of a fictitious banking application. Please see bigbank.png in the bigbank-account directory for a diagram of this demo.
-
-To run the bigbank-account demo you need to first run bigbank-calculator and bigbank-stockquote composites. This will bring up Tuscany runtime and load the two applications and make them available as services. Bigbank-account is dependent on these services.
-
-This demo uses ant. This is just one way of running this demo. 
-
-Start Bigbank-calculator composite
-----------------------------------
-
-Bigbank-calculator is a calculator application which handles add, subtract, multiply and divide operations. Each of these operations is implemented in a different language, including JavaScript, groovy, Ruby and Python.
-
-To run the bigbank-calculator composite and make it available as a service for this demo do the following:
-
-cd bigbank-calculator
-ant compile  
-ant run
-
-.. Leave the server running
-
-Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on.
-
-Start Bigbank-stockquote
-------------------------
-
-A very simple web services based stock quote application which returns random 
-stock quotes on request. Please note that the stockquote service is not live and is implemented instead to allow for this application to always run without dependency on the availability of a webservice.
-
-cd bigbank-stockquote
-ant compile  
-ant run
-
-.. Leave the server running
-
-Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on.
-
-Start Bigbank-account 
----------------------
-  
-Bigbank-account is entry point to this application running on Tuscany. Bigbank-account composite calls into bigbank-stockquote and bigbank-calculator services. Start bigbank-account in the following way:
-
-cd bigbank-account
-ant compile 
-ant run
-
-.. Leave the server running
-
-Note that 'ant compile' needs to be done the first time you run this demo out ofthe  binary distribution. No need to do 'ant compile' from there on.
-
-Run the demo
-------------- 
-The front end of this demo application is a web app which users Json/RPC to communicate with the backend for retrieving account information. 
-
-To try the app out point you browser at:
-
-http://localhost:8080/AccountJSON.html
-
-This should display an interface with a single button that goes and retrieves 
-a single set of account details exercising services across the three running 
-SCA applications. 
-
-If you press on getAccountReport, you'll see a response posted, but the detail of the data will be displayed in the screen where you started bigbank-account.
-
-
-Stop the demo
--------------
-Go to each of the corresponding command line screens and hit 'enter'. This will stop each of the applications.
+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.
  
 

Added: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java?rev=641726&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java (added)
+++ incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java Thu Mar 27 00:24:37 2008
@@ -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;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java (original)
+++ incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java Thu Mar 27 00:24:37 2008
@@ -19,9 +19,28 @@
 
 package bigbank.account.security;
 
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
 /**
  * @version $Rev$ $Date$
  */
-public class CheckingsDeptAuthPolicy {
+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
+        
+    }
 
 }

Added: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java?rev=641726&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java (added)
+++ incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java Thu Mar 27 00:24:37 2008
@@ -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;
+    }
+}

Propchange: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java?rev=641726&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java (added)
+++ incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java Thu Mar 27 00:24:37 2008
@@ -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<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;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory?rev=641726&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory (added)
+++ incubator/tuscany/java/sca/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory Thu Mar 27 00:24:37 2008
@@ -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

Modified: incubator/tuscany/java/sca/demos/bigbank-calculator/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-calculator/README?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-calculator/README (original)
+++ incubator/tuscany/java/sca/demos/bigbank-calculator/README Thu Mar 27 00:24:37 2008
@@ -1,3 +1,2 @@
-bigbank-calculator is part of a larger demo called bigbank-account. Please see the Readme file under bigbank-account to understand how bigbank-calculator fits into the overall demo.
- 
-
+bigbank-calculator is part of a larger demo called bigbank. 
+Please see the Readme file under bigbank to understand how bigbank-calculator fits into the overall demo.

Modified: incubator/tuscany/java/sca/demos/bigbank-stockquote/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank-stockquote/README?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank-stockquote/README (original)
+++ incubator/tuscany/java/sca/demos/bigbank-stockquote/README Thu Mar 27 00:24:37 2008
@@ -1,3 +1,4 @@
-bigbank-stockquote is a part of a larger demo called bigbank-account. Please see the Readme file under bigbank-account to understand how bigbank-stockquote fits into the overall demo.
+bigbank-stockquote is a part of a larger demo called bigbank. 
+Please see the Readme file under bigbank to understand how bigbank-stockquote fits into the overall demo.
  
 

Modified: incubator/tuscany/java/sca/demos/bigbank/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/bigbank/README?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/demos/bigbank/README (original)
+++ incubator/tuscany/java/sca/demos/bigbank/README Thu Mar 27 00:24:37 2008
@@ -37,19 +37,68 @@
 
 Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on.
 
-Start Bigbank-account 
+Start Bigbank
+-------------
+The BigBank comprises of two subsystems that are built from two distinct contributions coming from ...
+1) bigbank
+	This contains all artifacts that make up the bigbank application.  This is the application that the 
+	end user interacts with
+	
+2) bigbank-account
+	This contains all artifacts that deal with the account management within the bigbank.  The services 
+	offered by the bigbank-account module are used by the bigbank.  The end user never gets to directly 
+	interact with bigbank account
+	
+Besides the bigbank-account the bigbank composite application calls into bigbank-stockquote and 
+bigbank-calculator services. 
+
+Start bigbank-account in the following way:
+
+i ) Compile the bigbank-account as follows :
+	
+	cd bigbank-account					
+	ant compile
+	
+ii) Now start the bigbank service as follows :
+	
+	cd bigbank
+	ant compile 
+	ant run
+
+	.. Leave the server running
+
+Note that 'ant compile' needs to be done the first time you run this demo out ofthe  binary distribution. 
+No need to do 'ant compile' from there on.
+
+Bigbank and the SCA Policies
+----------------------------
+The Bigbank demo uses the Tuscany PolicyFramework to enforce security in the following ways:
+
+Authentication
+--------------
+	The bigbank-account subsystem enforces authentication as a required security characteristic for
+	all interactions with its CheckingAccountService.  Hence the 'bigbank' application which is a client
+	to this service authenticates itself for every interaction with the CheckingAccountService.  The interaction
+	between the bigbank and the CheckingAccountService is over the ws binding.
+	
+Integrity
+---------
+	All interactions of the bigbank application with the StockQuoteService are guarded with message integrity.
+	These interactions use the ws binding.
+	
+Authorization
+-------------
+	Within the bigbank-account subsystem the CheckingAccountService implementation enforces authorization on
+	its operations.  This is an instance of a custom policy enforcement i.e. the CheckingAccountService 
+	component's implementation has defined its own customized way of authorizing access to its services.
+	
+Demonstrated features 
 ---------------------
-  
-Bigbank-account is entry point to this application running on Tuscany. Bigbank-account composite calls into bigbank-stockquote and bigbank-calculator services. Start bigbank-account in the following way:
-
-cd bigbank-account
-ant compile 
-ant run
-
-.. Leave the server running
-
-Note that 'ant compile' needs to be done the first time you run this demo out ofthe  binary distribution. No need to do 'ant compile' from there on.
+This demo is to illustrate the following : -
+- composition of an application using artifacts belonging to multiple contributions (here two)
+- usage of sca policies in composite definitions with specific emphasis on enabling security
 
+	
 Run the demo
 ------------- 
 The front end of this demo application is a web app which users Json/RPC to communicate with the backend for retrieving account information. 
@@ -62,11 +111,17 @@
 a single set of account details exercising services across the three running 
 SCA applications. 
 
-If you press on getAccountReport, you'll see a response posted, but the detail of the data will be displayed in the screen where you started bigbank-account.
+If you press on getAccountReport, you'll see a response posted, 
+but the detail of the data will be displayed in the console where you started bigbank. Among other
+things you will note messages that confirm the enforecement of AUTHENTICATION, AUTHORIZATION and
+SIGNING of messages exchaged.
 
+On the console where you have started the StockQuote Service you should again be able to see messages
+that confirm the signing of messages exchanged.
 
 Stop the demo
 -------------
-Go to each of the corresponding command line screens and hit 'enter'. This will stop each of the applications.
+Go to each of the corresponding command line screens and hit 'enter'. 
+This will stop each of the applications.
  
 

Modified: incubator/tuscany/java/sca/distribution/bundle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/distribution/bundle/pom.xml?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/distribution/bundle/pom.xml (original)
+++ incubator/tuscany/java/sca/distribution/bundle/pom.xml Thu Mar 27 00:24:37 2008
@@ -642,6 +642,9 @@
                                     <resource>META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler</resource>
                                 </transformer>
                                 <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+                                    <resource>META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory</resource>
+                                </transformer>
+                                <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
                                     <resource>META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider</resource> 
                                 </transformer> 
                             </transformers>

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java Thu Mar 27 00:24:37 2008
@@ -132,7 +132,7 @@
         if (wireProcessorExtensionPoint != null) {
             wireProcessorExtensionPoint.addWireProcessor(new JavaCallbackRuntimeWireProcessor(interfaceContractMapper,
                                                                                               javaFactory));
-            wireProcessorExtensionPoint.addWireProcessor(new JavaPolicyHandlingRuntimeWireProcessor());
+            //wireProcessorExtensionPoint.addWireProcessor(new JavaPolicyHandlingRuntimeWireProcessor());
         }
     }
 

Modified: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java (original)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java Thu Mar 27 00:24:37 2008
@@ -19,7 +19,9 @@
 
 package org.apache.tuscany.sca.policy.logging.jdk;
 
+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;
@@ -44,14 +46,29 @@
         return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")";
     }
 
-    private PolicySet findPolicySet() {
-        for (PolicySet ps : component.getApplicablePolicySets()) {
+    private PolicySet findPolicySet(Operation operation) {
+        for (PolicySet ps : component.getPolicySets()) {
             for (Object p : ps.getPolicies()) {
                 if (JDKLoggingPolicy.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 (JDKLoggingPolicy.class.isInstance(p)) {
+                                return ps;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
         return null;
     }
 
@@ -59,7 +76,7 @@
      * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
      */
     public Interceptor createInterceptor(Operation operation) {
-        PolicySet ps = findPolicySet();
+        PolicySet ps = findPolicySet(operation);
         return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
     }
 
@@ -67,7 +84,7 @@
      * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
      */
     public String getPhase() {
-        return Phase.SERVICE_POLICY;
+        return Phase.IMPLEMENTATION_POLICY;
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java?rev=641726&r1=641725&r2=641726&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java (original)
+++ incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java Thu Mar 27 00:24:37 2008
@@ -1,3 +1,18 @@
+package org.apache.tuscany.sca.policy.security.jaas;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,21 +32,6 @@
  * under the License.    
  */
 
-package org.apache.tuscany.sca.policy.security.jaas;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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;
-
 /**
  * Policy handler to handle PolicySet containing JaasAuthenticationPolicy instances
  */
@@ -52,11 +52,18 @@
             OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
             for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
                 if (cop.getName().equals(op.getName())) {
-                    cop.getApplicablePolicySets();
+                    for (PolicySet ps : cop.getPolicySets()) {
+                        for (Object p : ps.getPolicies()) {
+                            if (JaasAuthenticationPolicy.class.isInstance(p)) {
+                                polices.add((JaasAuthenticationPolicy)p);
+                            }
+                        }
+                    }
                 }
             }
         }
-        List<PolicySet> policySets = component.getApplicablePolicySets();
+        
+        List<PolicySet> policySets = component.getPolicySets();
         for (PolicySet ps : policySets) {
             for (Object p : ps.getPolicies()) {
                 if (JaasAuthenticationPolicy.class.isInstance(p)) {
@@ -77,6 +84,6 @@
     }
 
     public String getPhase() {
-        return Phase.SERVICE_POLICY;
+        return Phase.IMPLEMENTATION_POLICY;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org