diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-09 18:15:10 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-09 18:15:10 +0000 |
commit | 20aaa2dfe837ec9ee2800d9a8e06a5ffc65e77f5 (patch) | |
tree | ba75b5e7a3373a7fe9bd6fcee7767e4f6cf114fc /java/sca | |
parent | 274c7b6bba7c87e78318f980c84ac5741054817b (diff) |
Start to resolve intents to policySets that provide the intent
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@792623 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r-- | java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java index 9483810d9a..3156454348 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java @@ -43,8 +43,10 @@ import org.apache.tuscany.sca.definitions.Definitions; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.IntentMap; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.PolicySubject; +import org.apache.tuscany.sca.policy.Qualifier; /** * A composite builder that computes policy sets based on attached intents and policy sets. @@ -269,6 +271,28 @@ public class CompositePolicyBuilderImpl extends BaseBuilderImpl implements Compo List<Intent> provided = policySet.getProvidedIntents(); // FIXME: Check if required intents are provided by the policy sets } + + for (Intent intent : subject.getRequiredIntents()) { + loop: for (PolicySet ps : definitions.getPolicySets()) { + // FIXME: We will have to check the policy references and intentMap too + // as well as the appliesTo + if (ps.getProvidedIntents().contains(intent)) { + policySets.add(ps); + break; + } + for (IntentMap map : ps.getIntentMaps()) { + for (Qualifier q : map.getQualifiers()) { + if (intent.equals(q.getIntent())) { + policySets.add(ps); + break loop; + } + } + } + } + } + + subject.getPolicySets().clear(); + subject.getPolicySets().addAll(policySets); } |