Fix TUSCANY-3254: null returned by RequestContext.getCallbackReference()

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nash 2009-09-03 08:55:41 +00:00
parent 31ded537ca
commit f41a3e2b6c
3 changed files with 25 additions and 0 deletions

View file

@ -792,6 +792,19 @@ public abstract class BaseConfigurationBuilderImpl {
* @param service
*/
private ComponentReference createCallbackReference(Component component, ComponentService service) {
return createCallbackReference(component, service, assemblyFactory);
}
/**
* Create a callback reference for a component service
*
* @param component
* @param service
* @param assemblyFactory
*/
protected static ComponentReference createCallbackReference(Component component,
ComponentService service,
AssemblyFactory assemblyFactory) {
ComponentReference componentReference = assemblyFactory.createComponentReference();
componentReference.setIsCallback(true);
componentReference.setName(service.getName());

View file

@ -21,6 +21,7 @@ package org.apache.tuscany.sca.assembly.builder.impl;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
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.CompositeService;
@ -83,6 +84,11 @@ public class ComponentServicePromotionBuilderImpl implements CompositeBuilder {
newComponentService.setCallback(assemblyFactory.createCallback());
newComponentService.getCallback().getBindings()
.addAll(componentService.getCallback().getBindings());
ComponentReference callbackReference =
BaseConfigurationBuilderImpl.createCallbackReference(promotedComponent, newComponentService,
assemblyFactory);
callbackReference.getBindings().addAll(componentService.getCallback().getBindings());
newComponentService.setCallbackReference(callbackReference);
}
// Change the composite service to now promote the

View file

@ -21,6 +21,7 @@ package org.apache.tuscany.sca.assembly.builder.impl;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
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.CompositeService;
@ -64,6 +65,11 @@ public class CompositeServicePromotionBuilderImpl implements CompositeBuilder {
newComponentService.setCallback(assemblyFactory.createCallback());
newComponentService.getCallback().getBindings()
.addAll(compositeService.getCallback().getBindings());
ComponentReference callbackReference =
BaseConfigurationBuilderImpl.createCallbackReference(promotedComponent, newComponentService,
assemblyFactory);
callbackReference.getBindings().addAll(compositeService.getCallback().getBindings());
newComponentService.setCallbackReference(callbackReference);
}
// Change the composite service to now promote the newly