|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.iges.grads.server.Task
A wrapper for invoking an external process.
| Field Summary | |
protected java.lang.String[] |
cmd
|
protected java.lang.String |
cmdString
|
protected java.lang.String[] |
env
|
protected static java.lang.String |
ERROR_INDICATOR
String that subprocesses can print to indicate to the server that an error has occurred in their processing. |
protected java.lang.StringBuffer |
output
|
protected long |
timeLimit
|
protected java.io.File |
workDir
|
| Constructor Summary | |
Task(java.lang.String[] cmd,
java.lang.String[] env,
java.io.File workDir,
long timeLimit)
Sets up an external process. |
|
| Method Summary | |
protected java.lang.String |
buildCmdString(java.lang.String[] cmd)
Turns an array of Strings into a single space-separated String |
protected void |
checkErrors()
Parses output looking for error messages, defined as lines beginning with the string contained in ERROR_INDICATOR (currently "error: "). |
protected void |
finish(java.lang.Process process,
long startTime)
Waits for a running process to complete (or time out), and then performs cleanup and error-handling tasks. |
java.lang.String |
getCmd()
Returns a printable string version of the external command. |
java.lang.String |
getOutput()
Returns a string version of the command's console output |
void |
run()
Executes the external process, returning when it is finished or when it exceeds the time limit specified in the constructor. |
void |
run(long timeLimit)
Executes the external process, returning when it is finished or when it exceeds the time limit specified. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static java.lang.String ERROR_INDICATOR
protected java.lang.StringBuffer output
protected java.lang.String cmdString
protected java.lang.String[] cmd
protected java.lang.String[] env
protected java.io.File workDir
protected long timeLimit
| Constructor Detail |
public Task(java.lang.String[] cmd,
java.lang.String[] env,
java.io.File workDir,
long timeLimit)
| Method Detail |
public void run()
throws AnagramException
AnagramException - If the process fails, or if the
output parser finds an error message in the output.
public void run(long timeLimit)
throws AnagramException
timeLimit - Overrides the time limit specified in the constructor.
AnagramException - If the process fails, or if there is an error
message (a line beginning with "error: ") in the output.public java.lang.String getCmd()
public java.lang.String getOutput()
protected java.lang.String buildCmdString(java.lang.String[] cmd)
protected void finish(java.lang.Process process,
long startTime)
throws AnagramException
AnagramException
protected void checkErrors()
throws AnagramException
AnagramException - if a line containing an error message
is found.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||