}
catch( Throwable e )
{
final String error =
"Internal error while attempt to construct initial repository.";
throw new RepositoryException( error, e );
}
Attributes attributes = m_repository.getAttributes( artifact );
FactoryDescriptor descriptor = new FactoryDescriptor( attributes );
String classname = descriptor.getFactory();
if( null == classname )
{
final String error =
"Required property 'avalon.artifact.factory' not present in artifact: ["
+ artifact + "] under the active repository: [" + m_repository + "].";
throw new IllegalArgumentException( error );
}
m_classloader = m_repository.getClassLoader( parent, artifact );
Class clazz = loadFactoryClass( m_classloader, classname );
try
{
m_delegate = createDelegate( m_classloader, classname, m_context );
}
catch( Throwable e )
{
final String error =
"Unable to establish a factory for the supplied artifact:";
StringBuffer buffer = new StringBuffer( error );
buffer.append( "\n artifact: " + artifact );
buffer.append( "\n build: " + descriptor.getBuild() );
buffer.append( "\n factory: " + descriptor.getFactory() );
buffer.append( "\n source: "
+ clazz.getProtectionDomain().getCodeSource().getLocation() );
buffer.append( "\n repository: " + m_repository );
throw new RepositoryException( buffer.toString(), e );
}
}