From da78c51ad2bbe51910d5626c74830daa9194b3b9 Mon Sep 17 00:00:00 2001 From: bdaniel Date: Fri, 16 Jul 2010 18:54:14 +0000 Subject: Use default intent qualification on implementations git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@964906 13f79535-47bb-0310-9956-ffa450edef68 --- .../builder/impl/CompositePolicyBuilderImpl.java | 60 ++++++++++++---------- 1 file changed, 34 insertions(+), 26 deletions(-) (limited to 'sca-java-2.x/trunk/modules/builder/src/main/java/org/apache') 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 1989ce02ba..d8c5db6524 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 @@ -192,9 +192,10 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple } if (implementation instanceof Composite) { - inherit(implementation, Intent.Type.implementation, true, component, composite); - checkIntentsResolved(implementation, context); + inherit(implementation, Intent.Type.implementation, true, component, composite); computePolicies((Composite)implementation, context); + expandDefaultIntents(implementation,context); + checkIntentsResolved(implementation,context); } else { resolveAndCheck(implementation, context); if (implementation != null) { @@ -205,6 +206,9 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple removeDirectPolicySetsIfExternalExists(implementation, context); + // Replace qualifiable intents with their default qualifier + expandDefaultIntents(implementation, context); + // check that all intents are resolved checkIntentsResolved(implementation, context); } @@ -219,30 +223,34 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple } private void checkForNoListenerIntent(Endpoint ep, BuilderContext context) { - PolicyHelper helper = new PolicyHelper(); - if (helper.getIntent(ep, NOLISTENER_INTENT) != null) { - error(context.getMonitor(), "NoListenerIntentSpecifiedOnService", this, ep.toString()); - } - - } - - private void removeDirectPolicySetsIfExternalExists(PolicySubject subject, BuilderContext context) { - boolean foundExternalPolicySet = false; - for (PolicySet ps : subject.getPolicySets()) { - if (ps.getAttachTo() != null) - foundExternalPolicySet = true; - } - - if (foundExternalPolicySet) { - List copy = new ArrayList(subject.getPolicySets()); - for (PolicySet ps : copy) { - if (ps.getAttachTo() == null) { - subject.getPolicySets().remove(ps); - } - } - } - - } + PolicyHelper helper = new PolicyHelper(); + if ( helper.getIntent(ep, NOLISTENER_INTENT) != null ) { + error(context.getMonitor(), + "NoListenerIntentSpecifiedOnService", + this, + ep.toString()); + } + + } + + private void removeDirectPolicySetsIfExternalExists(PolicySubject subject, + BuilderContext context) { + boolean foundExternalPolicySet = false; + for (PolicySet ps : subject.getPolicySets() ) { + if ( ps.getAttachTo() != null ) + foundExternalPolicySet = true; + } + + if ( foundExternalPolicySet ) { + List copy = new ArrayList(subject.getPolicySets()); + for ( PolicySet ps : copy ) { + if ( ps.getAttachTo() == null ) { + subject.getPolicySets().remove(ps); + } + } + } + + } /** * This is mainly about removing policies that don't "applyTo" the element where -- cgit v1.2.3