|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
com.jcorporate.expresso.core.misc.OSProcess
This is a class that wraps another process in the machine. It is not like the ANT wrappers that can launch another java program with full environment of the parent, but you can launch other java programs through command line usage.
Typical usage:
OSProcess process = new OSProcess("/usr/bin/perl /home/mydir/scripts/updatecounts.pl");
process.runProcess();
//Now print out the results to std out.
Vector result = process.getStdout();
for (Iterator i = result.iterator(); i.hasNext(); ) {
System.out.println((String)i.next());
}
| Field Summary |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
OSProcess(String commandLine)
Constructor |
|
| Method Summary | |
DBException |
getException()
?? |
int |
getExitValue()
Retrieve the operating system exit value. |
Vector |
getStderr()
Retrieve a vector of all lines printed to std error |
Vector |
getStdout()
Retrieve a vector of all lines printed to std out |
static void |
main(String[] args)
Test-harness method to allow OSProcess to be run & tested from the command line |
void |
run()
Run the process - do not call this method directly! |
void |
runProcess()
Run the process on the server, timing out when required |
void |
setTimeOut(long newSleepInterval,
int newMaxSleeps)
Set a timeout for the command |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public OSProcess(String commandLine)
commandLine - The command line to execute on the server| Method Detail |
public DBException getException()
public int getExitValue()
throws DBException
DBExceptionpublic Vector getStderr()
public Vector getStdout()
public static void main(String[] args)
args - public void run()
public void runProcess()
throws DBException
DBException - If the process times out
public void setTimeOut(long newSleepInterval,
int newMaxSleeps)
newSleepInterval - Number of seconds to sleep between checksnewMaxSleeps - Number of times to check before timing out
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||