private boolean openForWriting(){
  File root=new File(Properties.CTG_DIR);
  if (root.exists()) {
    if (root.isDirectory()) {
      if (!root.canWrite()) {
        logger.error("Cannot write in " + root.getAbsolutePath());
        return false;
      }
    }
 else {
      boolean deleted=root.delete();
      if (!deleted) {
        logger.error("Folder " + root + " is a file, and failed to delete it");
        return false;
      }
 else {
        if (!root.mkdirs()) {
          logger.error("Failed to mkdir " + root.getAbsolutePath());
          return false;
        }
      }
    }
  }
 else {
    if (!root.mkdirs()) {
      logger.error("Failed to mkdir " + root.getAbsolutePath());
      return false;
    }
  }
  File testsFolder=getBestTestFolder();
  if (!testsFolder.exists()) {
    if (!testsFolder.mkdirs()) {
      logger.error("Failed to mkdir " + testsFolder.getAbsolutePath());
      return false;
    }
  }
  File seedFolder=getSeedInFolder();
  if (!seedFolder.exists()) {
    if (!seedFolder.mkdirs()) {
      logger.error("Failed to mkdir " + seedFolder.getAbsolutePath());
    }
  }
  return true;
}

private boolean openForWriting ( ) { File root = new File ( Properties . CTG_DIR ) ; if ( root . exists ( ) ) { if ( root . isDirectory ( ) ) { if ( ! root . canWrite ( ) ) { logger . error ( "Cannot write in " + root . getAbsolutePath ( ) ) ; return false ; } } else { boolean deleted = root . delete ( ) ; if ( ! deleted ) { logger . error ( "Folder " + root + " is a file, and failed to delete it" ) ; return false ; } else { if ( ! root . mkdirs ( ) ) { logger . error ( "Failed to mkdir " + root . getAbsolutePath ( ) ) ; return false ; } } } } else { if ( ! root . mkdirs ( ) ) { logger . error ( "Failed to mkdir " + root . getAbsolutePath ( ) ) ; return false ; } } File testsFolder = getBestTestFolder ( ) ; if ( ! testsFolder . exists ( ) ) { if ( ! testsFolder . mkdirs ( ) ) { logger . error ( "Failed to mkdir " + testsFolder . getAbsolutePath ( ) ) ; return false ; } } File seedFolder = getSeedInFolder ( ) ; if ( ! seedFolder . exists ( ) ) { if ( ! seedFolder . mkdirs ( ) ) { logger . error ( "Failed to mkdir " + seedFolder . getAbsolutePath ( ) ) ; } } return true ; }
open connection to storage manager note : here we just make sure we can write on disk
