From c2281244d53f2af5209c892e6eda3f1b48af0cbf Mon Sep 17 00:00:00 2001 From: bdaniel Date: Thu, 5 Aug 2010 03:01:09 +0000 Subject: TUSCANY-3642 Allow policy information on interfaces to apply to services and bindings, even if it is mutually exclusive with policy information on those elements. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@982458 13f79535-47bb-0310-9956-ffa450edef68 --- .../builder/impl/CompositePolicyBuilderImpl.java | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'sca-java-2.x/trunk/modules/builder/src/main') 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 2a88a48c8c..9c4da518d7 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 @@ -105,10 +105,7 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple } for (Endpoint ep : componentService.getEndpoints()) { - if (componentService.getInterfaceContract() != null) { - // Inherit from the component.service.interface - inherit(ep, null, true, componentService.getInterfaceContract().getInterface()); - } + // Inherit from binding inherit(ep, null, true, ep.getBinding()); @@ -116,7 +113,12 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple // Inherit from composite/component/service inherit(ep, null, true, ep.getService(), ep.getComponent(), composite ); - + if (componentService.getInterfaceContract() != null) { + // Inherit from the component.service.interface + // Do not check mutual exclusion here.. interfaces do not follow normal rules + // of the structural hierarchy (Policy spec 4.10) + inherit(ep, null, false, componentService.getInterfaceContract().getInterface()); + } // Replace profile intents with their required intents // Replace unqualified intents if there is a qualified intent in the list @@ -159,19 +161,19 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple } for (EndpointReference epr : componentReference.getEndpointReferences()) { - - // Inherit from the component.reference.interface - if (componentReference.getInterfaceContract() != null) { - inherit(epr, null, true, componentReference.getInterfaceContract().getInterface()); - } - + // Inherit from binding inherit(epr, null, true, epr.getBinding()); // Inherit from composite/component/reference inherit(epr, null, true, epr.getReference(), epr.getComponent(), composite); - + // Inherit from the component.reference.interface + if (componentReference.getInterfaceContract() != null) { + // Do not check mutual exclusion here.. interfaces do not follow normal rules + // of the structural hierarchy (Policy spec 4.10) + inherit(epr, null, true, componentReference.getInterfaceContract().getInterface()); + } // Replace profile intents with their required intents // Replace unqualified intents if there is a qualified intent in the list -- cgit v1.2.3