componentService.setInterfaceContract(promotedService.getInterfaceContract());
}
// Create a new component service to represent this composite
// service on the promoted component
SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
if (scaBinding != null) {
Component promotedComponent = scaBinding.getComponent();
ComponentService newComponentService = assemblyFactory.createComponentService();
newComponentService.setName("$promoted$." + compositeService.getName());
//newComponentService.setService(compositeService);
promotedComponent.getServices().add(newComponentService);
newComponentService.getBindings().add(scaBinding);
newComponentService.getBindings().addAll(compositeService.getBindings());
newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
newComponentService.setCallback(compositeService.getCallback());
// FIXME: [rfeng] Set the service to promoted
newComponentService.setService(promotedService.getService());
// Change the composite service to now promote the newly
// created component service directly
compositeService.setPromotedService(newComponentService);
} else {
warning("Promoted component service not found: " + promotedService.getName(), composite);
}
}
}
}
}
}
// Process composite services declared in this composite
for (Service service : composite.getServices()) {
CompositeService compositeService = (CompositeService)service;
// Get the inner most promoted service
ComponentService promotedService = getPromotedComponentService(compositeService);
if (promotedService != null) {
// Default to use the interface from the promoted service
if (compositeService.getInterfaceContract() == null && promotedService.getInterfaceContract() != null) {
compositeService.setInterfaceContract(promotedService.getInterfaceContract());
}
// Create a new component service to represent this composite
// service on the promoted component
SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
if (scaBinding != null) {
Component promotedComponent = scaBinding.getComponent();
ComponentService newComponentService = assemblyFactory.createComponentService();
newComponentService.setName("$promoted$." + compositeService.getName());
//newComponentService.setService(compositeService);
promotedComponent.getServices().add(newComponentService);
newComponentService.getBindings().add(scaBinding);