private ComponentService createCallbackService(Component component, ComponentReference reference) {
ComponentService componentService = assemblyFactory.createComponentService();
componentService.setIsCallback(true);
componentService.setName(reference.getName());
try {
InterfaceContract contract =
(InterfaceContract)reference.getInterfaceContract().clone();
contract.setInterface(contract.getCallbackInterface());
contract.setCallbackInterface(null);
componentService.setInterfaceContract(contract);
} catch (CloneNotSupportedException e) {
// will not happen
}
Reference implReference = reference.getReference();
if (implReference != null) {
Service implService = assemblyFactory.createService();
implService.setName(implReference.getName());
try {
InterfaceContract implContract =
(InterfaceContract)implReference.getInterfaceContract().clone();
implContract.setInterface(implContract.getCallbackInterface());
implContract.setCallbackInterface(null);
implService.setInterfaceContract(implContract);
} catch (CloneNotSupportedException e) {
// will not happen
}
componentService.setService(implService);