summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java21
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositePolicyBuilderImpl.java1
2 files changed, 19 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java
index 5db7ca78a3..07d4d59226 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java
@@ -33,6 +33,7 @@ import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.CompositeReference;
import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.Contract;
@@ -42,6 +43,7 @@ import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.BuilderContext;
import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
import org.apache.tuscany.sca.assembly.builder.Messages;
+import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.definitions.Definitions;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -463,10 +465,23 @@ public class ComponentPolicyBuilderImpl {
protected void removeConstrainedIntents(PolicySubject subject, BuilderContext context) {
List<Intent> intents = subject.getRequiredIntents();
+ QName baseType = null;
+ QName type = null;
// Remove the intents whose @contrains do not include the current element
ExtensionType extensionType = subject.getExtensionType();
- if(extensionType != null){
+
+ // Need to check elements that don't have an extension type, like Composites
+ // References don't have an extension type, but they're checked at wiring time
+ if ( extensionType == null ) {
+ if ( subject instanceof Composite )
+ type = Constants.COMPOSITE_QNAME;
+ } else {
+ type = extensionType.getType();
+ baseType = extensionType.getBaseType();
+ }
+
+ if(type != null){
List<Intent> copy = new ArrayList<Intent>(intents);
for (Intent i : copy) {
List<ExtensionType> constrainedTypes = i.getConstrainedTypes();
@@ -476,8 +491,8 @@ public class ComponentPolicyBuilderImpl {
if (constrainedTypes.size() > 0){
boolean constraintFound = false;
for (ExtensionType constrainedType : i.getConstrainedTypes()){
- if (constrainedType.getType().equals(extensionType.getType()) ||
- constrainedType.getType().equals(extensionType.getBaseType())){
+ if (constrainedType.getType().equals(type) ||
+ constrainedType.getType().equals(baseType)){
constraintFound = true;
break;
}
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 219f5468a7..6fd43f1d3d 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
@@ -208,6 +208,7 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple
resolveAndCheck(implementation, context);
inherit(implementation, Intent.Type.implementation, true, component, composite);
computePolicies((Composite)implementation, context);
+ removeConstrainedIntents(implementation, context);
expandDefaultIntents(implementation,context);
checkIntentsResolved(implementation,context);
} else {