protected void configureComposite(Composite composite) throws IncompatibleInterfaceContractException {
for (Component component : composite.getComponents()) {
for (ComponentService service : component.getServices()) {
for (Binding binding : service.getBindings()) {
BindingProviderFactory providerFactory = (BindingProviderFactory)providerFactories
.getProviderFactory(binding.getClass());
if (providerFactory != null) {
ServiceBindingProvider bindingProvider = providerFactory
.createServiceBindingProvider((RuntimeComponent)component,
(RuntimeComponentService)service,
binding);
if (bindingProvider != null) {
((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
}
} else {
throw new IllegalStateException("Provider factory not found for class: " + binding.getClass()
.getName());
}
}
}
for (ComponentReference reference : component.getReferences()) {
for (Binding binding : reference.getBindings()) {
BindingProviderFactory providerFactory = (BindingProviderFactory)providerFactories
.getProviderFactory(binding.getClass());
if (providerFactory != null) {
ReferenceBindingProvider bindingProvider = providerFactory
.createReferenceBindingProvider((RuntimeComponent)component,
(RuntimeComponentReference)reference,
binding);
if (bindingProvider != null) {
((RuntimeComponentReference)reference).setBindingProvider(binding, bindingProvider);
}
} else {
throw new IllegalStateException("Provider factory not found for class: " + binding.getClass()
.getName());
}
}
}
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
configureComposite((Composite)implementation);
} else if (implementation != null) {
ImplementationProviderFactory providerFactory = (ImplementationProviderFactory)providerFactories
.getProviderFactory(implementation.getClass());
if (providerFactory != null) {
ImplementationProvider implementationProvider = providerFactory
.createImplementationProvider((RuntimeComponent)component, implementation);
if (implementationProvider != null) {
((RuntimeComponent)component).setImplementationProvider(implementationProvider);
}
} else {