{
resource = (Resource) getResourceClass( ).newInstance( );
}
catch ( Exception e )
{
throw new ResourceException( e );
}
resource.setID( id );
try
{
LOG.debug( MSG.getMessage( Keys.INIT_RESOURCE_LIFECYCLE_INSTANCE,
resource.getClass( ).getName( ) ) );
if ( resource.getEndpointReference( ) == null ) //also checked in add(..) in case they sidestep this
{
resource.setEndpointReference( getEndpointReference( id ) );
}
resource.init( );
}
catch ( RuntimeException re )
{
throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_INIT_RESOURCE, resource, re ), re );
}
return resource;
}