public class DefaultExecutor extends java.lang.Object implements Executor
Valid characters for parameters are codec dependent, but will usually only include alphanumeric, forward-slash, and dash.
Executor| Modifier and Type | Class and Description |
|---|---|
private static class |
DefaultExecutor.ReadThread |
| Modifier and Type | Field and Description |
|---|---|
private Codec |
codec |
private Logger |
logger
The logger.
|
private static Executor |
singletonInstance |
| Modifier | Constructor and Description |
|---|---|
private |
DefaultExecutor()
Instantiate a new Executor
|
| Modifier and Type | Method and Description |
|---|---|
ExecuteResult |
executeSystemCommand(java.io.File executable,
java.util.List params)
Invokes the specified executable with default workdir and codec and not logging parameters.
|
ExecuteResult |
executeSystemCommand(java.io.File executable,
java.util.List params,
java.io.File workdir,
Codec codec,
boolean logParams,
boolean redirectErrorStream)
Executes a system command after checking that the executable exists and
escaping all the parameters to ensure that injection is impossible.
|
static Executor |
getInstance() |
private static void |
readStream(java.io.InputStream is,
java.lang.StringBuilder sb)
readStream reads lines from an input stream and returns all of them in a single string
|
private static volatile Executor singletonInstance
private final Logger logger
private Codec codec
public static Executor getInstance()
public ExecuteResult executeSystemCommand(java.io.File executable, java.util.List params) throws ExecutorException
executeSystemCommand in interface Executorexecutable - the command to executeparams - the parameters of the command being executedExecutorExceptionpublic ExecuteResult executeSystemCommand(java.io.File executable, java.util.List params, java.io.File workdir, Codec codec, boolean logParams, boolean redirectErrorStream) throws ExecutorException
executeSystemCommand in interface Executorexecutable - the command to executeparams - the parameters of the command being executedworkdir - the working directorycodec - the codec to use to encode for the particular OS in uselogParams - use false if any parameters contains sensitive or confidential informationExecutorException - the service exceptionprivate static void readStream(java.io.InputStream is,
java.lang.StringBuilder sb)
throws java.io.IOException
is - input stream to read fromjava.io.IOException