for (Service service : compositeServices) {
// Set default binding names
// Create default SCA binding
if (service.getBindings().isEmpty()) {
SCABinding scaBinding = createSCABinding(definitions);
service.getBindings().add(scaBinding);
}
}
// Initialize reference bindings
for (Reference reference : composite.getReferences()) {
// Create default SCA binding
if (reference.getBindings().isEmpty()) {
SCABinding scaBinding = createSCABinding(definitions);
reference.getBindings().add(scaBinding);
}
}
// Initialize all component services and references
Map<String, Component> components = new HashMap<String, Component>();
for (Component component : composite.getComponents()) {
// Index all components and check for duplicates
if (components.containsKey(component.getName())) {
error(monitor, "DuplicateComponentName", component, composite.getName().toString(), component.getName());
} else {
components.put(component.getName(), component);
}
// Propagate the autowire flag from the composite to components
if (component.getAutowire() == null) {
component.setAutowire(composite.getAutowire());
}
if (component.getImplementation() instanceof ComponentPreProcessor) {
((ComponentPreProcessor)component.getImplementation()).preProcess(component);
}
// Index properties, services and references
Map<String, Service> services = new HashMap<String, Service>();
Map<String, Reference> references = new HashMap<String, Reference>();
Map<String, Property> properties = new HashMap<String, Property>();
indexImplementationPropertiesServicesAndReferences(component,
services,
references,
properties,
monitor);
// Index component services, references and properties
// Also check for duplicates
Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
Map<String, ComponentProperty> componentProperties = new HashMap<String, ComponentProperty>();
indexComponentPropertiesServicesAndReferences(component,
componentServices,
componentReferences,
componentProperties,
monitor);
// Reconcile component services/references/properties and
// implementation services/references and create component
// services/references/properties for the services/references
// declared by the implementation
reconcileServices(component, services, componentServices, monitor);
reconcileReferences(component, references, componentReferences, monitor);
reconcileProperties(component, properties, componentProperties, monitor);
// Configure or create callback services for component's references
// with callbacks
configureCallbackServices(component, componentServices);
// Configure or create callback references for component's services
// with callbacks
configureCallbackReferences(component, componentReferences);
// Initialize service bindings
for (ComponentService componentService : component.getServices()) {
// Create default SCA binding
if (componentService.getBindings().isEmpty()) {
SCABinding scaBinding = createSCABinding(definitions);
componentService.getBindings().add(scaBinding);
}
}
// Initialize reference bindings
for (ComponentReference componentReference : component.getReferences()) {
// Create default SCA binding
if (componentReference.getBindings().isEmpty()) {
SCABinding scaBinding = createSCABinding(definitions);
componentReference.getBindings().add(scaBinding);
}
}
}
}