resources = realm.findResources( getComponentDescriptorLocation() );
}
}
catch ( IOException e )
{
throw new PlexusConfigurationException( "Unable to retrieve resources for: " +
getComponentDescriptorLocation() + " in class realm: " + realm.getId() );
}
for ( URL url : Collections.list( resources ))
{
Reader reader = null;
try
{
URLConnection conn = url.openConnection();
conn.setUseCaches( false );
conn.connect();
reader = ReaderFactory.newXmlReader( conn.getInputStream() );
InterpolationFilterReader interpolationFilterReader =
new InterpolationFilterReader( reader, new ContextMapAdapter( context ) );
ComponentSetDescriptor componentSetDescriptor =
createComponentDescriptors( interpolationFilterReader, url.toString() );
if ( componentSetDescriptor.getComponents() != null )
{
for ( ComponentDescriptor<?> cd : componentSetDescriptor.getComponents() )
{
cd.setComponentSetDescriptor( componentSetDescriptor );
cd.setRealm( realm );
}
}
componentSetDescriptors.add( componentSetDescriptor );
// Fire the event
ComponentDiscoveryEvent event = new ComponentDiscoveryEvent( componentSetDescriptor );
manager.fireComponentDiscoveryEvent( event );
}
catch ( IOException ex )
{
throw new PlexusConfigurationException( "Error reading configuration " + url, ex );
}
finally
{
IOUtil.close( reader );
}