diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-07-05 08:26:12 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-07-05 08:26:12 +0000 |
commit | f07051ecf40f234baf3f6b7f897abc0322dda4d4 (patch) | |
tree | 06e59590d442ea69eb911176993cdad9ab9e8d65 /sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca | |
parent | e14213fce7c1427b333d3f19c7bcc362cb020d98 (diff) |
TUSCANY-3881 - Tidy up the binding context and test by re-enabling Rampart support in the ws binding so that WS policy can be applied. For the time being it only demonstrates integrity.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1142920 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca')
-rw-r--r-- | sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java index 8a4adb3d7f..ade541b635 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java @@ -37,7 +37,7 @@ import org.apache.tuscany.sca.policy.PolicySubject; * @tuscany.spi.extension.asclient */ public class PolicyHelper { - public PolicySet getPolicySet(PolicySubject subject, QName policySetName) { + public static PolicySet getPolicySet(PolicySubject subject, QName policySetName) { for (PolicySet ps : subject.getPolicySets()) { if (ps.getName().equals(policySetName)) { return ps; @@ -46,7 +46,7 @@ public class PolicyHelper { return null; } - public Intent getIntent(Definitions subject, QName intentName) { + public static Intent getIntent(Definitions subject, QName intentName) { for (Intent i : subject.getIntents()) { if (i.getName().equals(intentName)) { return i; @@ -55,7 +55,7 @@ public class PolicyHelper { return null; } - public PolicySet getPolicySet(Definitions subject, QName policySetName) { + public static PolicySet getPolicySet(Definitions subject, QName policySetName) { for (PolicySet ps : subject.getPolicySets()) { if (ps.getName().equals(policySetName)) { return ps; @@ -64,7 +64,7 @@ public class PolicyHelper { return null; } - public Intent getIntent(PolicySubject subject, QName intentName) { + public static Intent getIntent(PolicySubject subject, QName intentName) { for (Intent i : subject.getRequiredIntents()) { if (i.getName().equals(intentName)) { return i; @@ -73,7 +73,7 @@ public class PolicyHelper { return null; } - public Collection<PolicyExpression> getPolicyExpressions(PolicySubject subject, QName policyName) { + public static Collection<PolicyExpression> getPolicyExpressions(PolicySubject subject, QName policyName) { Collection<PolicyExpression> policies = new ArrayList<PolicyExpression>(); for (PolicySet ps : subject.getPolicySets()) { for (PolicyExpression exp : ps.getPolicies()) { @@ -85,7 +85,7 @@ public class PolicyHelper { return policies; } - public Collection<Object> getPolicies(PolicySubject subject, QName policyName) { + public static Collection<Object> getPolicies(PolicySubject subject, QName policyName) { Collection<Object> policies = new ArrayList<Object>(); for (PolicySet ps : subject.getPolicySets()) { for (PolicyExpression exp : ps.getPolicies()) { @@ -95,36 +95,18 @@ public class PolicyHelper { } } return policies; - } - - public static PolicySet getPolicySet(Binding wsBinding, QName intentName) { - PolicySet returnPolicySet = null; - - if (wsBinding instanceof PolicySubject) { - PolicySubject policiedBinding = (PolicySubject)wsBinding; - for (PolicySet policySet : policiedBinding.getPolicySets()) { - for (Intent intent : policySet.getProvidedIntents()) { - if (intent.getName().equals(intentName)) { - returnPolicySet = policySet; - break; - } - } - } - } + } - return returnPolicySet; - } + public static boolean isIntentRequired(PolicySubject subject, QName intent) { - public static boolean isIntentRequired(Binding wsBinding, QName intent) { - if (wsBinding instanceof PolicySubject) { - List<Intent> intents = ((PolicySubject)wsBinding).getRequiredIntents(); - for (Intent i : intents) { - if (intent.equals(i.getName())) { - return true; - } + List<Intent> intents = ((PolicySubject)subject).getRequiredIntents(); + for (Intent i : intents) { + if (intent.equals(i.getName())) { + return true; } } - return getPolicySet(wsBinding, intent) != null; + + return getPolicySet(subject, intent) != null; } } |