*/
private void createWires(Component component, ComponentService service, Binding binding) {
if (!(service instanceof RuntimeComponentService)) {
return;
}
RuntimeComponentService runtimeService = (RuntimeComponentService)service;
// FIXME: [rfeng] We might need a better way to get the impl interface contract
InterfaceContract targetContract = service.getService().getInterfaceContract();
InterfaceContract sourceContract = getInterfaceContract(service, binding);
EndpointReference wireSource = new EndpointReferenceImpl(null, null, binding, sourceContract);
EndpointReference wireTarget = new EndpointReferenceImpl((RuntimeComponent)component,
(RuntimeComponentService)service, binding,
targetContract);
RuntimeWire wire = new RuntimeWireImpl(wireSource, wireTarget);
for (Operation operation : sourceContract.getInterface().getOperations()) {
Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
/* lresende */
if (operation.isNonBlocking()) {
chain.addInterceptor(new NonBlockingInterceptor(workScheduler));
}
addImplementationInterceptor(component, service, chain, targetOperation, false);
wire.getInvocationChains().add(chain);
}
// if (sourceContract.getCallbackInterface() != null) {
// for (Operation operation :
// sourceContract.getCallbackInterface().getOperations()) {
// Operation targetOperation =
// interfaceContractMapper.map(targetContract.getCallbackInterface(),
// operation);
// InvocationChain chain = new InvocationChainImpl(operation,
// targetOperation);
// if (operation.isNonBlocking()) {
// chain.addInterceptor(new NonBlockingInterceptor(workScheduler,
// workContext));
// }
// addImplementationInterceptor(component, service, chain, operation,
// true);
// wire.getCallbackInvocationChains().add(chain);
// }
// }
runtimeService.getRuntimeWires().add(wire);
wireProcessor.process(wire);
}