From 61b78c40dacd950091061712f8e9d3d98a1afd64 Mon Sep 17 00:00:00 2001 From: bdaniel Date: Wed, 28 Jul 2010 21:33:33 +0000 Subject: Fix handling of component type policy sets and intents git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980237 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/assembly/xml/CompositeProcessor.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src/main/java') diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index 8a01fe856c..eecb07e6cd 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -1098,17 +1098,20 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt //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 intents = implementation.getRequiredIntents(); - List policySets = implementation.getPolicySets(); - - + + List policySets = new ArrayList(implementation.getPolicySets()); + List intents = new ArrayList(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); } -- cgit v1.2.3