else
resources = classRealm.findResources( getComponentDescriptorLocation() );
}
catch ( IOException e )
{
throw new PlexusConfigurationException( "Unable to retrieve resources for: " +
getComponentDescriptorLocation() + " in class realm: " + classRealm.getId() );
}
for ( Enumeration e = resources; e.hasMoreElements(); )
{
URL url = (URL) e.nextElement();
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 ( Iterator i = componentSetDescriptor.getComponents().iterator(); i.hasNext(); )
{
ComponentDescriptor cd = (ComponentDescriptor) i.next();
cd.setRealmId( classRealm.getId() );
}
}
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 );
}