public static File ensureExistingDirectory(String dirName) { File dir = new File(dirName); ensureExistingDirectory(dir); return dir; }
public static File ensureExistingDirectory(String dirName) { File dir = new File(dirName); ensureExistingDirectory(dir); return dir; }
public static File ensureExistingDirectory(File parent, String dirName) { File dir = new File(parent, dirName); ensureExistingDirectory(dir); return dir; }
public static File ensureExistingDirectory(File parent, String dirName) { File dir = new File(parent, dirName); ensureExistingDirectory(dir); return dir; }
public File getSessionDirectory() { String sessionId = this.sessionId; if (sessionId == null) { throw new IllegalStateException("no session active"); } File workersDir = ensureExistingDirectory(getSimulatorHome(), "workers"); return ensureExistingDirectory(workersDir, sessionId); }
/** * Copies a directory recursively. * * @param source the source directory * @param target the target directory */ public static void copyDirectory(File source, File target) { for (File srcFile : source.listFiles()) { if (srcFile.isDirectory()) { File targetChild = new File(target, srcFile.getName()); ensureExistingDirectory(targetChild); copyDirectory(srcFile, targetChild); } else { copyFileToDirectory(srcFile, target); } } }
public static void unzip(byte[] content, final File destinationDir) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(content)); try { ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { String fileName = zipEntry.getName(); File file = new File(destinationDir + File.separator + fileName); if (zipEntry.isDirectory()) { ensureExistingDirectory(file); } else { ensureExistingDirectory(file.getParentFile()); FileOutputStream fos = new FileOutputStream(file); try { int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } } finally { closeQuietly(fos); } } zipEntry = zis.getNextEntry(); } zis.closeEntry(); } finally { closeQuietly(zis); } }
public void launch() { try { sessionDir = agent.getSessionDirectory(); ensureExistingDirectory(sessionDir); WorkerType type = workerProcessSettings.getWorkerType(); int workerIndex = workerProcessSettings.getWorkerIndex(); LOGGER.info(format("Starting a Java Virtual Machine for %s Worker #%d", type, workerIndex)); LOGGER.info("Spawning Worker using settings: " + workerProcessSettings); WorkerProcess worker = startWorker(); LOGGER.info(format("Finished starting a for %s Worker #%d", type, workerIndex)); waitForWorkersStartup(worker, workerProcessSettings.getWorkerStartupTimeout()); } catch (Exception e) { throw new SpawnWorkerFailedException("Failed to start Worker", e); } }
AddressLevel.WORKER, agent.getAddressIndex(), workerIndex, 0); String workerId = workerAddress.toString() + '-' + agent.getPublicAddress() + '-' + type.name(); File workerHome = ensureExistingDirectory(sessionDir, workerId);
boolean hasIterationCap) { ensureExistingDirectory(targetDirectory);