tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1186226 - in /tuscany/sca-java-2.x/trunk/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/resources/META-INF/services/ binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen...
Date Wed, 19 Oct 2011 14:03:08 GMT
Author: slaws
Date: Wed Oct 19 14:03:07 2011
New Revision: 1186226

URL: http://svn.apache.org/viewvc?rev=1186226&view=rev
Log:
Resolve operation policy and take account of it in base policy processor. 

Modified:
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
    tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
    tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
Wed Oct 19 14:03:07 2011
@@ -81,6 +81,7 @@ import org.apache.tuscany.sca.contributi
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.Problem;
 import org.apache.tuscany.sca.monitor.Problem.Severity;
@@ -365,7 +366,7 @@ abstract class BaseAssemblyProcessor ext
             // Resolve the interface contract
             InterfaceContract interfaceContract = contract.getInterfaceContract();
             if (interfaceContract != null) {
-                extensionProcessor.resolve(interfaceContract, resolver, context);
+                extensionProcessor.resolve(interfaceContract, resolver, context); 
             }
 
             // Resolve bindings
@@ -382,6 +383,32 @@ abstract class BaseAssemblyProcessor ext
                     Binding binding = contract.getCallback().getBindings().get(i);
                     extensionProcessor.resolve(binding, resolver, context);
                 }
+            }          
+        }
+    }
+    
+    /*
+     * Resolve policy that's been attached to interface operations
+     */
+    protected <C extends Contract> void resolveContractOperationPolicy(List<C>
contracts, ModelResolver resolver, ProcessorContext context){
+        if (contracts != null){
+            for (Contract contract : contracts) {
+                InterfaceContract interfaceContract = contract.getInterfaceContract();
+                if (interfaceContract != null) {
+                    
+                    // Resolve any policy on the interface operations
+                    if (interfaceContract.getInterface() != null){
+                        for (Operation op : interfaceContract.getInterface().getOperations()){
+                            policyProcessor.resolvePolicies(op, resolver, context);
+                       }
+                    }
+                    
+                    if (interfaceContract.getCallbackInterface() != null){
+                        for (Operation op : interfaceContract.getCallbackInterface().getOperations()){
+                            policyProcessor.resolvePolicies(op, resolver, context);
+                       }
+                    }  
+                }
             }
         }
     }

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
Wed Oct 19 14:03:07 2011
@@ -103,6 +103,7 @@ import org.apache.tuscany.sca.contributi
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.policy.ExtensionType;
 import org.apache.tuscany.sca.policy.Intent;
@@ -1112,8 +1113,17 @@ public class CompositeProcessor extends 
                     	implementation.getPolicySets().addAll(policySets);                 
  	
                     }
                     	
-                    implementation.getRequiredIntents().addAll(intents);              
-
+                    implementation.getRequiredIntents().addAll(intents);     
+                    
+                    // resolve any policy on implementation operations
+                    for (Operation op : implementation.getOperations()){
+                        policyProcessor.resolvePolicies(op, resolver, context);
+                    }
+                    
+                    // resolve any policy on interface operations
+                    resolveContractOperationPolicy(implementation.getServices(), resolver,
context);
+                    resolveContractOperationPolicy(implementation.getReferences(), resolver,
context);
+                    
                     component.setImplementation(implementation);
                 }
 

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
Wed Oct 19 14:03:07 2011
@@ -18,4 +18,5 @@
 org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;model=org.apache.tuscany.sca.assembly.Composite
 org.apache.tuscany.sca.assembly.xml.ComponentTypeModelResolver;model=org.apache.tuscany.sca.assembly.ComponentType
 org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;model=org.apache.tuscany.sca.policy.Intent
+org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;model=org.apache.tuscany.sca.policy.PolicySet
 

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java
Wed Oct 19 14:03:07 2011
@@ -41,6 +41,7 @@ import org.apache.tuscany.sca.core.Facto
 import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
@@ -352,6 +353,18 @@ public class BindingWSDLGenerator {
         } catch (InvalidInterfaceException e) {
             throw new WSDLGenerationException(e);
         }
