|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Executor
The Executor interface is used to run an OS command with reduced security risk.
Implementations should do as much as possible to minimize the risk of injection into either the command or parameters. In addition, implementations should timeout after a specified time period in order to help prevent denial of service attacks.
The class should perform logging and error handling as well. Finally, implementation should handle errors and generate an ExecutorException with all the necessary information.
The reference implementation does all of the above.
Method Summary | |
---|---|
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. |
Method Detail |
---|
ExecuteResult executeSystemCommand(java.io.File executable, java.util.List params) throws ExecutorException
executable
- the command to executeparams
- the parameters of the command being executed
ExecutorException
ExecuteResult executeSystemCommand(java.io.File executable, java.util.List params, java.io.File workdir, Codec codec, boolean logParams, boolean redirectErrorStream) throws ExecutorException
executable
- 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 information
ExecutorException
- the service exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |