You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2009/10/06 12:27:53 UTC
svn commit: r822198 -
/tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
Author: slaws
Date: Tue Oct 6 10:27:53 2009
New Revision: 822198
URL: http://svn.apache.org/viewvc?rev=822198&view=rev
Log:
Correct interface contract errors and reinstate reference side binding promotion
Modified:
tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
Modified: tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java?rev=822198&r1=822197&r2=822198&view=diff
==============================================================================
--- tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java (original)
+++ tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java Tue Oct 6 10:27:53 2009
@@ -193,7 +193,7 @@
}
// interface contracts
- calculateInterfaceContract(componentService, componentTypeService);
+ calculateInterfaceContract(component, componentService, componentTypeService);
// bindings
calculateBindings(componentService, componentTypeService);
@@ -243,13 +243,10 @@
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 @@
* @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 @@
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 @@
}
}
+
+ /**
+ * 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());
+ }
+
+ }
}