protected void openConnectionInternal()
throws ConnectionException
{
if ( getRepository() == null )
{
throw new ConnectionException( "Unable to operate with a null repository." );
}
if ( getRepository().getBasedir() == null )
{
// This condition is possible when using wagon-file under integration testing conditions.
fireSessionDebug( "Using a null basedir." );
return;
}
// Check the File repository exists
File basedir = new File( getRepository().getBasedir() );
if ( !basedir.exists() )
{
if ( !basedir.mkdirs() )
{
throw new ConnectionException( "Repository path " + basedir + " does not exist,"
+ " and cannot be created." );
}
}
if ( !basedir.canRead() )
{
throw new ConnectionException( "Repository path " + basedir + " cannot be read" );
}
}