}
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 );