*/
private RuntimeWire addServiceWire(Component serviceComponent, ComponentService service, Binding serviceBinding) {
if (!(service instanceof RuntimeComponentService)) {
return null;
}
RuntimeComponentService runtimeService = (RuntimeComponentService)service;
// FIXME: [rfeng] We might need a better way to get the impl interface contract
Service targetService = service.getService();
if (targetService == null) {
targetService = service;
}
InterfaceContract targetContract = targetService.getInterfaceContract().makeUnidirectional(false);
InterfaceContract sourceContract = getInterfaceContract(service, serviceBinding);
EndpointReference wireSource = new EndpointReferenceImpl(null, null, serviceBinding, sourceContract);
EndpointReference wireTarget =
new EndpointReferenceImpl((RuntimeComponent)serviceComponent, (RuntimeComponentService)service,
serviceBinding, targetContract);
RuntimeWire wire =
new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
messageFactory, conversationManager);
runtimeService.getRuntimeWires().add(wire);
return wire;
}