Monitor monitor) {
for (Service service : componentType.getServices()) {
// Connect composite (component type) services to the component services
// that they promote
CompositeService compositeService = (CompositeService)service;
ComponentService componentService = compositeService.getPromotedService();
if (componentService != null && componentService.isUnresolved()) {
// get the name of the promoted component/service
String promotedComponentName = compositeService.getPromotedComponent().getName();
String promotedServiceName;
if (componentService.getName() != null) {
if (compositeService.isForCallback()) {
// For callbacks the name already has the form "componentName/servicename"
promotedServiceName = componentService.getName();
} else {
promotedServiceName = promotedComponentName + '/' + componentService.getName();
}
} else {
promotedServiceName = promotedComponentName;
}
// find the promoted service
ComponentService promotedService = componentServices.get(promotedServiceName);
if (promotedService != null) {
// Point to the resolved component
Component promotedComponent = components.get(promotedComponentName);
compositeService.setPromotedComponent(promotedComponent);
// Point to the resolved component service
compositeService.setPromotedService(promotedService);
} else {
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"PromotedServiceNotFound",