diff options
Diffstat (limited to '')
2 files changed, 33 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties b/sca-java-2.x/trunk/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties index fe92f5eab3..91b1721bf7 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties @@ -81,3 +81,5 @@ PropertyValueDoesNotMatchComplexType = [ASM50038] The property {0} on component PropertyValueDoesNotMatchElement = [ASM50029] The property {0} on component {1} has a value which does not match the element {2} with which it is associated. Validation reported {3} EPRIncompatibleInterface = [BWS20007] The reference interface is incompatible with the interface of the reference binding {0} EPIncompatibleInterface = [BWS20007] The service interface is incompatible with the interface of the service binding {0} +PromotedCallbackReferenceNotFound = For component {0} and service {1} the promoted component {2} does not have a callback reference called {3} which should have been created automatically by Tuscany +PromotedCallbackServiceNotFound = For component {0} and reference {1} the promoted component {2} does not have a callback service called {3} which should have been created automatically by Tuscany diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java index 13e30f7f78..ec9683a030 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java @@ -270,7 +270,7 @@ public class ComponentBuilderImpl { calculateBindings(component, componentService, componentTypeService, context); // add callback reference model objects - createCallbackReference(component, componentService); + createCallbackReference(component, componentService, monitor); } } @@ -312,7 +312,7 @@ public class ComponentBuilderImpl { calculateBindings(componentReference, componentTypeReference); // add callback service model objects - createCallbackService(component, componentReference); + createCallbackService(component, componentReference, monitor); // Propagate autowire setting from the component down the structural // hierarchy @@ -1156,12 +1156,12 @@ public class ComponentBuilderImpl { * @param component * @param service */ - private void createCallbackReference(Component component, ComponentService service) { + private void createCallbackReference(Component component, ComponentService service, Monitor monitor) { // if the service has a callback interface create a reference // to represent the callback if (service.getInterfaceContract() != null && // can be null in unit tests - service.getInterfaceContract().getCallbackInterface() != null) { + service.getInterfaceContract().getCallbackInterface() != null) { ComponentReference callbackReference = assemblyFactory.createComponentReference(); callbackReference.setForCallback(true); @@ -1197,7 +1197,19 @@ public class ComponentBuilderImpl { if (((CompositeService)implService).getPromotedService().isUnresolved() == false){ String referenceName = ((CompositeService)implService).getPromotedService().getName(); ComponentReference promotedReference = ((CompositeService)implService).getPromotedComponent().getReference(referenceName); - implCompReference.getPromotedReferences().add(promotedReference); + + if (promotedReference != null){ + implCompReference.getPromotedReferences().add(promotedReference); + } else { + Monitor.error(monitor, + this, + Messages.ASSEMBLY_VALIDATION, + "PromotedCallbackReferenceNotFound", + component.getName(), + service.getName(), + ((CompositeService)implService).getPromotedComponent().getName(), + referenceName); + } } implReference = implCompReference; @@ -1263,7 +1275,7 @@ public class ComponentBuilderImpl { * @param component * @param service */ - private void createCallbackService(Component component, ComponentReference reference) { + private void createCallbackService(Component component, ComponentReference reference, Monitor monitor) { if (reference.getInterfaceContract() != null && // can be null in unit tests reference.getInterfaceContract().getCallbackInterface() != null) { ComponentService callbackService = assemblyFactory.createComponentService(); @@ -1299,7 +1311,19 @@ public class ComponentBuilderImpl { if (((CompositeReference)implReference).getPromotedReferences().get(0).isUnresolved() == false){ String serviceName = ((CompositeReference)implReference).getPromotedReferences().get(0).getName(); ComponentService promotedService = ((CompositeReference)implReference).getPromotedComponents().get(0).getService(serviceName); - implCompService.setPromotedService(promotedService); + + if (promotedService != null){ + implCompService.setPromotedService(promotedService); + } else { + Monitor.error(monitor, + this, + Messages.ASSEMBLY_VALIDATION, + "PromotedCallbackServiceNotFound", + component.getName(), + reference.getName(), + ((CompositeReference)implReference).getPromotedComponents().get(0).getName(), + serviceName); + } } implService = implCompService; |