public FileBasedGenerationalDriver(File rootFolder) { super(); if (rootFolder == null || !rootFolder.exists()) throw new IllegalArgumentException("Valid Root folder is required " + rootFolder); root = rootFolder; mode = JSON_MODE; }
public File getRunDir(Run run) { String runName = run.getName(); if (runName == null) throw new IllegalArgumentException("Run doesn't have a name."); File runDir = new File(root, runName); if (!runDir.exists()) runDir.mkdir(); return runDir; }
public String getRunData(Run run, String name) { File file = new File(getRunDir(run), name); String retVal = null; if (!file.exists()) return null; try { BufferedReader reader = new BufferedReader(new FileReader(file)); StringBuilder builder = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { builder.append(line); } reader.close(); retVal = builder.toString(); } catch (Exception exp) { throw new IllegalArgumentException( "Error trying to read data at " + file.getAbsolutePath(), exp); } return retVal; }