String configArgument = "-c" + configName;
String bindingAddressArgument = null;
if (bindingAddress != null)
bindingAddressArgument = "-b" + bindingAddress;
ProcessExecution processExecution;
// prefix is either null or contains ONLY whitespace characters
if (prefix == null || prefix.replaceAll("\\s", "").equals("")) {
processExecution = ProcessExecutionUtility.createProcessExecution(startScriptFile);
processExecution.getArguments().add("-c");
processExecution.getArguments().add(configName);
if (bindingAddressArgument != null) {
processExecution.getArguments().add("-b");
processExecution.getArguments().add(bindingAddress);
}
} 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();
startScriptArgument += " " + configArgument;
if (bindingAddressArgument != null) {
startScriptArgument += " " + bindingAddressArgument;
}
processExecution.getArguments().add(startScriptArgument);
}
initProcessExecution(processExecution, startScriptFile);
long start = System.currentTimeMillis();