public void addComponentDescriptor( ComponentDescriptor<?> componentDescriptor ) throws CycleDetectedInComponentGraphException { repository.addComponentDescriptor( componentDescriptor ); }
public void addComponentDescriptor( ComponentDescriptor componentDescriptor ) throws ComponentRepositoryException { componentRepository.addComponentDescriptor( componentDescriptor ); }
private ComponentRepository getComponentRepository( ContainerInitializationContext context ) throws ContainerInitializationException { ComponentRepository repository = context.getContainerConfiguration().getComponentRepository(); // Add the components defined in the container xml configuration try { PlexusConfiguration configuration = context.getContainerXmlConfiguration(); PlexusConfiguration[] componentConfigurations = configuration.getChild( "components" ).getChildren( "component" ); for ( PlexusConfiguration componentConfiguration : componentConfigurations ) { ComponentDescriptor<?> componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration, context.getContainer().getContainerRealm() ); componentDescriptor.setRealm( context.getContainer().getContainerRealm() ); repository.addComponentDescriptor( componentDescriptor ); } } catch ( PlexusConfigurationException e ) { throw new ContainerInitializationException( "Error initializing component repository: " + "Cannot unmarshall component descriptor: ", e ); } catch ( CycleDetectedInComponentGraphException e ) { throw new ContainerInitializationException( "A cycle has been detected in the components of the system: ", e ); } return repository; }