{
resource = (Resource) getResourceClass( ).newInstance( );
}
catch ( Exception e )
{
throw new ResourceException( e );
}
resource.setID( key != null ? key.getValue() : null );
try
{
LOG.debug(MSG.getMessage( Keys.INIT_RESOURCE_LIFECYCLE_INSTANCE, resource.getClass().getName()));
resource.init();
}
catch ( RuntimeException re )
{
throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_INIT_RESOURCE, resource, re ));
}
return resource;
}