diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-06 10:27:53 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-06 10:27:53 +0000 |
commit | ba3cc10f94e2e94fd6a3304130ccb6ee8a535915 (patch) | |
tree | 95ccf9453e13600c7e0e865ccc2ad342c99bcb70 /java | |
parent | 227155bccdb9ccd3285806880e5c69ab3dcab390 (diff) |
Correct interface contract errors and reinstate reference side binding promotion
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@822198 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r-- | java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java index b97177f690..c6dc10f55b 100644 --- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java +++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java @@ -193,7 +193,7 @@ public class ComponentBuilderImpl { } // interface contracts - calculateInterfaceContract(componentService, componentTypeService); + calculateInterfaceContract(component, componentService, componentTypeService); // bindings calculateBindings(componentService, componentTypeService); @@ -243,13 +243,10 @@ public class ComponentBuilderImpl { reconcileReferenceMultiplicity(component, componentReference, componentTypeReference); // interface contracts - calculateInterfaceContract(componentReference, componentTypeReference); + calculateInterfaceContract(component, componentReference, componentTypeReference); // bindings - // We don't have to do anything with reference bindings. You've either - // specified one or you haven't - //calculateBindings(componentService, - // componentTypeService); + calculateBindings(componentReference, componentTypeReference); // add callback service model objects createCallbackService(component, componentReference); @@ -1028,7 +1025,7 @@ public class ComponentBuilderImpl { * @param topContract the top contract * @param bottomContract the bottom contract */ - private void calculateInterfaceContract(Contract topContract, Contract bottomContract) { + private void calculateInterfaceContract(Component component, Contract topContract, Contract bottomContract) { // Use the interface contract from the bottom level contract if // none is specified on the top level contract @@ -1045,13 +1042,15 @@ public class ComponentBuilderImpl { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, - "ReferenceInterfaceNotSubSet", + "ReferenceIncompatibleComponentInterface", + component.getName(), topContract.getName()); } else { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, - "ServiceInterfaceNotSubSet", + "ServiceIncompatibleComponentInterface", + component.getName(), topContract.getName()); } } @@ -1086,5 +1085,26 @@ public class ComponentBuilderImpl { } } + + /** + * OASIS RULE: Bindings from higher in the hierarchy take precedence + * + * @param componentReference the top service + * @param componentTypeReference the bottom service + */ + private void calculateBindings(Reference componentReference, Reference componentTypeReference) { + // forward bindings + if (componentReference.getBindings().isEmpty()) { + componentReference.getBindings().addAll(componentTypeReference.getBindings()); + } + + // callback bindings + if (componentReference.getCallback() == null) { + componentReference.setCallback(componentTypeReference.getCallback()); + } else if (componentReference.getCallback().getBindings().isEmpty() && componentTypeReference.getCallback() != null) { + componentReference.getCallback().getBindings().addAll(componentTypeReference.getCallback().getBindings()); + } + + } } |