Interface ICommandLineProgram
-
public interface ICommandLineProgramInterface for separating a command line program with own libraries from instantiator code to enable optional loading of heavy-weight libraries. Instances registered withCommandLineProgramRegistryjust need to implement the interface and register themselves with a common name. Instances to be created by dynamic classloading viaCommandLineProgramRegistry.obainCommandLineProgram(String)are expected to declare a public constructor without arguments. Please call alwaysprepare()beforeexecute(String[], String, PrintStream, PrintStream)to obtain a fresh instance if needed, e.g., in case that the command line program maintains a certain state.- Author:
- Holger Eichelberger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intexecute(java.lang.String[] args, java.lang.String workingDirectory, java.io.PrintStream stdout, java.io.PrintStream stderr)Executes a command line program.ICommandLineProgramprepare()Prepares for execution.
-
-
-
Method Detail
-
execute
int execute(java.lang.String[] args, java.lang.String workingDirectory, java.io.PrintStream stdout, java.io.PrintStream stderr)Executes a command line program.- Parameters:
args- the program argumentsworkingDirectory- the working directorystdout- the stdout streamstderr- the stderr stream- Returns:
- the command line return code
-
prepare
ICommandLineProgram prepare()
Prepares for execution.- Returns:
- the instance to be executed, may be this or a differnt instance
-
-