diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-31 10:38:52 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-31 10:38:52 +0000 |
commit | 1b903cae8b2c1920fbbef2904b0b4d4f014ec052 (patch) | |
tree | aecb07156f40efeb42d00ff9e4e6e2748b16bd17 /sca-java-2.x/trunk/modules/builder/src/main/java | |
parent | b624b481d8900141f221c041858deea1aef04a71 (diff) |
Ensure that fully resolved JSR250 policy sets, added by the policy processor on the fly, are not re-resolved. Hence the dynamic information in the policy sets is not lost.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1195401 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/builder/src/main/java')
-rw-r--r-- | sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java | 20 |
1 files changed, 14 insertions, 6 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 9e6c4d758d..238a745429 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 @@ -443,16 +443,24 @@ public class ComponentPolicyBuilderImpl { // or external attachement // resolve policy set names that have been specified for the // policy subject against the real policy sets from the - // definitions files + // definitions files. + // Some policy plugins, e.g. JSR250, add resolved policy sets + // on the fly as they read details from annotations. So check + // that policy sets are unresolved befor blowing them away with + // a warning Set<PolicySet> policySets = new HashSet<PolicySet>(); if (definitions != null) { for (PolicySet policySet : subject.getPolicySets()) { - int index = definitions.getPolicySets().indexOf(policySet); - if (index != -1) { - policySets.add(definitions.getPolicySets().get(index)); + if (policySet.isUnresolved()){ + int index = definitions.getPolicySets().indexOf(policySet); + if (index != -1) { + policySets.add(definitions.getPolicySets().get(index)); + } else { + // PolicySet cannot be resolved + warning(context.getMonitor(), "PolicySetNotFoundAtBuild", subject, policySet); + } } else { - // PolicySet cannot be resolved - warning(context.getMonitor(), "PolicySetNotFoundAtBuild", subject, policySet); + policySets.add(policySet); } } } |