+        
+        // copy operation intents and policy sets from Java to WSDL interface
+        // in case we need to refer to them in later processing
+        for(Operation javaOperation : javaInterface.getOperations()){
+            for(Operation wsdlOperation : wsdlInterface.getOperations()){
+                if (wsdlOperation.getName().equals(javaOperation.getName())){
+                    wsdlOperation.getRequiredIntents().addAll(javaOperation.getRequiredIntents());
+                    wsdlOperation.getPolicySets().addAll(javaOperation.getPolicySets());
+                    break;
+                }
+            }
+        }
 
         return wsdlInterface;
     }    

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
Wed Oct 19 14:03:07 2011
@@ -23,6 +23,8 @@ import java.io.IOException;
 import java.lang.ref.WeakReference;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -73,8 +75,9 @@ public class ClassLoaderModelResolver ex
         return urls.toArray(new URL[urls.size()]);
     }
 
-    public ClassLoaderModelResolver(final Contribution contribution, FactoryExtensionPoint
modelFactories) throws IOException {
+    public ClassLoaderModelResolver(final Contribution contribution, FactoryExtensionPoint
modelFactories) throws IOException {       
         super(getContributionURLs(contribution), parentClassLoader(contribution));
+        
         this.contribution = new WeakReference<Contribution>(contribution);
         // Index Java import resolvers by package name
         Map<String, List<ModelResolver>> resolverMap = new HashMap<String,
List<ModelResolver>>();

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -69,10 +69,38 @@ public abstract class BasePolicyProvider
     	return findPolicies(applicablePolicySets);
     }
     
+    /*
+     * return policies for the service as a whole not including
+     * operation specific policies
+     */
     protected List<T> findPolicies() {
     	return findPolicies(subject.getPolicySets());
     }
     
+    /*
+     * return policies for the service as a whole including
+     * operation specific policies
+     */
+    protected List<T> findPolicies(Operation operation) {
+        // collect together all the candidate policy sets
+        List<PolicySet> policySets = new ArrayList<PolicySet>();
+        // add endpoint or endpoint reference policy sets
+        policySets.addAll(subject.getPolicySets());
+        // add interface operation policy sets
+        policySets.addAll(operation.getPolicySets());
+        // add implementation operation policy sets
+        if (subject instanceof Endpoint){
+            for(Operation op :((Endpoint)subject).getComponent().getImplementation().getOperations()){
+                if (op.getName().equals(operation.getName())){
+                    policySets.addAll(op.getPolicySets());
+                    break;
+                }
+            }
+        }
+        
+        return findPolicies(policySets);
+    }    
+    
     private List<T> findPolicies(List<PolicySet> policySets) {
         List<T> policies = new ArrayList<T>();
        

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
Wed Oct 19 14:03:07 2011
@@ -98,12 +98,20 @@ class BPELImplementationImpl extends Imp
 
     @Override
     public List<Service> getServices() {
-        return componentType.getServices();
+        if (componentType != null){
+            return componentType.getServices();
+        } else {
+            return null;
+        }
     }
 
     @Override
     public List<Reference> getReferences() {
-        return componentType.getReferences();
+        if (componentType != null){
+            return componentType.getReferences();
+        } else {
+            return null;
+        }        
     }
 
     @Override

Modified: tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -40,7 +40,7 @@ public class JDKLoggingImplementationPol
      * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
      */
     public PhasedInterceptor createInterceptor(Operation operation) {
-        List<JDKLoggingPolicy> policies = findPolicies();
+        List<JDKLoggingPolicy> policies = findPolicies(operation);
         return policies.isEmpty() ? null : new JDKLoggingPolicyInterceptor(subject, getContext(),
operation,
                                                                            policies, Phase.IMPLEMENTATION_POLICY);
     }

Modified: tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -37,7 +37,7 @@ public class JDKLoggingReferencePolicyPr
     }
 
     public PhasedInterceptor createInterceptor(Operation operation) {
-        List<JDKLoggingPolicy> policies = findPolicies();
+        List<JDKLoggingPolicy> policies = findPolicies(operation);
         return policies.isEmpty() ? null : new JDKLoggingPolicyInterceptor(subject, getContext(),
operation,
                                                                            policies, Phase.REFERENCE_POLICY);
     }

Modified: tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -37,7 +37,7 @@ public class JDKLoggingServicePolicyProv
     }
 
     public PhasedInterceptor createInterceptor(Operation operation) {
-        List<JDKLoggingPolicy> policies = findPolicies();
+        List<JDKLoggingPolicy> policies = findPolicies(operation);
         return policies.isEmpty() ? null : new JDKLoggingPolicyInterceptor(subject, getContext(),
operation, policies, Phase.SERVICE_POLICY);
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -41,37 +41,6 @@ public class SecurityIdentityImplementat
         this.implementation = component.getImplementation();
     }
 
