diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-23 12:57:26 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-23 12:57:26 +0000 |
commit | 4f538657ed8baff04cdf01adff8db3c7e82aa3b9 (patch) | |
tree | bd3abb29eac6e120e2043a0e0153cd2403180e79 /sca-java-2.x/trunk/modules/builder/src/main/java/org | |
parent | ec7ff637d99ee73994a03d15b41f14a61571922a (diff) |
TUSCANY-3878 - check policy language equality based on the namspace of the policy element rather than the full element QName
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1138859 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/builder/src/main/java/org')
2 files changed, 26 insertions, 19 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java index 6ce0a3a7d5..9e6c4d758d 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java @@ -558,14 +558,14 @@ public class ComponentPolicyBuilderImpl { } } - protected Set<QName> getPolicyNames(PolicySubject subject) { + protected Set<String> getPolicyNames(PolicySubject subject) { if (subject == null) { return Collections.emptySet(); } - Set<QName> names = new HashSet<QName>(); + Set<String> names = new HashSet<String>(); for (PolicySet ps : subject.getPolicySets()) { for (PolicyExpression exp : ps.getPolicies()) { - names.add(exp.getName()); + names.add(exp.getName().getNamespaceURI()); } } return names; diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java index 9c4da518d7..2dc149ed60 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java @@ -42,6 +42,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.PolicyExpression; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.PolicySubject; import org.apache.tuscany.sca.policy.util.PolicyHelper; @@ -410,7 +411,7 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple for (ComponentService componentService : component.getServices()) { for (Endpoint ep : componentService.getEndpoints()) { - Set<QName> policyNames = getPolicyNames(ep); + Set<String> policyNames = getPolicyNames(ep); // check that only one policy language is present in the endpoint's policy sets if (policyNames.size() > 1){ @@ -420,19 +421,21 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple ep.toString(), policyNames.toString()); } else { - for (QName policyType : policyNames) { - PolicyBuilder builder = builders.getPolicyBuilder(policyType); - if (builder != null) { - builder.build(ep, context); + for (PolicySet ps : ep.getPolicySets()) { + for (PolicyExpression exp : ps.getPolicies()) { + PolicyBuilder builder = builders.getPolicyBuilder(exp.getName()); + if (builder != null) { + builder.build(ep, context); + } } - } + } } } } for (ComponentReference componentReference : component.getReferences()) { for (EndpointReference epr : componentReference.getEndpointReferences()) { - Set<QName> policyNames = getPolicyNames(epr); + Set<String> policyNames = getPolicyNames(epr); // check that only one policy language is present in the endpoint references's policy sets if (policyNames.size() > 1){ @@ -442,10 +445,12 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple epr.toString(), policyNames.toString()); } else { - for (QName policyType : policyNames) { - PolicyBuilder builder = builders.getPolicyBuilder(policyType); - if (builder != null) { - builder.build(epr, context); + for (PolicySet ps : epr.getPolicySets()) { + for (PolicyExpression exp : ps.getPolicies()) { + PolicyBuilder builder = builders.getPolicyBuilder(exp.getName()); + if (builder != null) { + builder.build(epr, context); + } } } } @@ -454,7 +459,7 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple Implementation implementation = component.getImplementation(); if (implementation != null) { - Set<QName> policyNames = getPolicyNames(implementation); + Set<String> policyNames = getPolicyNames(implementation); // check that only one policy language is present in the implementations's policy sets if (policyNames.size() > 1){ @@ -464,10 +469,12 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple component.toString(), policyNames.toString()); } else { - for (QName policyType : policyNames) { - PolicyBuilder builder = builders.getPolicyBuilder(policyType); - if (builder != null) { - builder.build(component, implementation, context); + for (PolicySet ps : implementation.getPolicySets()) { + for (PolicyExpression exp : ps.getPolicies()) { + PolicyBuilder builder = builders.getPolicyBuilder(exp.getName()); + if (builder != null) { + builder.build(component, implementation, context); + } } } } |