// Process nested composites recursively
configureNestedCompositeServices(composite);
// Process top level composite services
for (Service service : composite.getServices()) {
CompositeService compositeService = (CompositeService)service;
// Get the next lower level promoted service
ComponentService promotedService = compositeService.getPromotedService();
if (promotedService != null) {
// Set the bindings using the top level bindings to override the lower level bindings
if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
bindingsSpecifiedManually(promotedService.getBindings())) {
compositeService.getBindings().clear();
for (Binding binding : promotedService.getBindings()) {
try {
compositeService.getBindings().add((Binding)binding.clone());
} catch (CloneNotSupportedException ex) {
// this binding can't be used in the promoted service
}
}
}
if (compositeService.getInterfaceContract() != null &&
compositeService.getInterfaceContract().getCallbackInterface() != null) {
if (!(compositeService.getCallback() != null &&
bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
promotedService.getCallback() != null &&
bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
if (compositeService.getCallback() != null) {
compositeService.getCallback().getBindings().clear();
} else {
compositeService.setCallback(assemblyFactory.createCallback());
}
for (Binding binding : promotedService.getCallback().getBindings()) {
try {
compositeService.getCallback().getBindings().add((Binding)binding.clone());
} catch (CloneNotSupportedException ex) {
// this binding can't be used in the promoted service
}
}
}