Author: bdaniel
Date: Fri Jul 16 18:54:14 2010
New Revision: 964906

URL: http://svn.apache.org/viewvc?rev=964906&view=rev
Log:
Use default intent qualification on implementations

Modified:
    
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java

Modified: 
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java?rev=964906&r1=964905&r2=964906&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java
 Fri Jul 16 18:54:14 2010
@@ -192,9 +192,10 @@ public class CompositePolicyBuilderImpl 
                     }
 
                     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 
                             
                             
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 
     }
     
     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<PolicySet> copy = new 
ArrayList<PolicySet>(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<PolicySet> copy = new 
ArrayList<PolicySet>(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


Reply via email to