private ComponentSetDescriptor createComponentDescriptors( PlexusConfiguration configuration,
ClassRealm classRealm )
throws PlexusConfigurationException
{
ComponentSetDescriptor componentSetDescriptor = new ComponentSetDescriptor();
if ( configuration != null )
{
List componentDescriptors = new ArrayList();
PlexusConfiguration[] componentConfigurations = configuration.getChild( "components" ).getChildren(
"component" );
for ( int i = 0; i < componentConfigurations.length; i++ )
{
PlexusConfiguration componentConfiguration = componentConfigurations[i];
ComponentDescriptor componentDescriptor = null;
try
{
componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration );
}
catch ( PlexusConfigurationException e )
{
throw new PlexusConfigurationException( "Cannot build component descriptor from resource found in:\n" +
Arrays.asList( classRealm.getURLs() ), e );
}
componentDescriptor.setComponentType( "plexus" );
componentDescriptor.setRealmId( classRealm.getId() );
componentDescriptors.add( componentDescriptor );
}
componentSetDescriptor.setComponents( componentDescriptors );
// TODO: read and store the dependencies
}
return componentSetDescriptor;