private ProcessExecution getRpmShutdown() { ProcessExecution processExecution; String rpm = getTomcatServiceNum(); if (isWindows()) { processExecution = new ProcessExecution("net"); // disable the executable existence check because it is a command on the supplied PATH processExecution.setCheckExecutableExists(false); processExecution.setArguments(new ArrayList<String>()); processExecution.getArguments().add("stop"); processExecution.getArguments().add(rpm); } else { processExecution = new ProcessExecution("service"); // disable the executable existence check because it is a command on the supplied PATH processExecution.setCheckExecutableExists(false); processExecution.setArguments(new ArrayList<String>()); processExecution.getArguments().add(rpm); processExecution.getArguments().add("stop"); } Map<String, String> envVars = new LinkedHashMap<String, String>(System.getenv()); log.info("Operation Envs: " + envVars); processExecution.setEnvironmentVariables(envVars); initProcessExecution(processExecution); return processExecution; }
private ProcessExecution getRpmStart(Configuration pluginConfiguration) { ProcessExecution processExecution; String rpm = getTomcatServiceNum(); if (isWindows()) { processExecution = new ProcessExecution("net"); // disable the executable existence check because it is a command on the supplied PATH processExecution.setCheckExecutableExists(false); processExecution.setArguments(new ArrayList<String>()); processExecution.getArguments().add("start"); processExecution.getArguments().add(rpm); } else { processExecution = new ProcessExecution("service"); // disable the executable existence check because it is a command on the supplied PATH processExecution.setCheckExecutableExists(false); processExecution.setArguments(new ArrayList<String>()); processExecution.getArguments().add(rpm); processExecution.getArguments().add("start"); } Map<String, String> envVars = new LinkedHashMap<String, String>(System.getenv()); processExecution.setEnvironmentVariables(envVars); initProcessExecution(processExecution); return processExecution; }
private ProcessExecution getScriptStart(Configuration pluginConfiguration) { File startScriptFile = this.serverComponent.getStartScriptPath(); validateScriptFile(startScriptFile, TomcatServerComponent.PLUGIN_CONFIG_START_SCRIPT); String prefix = pluginConfiguration.getSimple(TomcatServerComponent.PLUGIN_CONFIG_SCRIPT_PREFIX) .getStringValue(); ProcessExecution processExecution; // prefix is either null or contains ONLY whitespace characters if (prefix == null || prefix.replaceAll("\\s", "").equals("")) { processExecution = ProcessExecutionUtility.createProcessExecution(startScriptFile); } else { // The process execution should be tied to the process represented as the prefix. If there are any other // tokens in the prefix, consider them arguments to the prefix process. StringTokenizer prefixTokenizer = new StringTokenizer(prefix); String processName = prefixTokenizer.nextToken(); File prefixProcess = new File(processName); processExecution = ProcessExecutionUtility.createProcessExecution(prefixProcess); while (prefixTokenizer.hasMoreTokens()) { String prefixArgument = prefixTokenizer.nextToken(); processExecution.getArguments().add(prefixArgument); } // Assemble the AS start script and its prefixes as one argument to the prefix String startScriptArgument = startScriptFile.getAbsolutePath(); processExecution.getArguments().add(startScriptArgument); } initScriptProcessExecution(processExecution, startScriptFile); return processExecution; }
List<String> arguments = processExecution.getArguments(); if (arguments == null) { arguments = new ArrayList<String>();