summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core-spi/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-03-02 17:00:06 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-03-02 17:00:06 +0000
commit7056169666242148a7ef510da0c8d44f327e78d8 (patch)
tree84189f695464243ad0e7ec1d506739bcd9e4bc36 /sca-java-2.x/trunk/modules/core-spi/src/main
parent1b7dae00ac4ff8e658fe052c854860b449b13a62 (diff)
Add first bits of code to start enabling the use of policies nested inside of WS Policy and policy alternatives rather than having to sit at the top level. Based on this the next step is to understand how tuscany defined and non-tuscany defined policies are managed.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@918111 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core-spi/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
index 30802feb82..e143cb2aa5 100644
--- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.provider;
+import java.security.Policy;
import java.util.ArrayList;
import java.util.List;
@@ -29,6 +30,7 @@ import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.PolicyContainer;
import org.apache.tuscany.sca.policy.PolicyExpression;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySubject;
@@ -57,13 +59,23 @@ public abstract class BasePolicyProvider<T> implements PolicyProvider {
if (policyType.isInstance(p)) {
policies.add(policyType.cast(p));
}
+
if (p instanceof PolicyExpression) {
PolicyExpression exp = (PolicyExpression)p;
if (policyType.isInstance(exp.getPolicy())) {
policies.add(policyType.cast(exp.getPolicy()));
}
+
+ // TODO - some code to handle the case where the
+ // policy expression is a WS-Policy
+ // Experimental at the moment.
+ if (PolicyContainer.class.isInstance(exp.getPolicy())){
+ Object policy = ((PolicyContainer)exp.getPolicy()).getChildPolicy(policyType);
+ if(policy != null){
+ policies.add(policyType.cast(policy));
+ }
+ }
}
-
}
}
return policies;