|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.util.SysExec
public class SysExec
This class defines a way to execute system commands
Nested Class Summary | |
---|---|
static interface |
SysExec.ErrOutWriter
Inner interface for output & error streams. |
Field Summary | |
---|---|
java.lang.String |
errorMessage
|
simtools.util.SysExec.ErrPrintThread |
errPrintThread
This thread manages with the stderr of the process. |
static int |
EXEC_ERROR
Constant for process execution error. |
int |
exitValue
The exit value of the process (0 == ok) |
boolean |
finished
This flag is used by children threads to know if the process is terminated. |
static int |
KILL_ERROR
Constant for process execution error. |
static int |
MISS_ERROR
Constant for process execution error. |
simtools.util.SysExec.OutPrintThread |
outPrintThread
This thread manages with the stdout of the process. |
static int |
READ_ERROR
Constant for process execution error. |
static int |
SYNC_ERROR
Constant for process execution error. |
static int |
WAIT_ERROR
Constant for process execution error. |
simtools.util.SysExec.WaitThread |
waitThread
This thread waits for the end of the process. |
Constructor Summary | |
---|---|
SysExec()
Initialization of the instance with an empty vector of process execution commands. |
|
SysExec(boolean dumpToLogger)
|
|
SysExec(SysExec.ErrOutWriter theWriter)
|
Method Summary | |
---|---|
void |
add(java.lang.String cmd)
Append a command at the end of the command line currently built. |
boolean |
addEnvVariable(java.lang.String variableName,
java.lang.String variableValue)
add an environment variable |
void |
errPrintln(java.lang.String line)
This method can be overwritten in a derived class to catch each text line sent by the process in its stderr. |
void |
killAll()
Stops the currently working process. |
static void |
main(java.lang.String[] args)
|
void |
outPrintln(java.lang.String line)
This method can be overwritten in a derived class to catch each text line sent by the process in its stdout. |
void |
print()
|
void |
reset()
Remove all commands in the command line currently built. |
int |
run()
Create an external child process to execute the command line currently built, and wait for this process terminates. |
boolean |
setWorkingDirectory(java.lang.String workingDirectoryPath)
set working directory for SysExec |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MISS_ERROR
public static final int WAIT_ERROR
public static final int EXEC_ERROR
public static final int READ_ERROR
public static final int SYNC_ERROR
public static final int KILL_ERROR
public boolean finished
public int exitValue
public java.lang.String errorMessage
public simtools.util.SysExec.OutPrintThread outPrintThread
public simtools.util.SysExec.ErrPrintThread errPrintThread
public simtools.util.SysExec.WaitThread waitThread
Constructor Detail |
---|
public SysExec()
public SysExec(SysExec.ErrOutWriter theWriter)
theWriter:
- an ErrOutWriter object (for output & error streams)public SysExec(boolean dumpToLogger)
dumpToLogger:
- an logger object (for output & error streams)Method Detail |
---|
public void reset()
public void add(java.lang.String cmd)
command
- to append at the end of the command lineUNIX_PreProcH
,
MSDOS_PreProc
public void killAll()
public boolean setWorkingDirectory(java.lang.String workingDirectoryPath)
workingDirectoryPath
- : the path
public boolean addEnvVariable(java.lang.String variableName, java.lang.String variableValue)
variableName
- : the name of the variablevariableValue
- : th value of the variable
public int run()
UNIX_PreProcH
,
MSDOS_PreProc
public void outPrintln(java.lang.String line)
line
- A text line sent by the process in its stdout.public void errPrintln(java.lang.String line)
line
- A text line sent by the process in its stderr.public void print()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |