You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by bd...@apache.org on 2010/07/28 23:33:33 UTC

svn commit: r980237 - /tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java

Author: bdaniel
Date: Wed Jul 28 21:33:33 2010
New Revision: 980237

URL: http://svn.apache.org/viewvc?rev=980237&view=rev
Log:
Fix handling of component type policy sets and intents

Modified:
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=980237&r1=980236&r2=980237&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java Wed Jul 28 21:33:33 2010
@@ -1098,17 +1098,20 @@ public class CompositeProcessor extends 
                     //now resolve the implementation so that even if there is a shared instance
                     //for this that is resolved, the specified intents and policysets are safe in the
                     //component and not lost
-                	List<Intent> intents = implementation.getRequiredIntents();
-                	List<PolicySet> policySets = implementation.getPolicySets();
-                	
-                	
+
+                	List<PolicySet> policySets = new ArrayList<PolicySet>(implementation.getPolicySets());                	
+                	List<Intent> intents = new ArrayList<Intent>(implementation.getRequiredIntents());
                     implementation = resolveImplementation(implementation, resolver, context);
 
-                    implementation.getPolicySets().clear();
-                    implementation.getPolicySets().addAll(policySets);
-                    implementation.getRequiredIntents().clear();
-                    implementation.getRequiredIntents().addAll(intents);
-                    
+                    // If there are any policy sets on the implementation or component we have to
+                    // ignore policy sets from the component type (policy spec 4.9)
+                    if ( !policySets.isEmpty() || !component.getPolicySets().isEmpty() ) {                    	
+                    	implementation.getPolicySets().clear();
+                    	implementation.getPolicySets().addAll(policySets);                    	
+                    }
+                    	
+                    implementation.getRequiredIntents().addAll(intents);              
+
                     component.setImplementation(implementation);
                 }