return;
}
Component component = (Component) modelObject;
Class implClass;
Scope scope;
// Get the component implementation
Implementation componentImplementation = component.getImplementation();
if (componentImplementation instanceof SystemImplementation
&& component.getContextFactory() == null) {
// The component is a system component, implemented by a Java class
SystemImplementation implementation = (SystemImplementation) componentImplementation;
if (componentImplementation.getComponentType().getServices() == null
|| componentImplementation.getComponentType().getServices().size() < 1) {
BuilderConfigException e = new BuilderConfigException("No service configured on component type");
e.setIdentifier(component.getName());
throw e;
}
implClass = implementation.getImplementationClass();
Scope previous = null;
scope = Scope.MODULE;
List<Service> services = component.getImplementation().getComponentType().getServices();
for (Service service : services) {
// calculate and validate the scope of the component; ensure that all service scopes are the same unless
// a scope is stateless
Scope current = service.getServiceContract().getScope();
if (previous != null && current != null && current != previous
&& (current != Scope.INSTANCE && previous != Scope.INSTANCE)) {
BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component");
e.setIdentifier(component.getName());
throw e;