private ProcessBuilder create(EsScriptCommand esScriptCommand) { List<String> commands = new ArrayList<>(); EsInstallation esInstallation = esScriptCommand.getEsInstallation(); requireNonNull(esInstallation, () -> "No Elasticsearch installation configuration is available for the command of type " + esScriptCommand.getClass()); commands.add(esInstallation.getExecutable().getAbsolutePath()); commands.addAll(esScriptCommand.getOptions()); return create(esScriptCommand, commands); }
private <T extends JvmOptions> Process launchJava(JavaCommand<T> javaCommand) { ProcessId processId = javaCommand.getProcessId(); try { ProcessBuilder processBuilder = create(javaCommand); logLaunchedCommand(javaCommand, processBuilder); return processBuilder.start(); } catch (Exception e) { throw new IllegalStateException(format("Fail to launch process [%s]", processId.getKey()), e); } }
private Process launchExternal(EsScriptCommand esScriptCommand) { try { ProcessBuilder processBuilder = create(esScriptCommand); logLaunchedCommand(esScriptCommand, processBuilder); return processBuilder.start(); } catch (Exception e) { throw new IllegalStateException(format("Fail to launch process [%s]", esScriptCommand.getProcessId().getKey()), e); } }
private <T extends JvmOptions> ProcessBuilder create(JavaCommand<T> javaCommand) { List<String> commands = new ArrayList<>(); commands.add(buildJavaPath()); commands.addAll(javaCommand.getJvmOptions().getAll()); commands.addAll(buildClasspath(javaCommand)); commands.add(javaCommand.getClassName()); if (javaCommand.getReadsArgumentsFromFile()) { commands.add(buildPropertiesFile(javaCommand).getAbsolutePath()); } else { javaCommand.getArguments().forEach((key, value) -> { if (value != null && !value.isEmpty()) { commands.add("-E" + key + "=" + value); } }); } return create(javaCommand, commands); }
private ProcessBuilder create(EsScriptCommand esScriptCommand) { List<String> commands = new ArrayList<>(); EsInstallation esInstallation = esScriptCommand.getEsInstallation(); requireNonNull(esInstallation, () -> "No Elasticsearch installation configuration is available for the command of type " + esScriptCommand.getClass()); commands.add(esInstallation.getExecutable().getAbsolutePath()); commands.addAll(esScriptCommand.getOptions()); return create(esScriptCommand, commands); }
private Process launchExternal(EsScriptCommand esScriptCommand) { try { ProcessBuilder processBuilder = create(esScriptCommand); logLaunchedCommand(esScriptCommand, processBuilder); return processBuilder.start(); } catch (Exception e) { throw new IllegalStateException(format("Fail to launch process [%s]", esScriptCommand.getProcessId().getKey()), e); } }
private <T extends JvmOptions> Process launchJava(JavaCommand<T> javaCommand) { ProcessId processId = javaCommand.getProcessId(); try { ProcessBuilder processBuilder = create(javaCommand); logLaunchedCommand(javaCommand, processBuilder); return processBuilder.start(); } catch (Exception e) { throw new IllegalStateException(format("Fail to launch process [%s]", processId.getKey()), e); } }
private <T extends JvmOptions> ProcessBuilder create(JavaCommand<T> javaCommand) { List<String> commands = new ArrayList<>(); commands.add(buildJavaPath()); commands.addAll(javaCommand.getJvmOptions().getAll()); commands.addAll(buildClasspath(javaCommand)); commands.add(javaCommand.getClassName()); if (javaCommand.getReadsArgumentsFromFile()) { commands.add(buildPropertiesFile(javaCommand).getAbsolutePath()); } else { javaCommand.getArguments().forEach((key, value) -> { if (value != null && !value.isEmpty()) { commands.add("-E" + key + "=" + value); } }); } return create(javaCommand, commands); }