throw new IOException( "NPANDAY-084-002: Repository class name must be provided: File Name = " + fileUri +
", Properties = " + props.toString() );
}
InputStream stream;
Repository repository;
try
{
stream = new FileInputStream( fileUri );
}
catch ( IOException e )
{
stream = this.getClass().getResourceAsStream( fileUri );
}
String message =
"File Name = " + fileUri + ", Repository Class = " + repositoryClass + ", Properties = " + props.toString();
boolean optional = ( initParams.containsKey( "optional" ) &&
( (String) initParams.get( "optional" ) ).equalsIgnoreCase( "true" ) );
if ( stream == null && !optional )
{
throw new IOException( "NPANDAY-084-003: Unable to loadRegistry config file: " + message );
}
else if ( stream == null && optional )
{
return null;
}
try
{
Class c = Class.forName( repositoryClass );
repository = (Repository) c.newInstance();
repository.setRepositoryRegistry( repositoryRegistry );
repository.load( stream, props );
repository.setSourceUri( fileUri );
}
catch ( NPandayRepositoryException e )
{
throw new NPandayRepositoryException( "NPANDAY-084-004: " + e.toString() + " : " + message, e );
}