summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core-spi
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-19 14:03:07 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-19 14:03:07 +0000
commitc79fbcb63cc5b097533f0d36b43e4c32782c71b1 (patch)
tree29f852f32a3660588ce49fcc642317ea8d7ba02a /sca-java-2.x/trunk/modules/core-spi
parent7fc8467572a9691e152123f44c38076f08ec0bd4 (diff)
Resolve operation policy and take account of it in base policy processor.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1186226 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core-spi')
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java28
1 files changed, 28 insertions, 0 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 ab1b33ac3c..ba6d6f5df0 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
@@ -69,10 +69,38 @@ public abstract class BasePolicyProvider<T> implements PolicyProvider {
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>();