-    private List<SecurityIdentityPolicy> findPolicies(Operation op) {
-        List<SecurityIdentityPolicy> polices = new ArrayList<SecurityIdentityPolicy>();
-        /*
-        // FIXME: How do we get a list of effective policySets for a given operation?
-        if (implementation instanceof OperationsConfigurator) {
-            OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
-            for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations())
{
-                if (cop.getName().equals(op.getName())) {
-                    for (PolicySet ps : cop.getPolicySets()) {
-                        for (Object p : ps.getPolicies()) {
-                            if (SecurityIdentityPolicy.class.isInstance(p)) {
-                                polices.add((SecurityIdentityPolicy)p);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        */
-        
-        List<PolicySet> policySets = implementation.getPolicySets();
-        for (PolicySet ps : policySets) {
-            for (Object p : ps.getPolicies()) {
-                if (SecurityIdentityPolicy.class.isInstance(p)) {
-                    polices.add((SecurityIdentityPolicy)p);
-                }
-            }
-        }
-        return polices;
-    }
-
     public PhasedInterceptor createInterceptor(Operation operation) {
         List<SecurityIdentityPolicy> policies = findPolicies(operation);
         if (policies == null || policies.isEmpty()) {

Modified: tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -43,37 +43,6 @@ public class JaasAuthenticationImplement
         this.implementation = component.getImplementation();
     }
 
-    private List<JaasAuthenticationPolicy> findPolicies(Operation op) {
-        List<JaasAuthenticationPolicy> polices = new ArrayList<JaasAuthenticationPolicy>();
-        /*
-        // FIXME: How do we get a list of effective policySets for a given operation?
-        if (implementation instanceof OperationsConfigurator) {
-            OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
-            for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations())
{
-                if (cop.getName().equals(op.getName())) {
-                    for (PolicySet ps : cop.getPolicySets()) {
-                        for (Object p : ps.getPolicies()) {
-                            if (JaasAuthenticationPolicy.class.isInstance(p)) {
-                                polices.add((JaasAuthenticationPolicy)p);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        */
-        
-        List<PolicySet> policySets = implementation.getPolicySets();
-        for (PolicySet ps : policySets) {
-            for (Object p : ps.getPolicies()) {
-                if (JaasAuthenticationPolicy.class.isInstance(p)) {
-                    polices.add((JaasAuthenticationPolicy)p);
-                }
-            }
-        }
-        return polices;
-    }
-
     public PhasedInterceptor createInterceptor(Operation operation) {
         List<JaasAuthenticationPolicy> policies = findPolicies(operation);
         if (policies == null || policies.isEmpty()) {

Modified: tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -40,7 +40,7 @@ public class TransactionReferencePolicyP
     }
 
     public PhasedInterceptor createInterceptor(Operation operation) {
-        List<TransactionPolicy> policies = findPolicies();
+        List<TransactionPolicy> policies = findPolicies(operation);
         return policies.isEmpty() ? null : new TransactionInterceptor(helper, true, policies.get(0),
null, getPhase());
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java?rev=1186226&r1=1186225&r2=1186226&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
Wed Oct 19 14:03:07 2011
@@ -40,7 +40,7 @@ public class TransactionServicePolicyPro
     }
 
     public PhasedInterceptor createInterceptor(Operation operation) {
-        List<TransactionPolicy> policies = findPolicies();
+        List<TransactionPolicy> policies = findPolicies(operation);
         return policies.isEmpty() ? null : new TransactionInterceptor(helper, true, policies.get(0),
null, getPhase());
     }
 



Mime
View raw message