|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.sadun.util.CommandRunner
A class to run a command in a separate thread, monitor its progress via a monitor window and being notified of its completion, exit status, and elasped time.
Nested Class Summary | |
static class |
CommandRunner.Adapter
An helper class which implements all the methods in the CommandRunner.Listener interface in an
empty way. |
static interface |
CommandRunner.Listener
Classes implementing this interface may receive CommandRunner events. |
static class |
CommandRunner.StdOutAdapter
|
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
CommandRunner(java.lang.Class cls,
java.lang.String[] args)
Create a command runner with no parent window, running a class' main() method with the given arguments. |
|
CommandRunner(java.lang.Class cls,
java.lang.String[] args,
boolean daemon)
Create a command runner with no parent window, running a class' main() method with the given arguments. |
|
CommandRunner(java.awt.Component parent,
java.lang.Class cls,
java.lang.String[] args)
Create a command runner with the given parent window, running a class' main() method with the given arguments. |
|
CommandRunner(java.awt.Component parent,
java.lang.Class cls,
java.lang.String[] args,
boolean daemon)
Create a command runner with given parent window, running a class' main() method with the given arguments. |
|
CommandRunner(java.awt.Component parent,
java.lang.String command,
java.lang.String[] args)
Create a command runner with given parent window, running a system command with the given arguments. |
|
CommandRunner(java.awt.Component parent,
java.lang.String command,
java.lang.String[] args,
boolean daemon)
Create a command runner with given parent window, running a system command with the given arguments. |
|
CommandRunner(java.lang.String command,
java.lang.String[] args)
Create a command runner with no parent window, running a system command with the given arguments. |
|
CommandRunner(java.lang.String command,
java.lang.String[] args,
boolean daemon)
Create a command runner with no parent window, running a system command with the given arguments. |
Method Summary | |
void |
addListener(CommandRunner.Listener listener)
Add a listener to the listener set. |
java.lang.String |
getLastOutput()
Returns the output of the last execution, or null if either no execution has occurred yet, or isCaptureOutput() is false. |
boolean |
isCaptureOutput()
Return true if the runner is set to capture and store the output of the program run. |
boolean |
isCloseWindowOnTermination()
Returns the closeWindowOnTermination. |
boolean |
isOpenWindowOnStartup()
Returns the openWindowOnStartup. |
boolean |
isOutputElapsedTime()
Returns the outputElapsedTime. |
boolean |
isOutputOnSystemOut()
Returns the outputOnSystemOut. |
static void |
main(java.lang.String[] args)
|
void |
removeListener(CommandRunner.Listener listener)
Remove a listener to the listener set. |
void |
run()
Run the command. |
void |
setCaptureOutput(boolean captureOutput)
Set the capture-output property. |
void |
setCloseWindowOnTermination(boolean closeWindowOnTermination)
Sets the closeWindowOnTermination. |
void |
setOpenWindowOnStartup(boolean openWindowOnStartup)
Sets the openWindowOnStartup. |
void |
setOutputElapsedTime(boolean outputElapsedTime)
Sets the outputElapsedTime. |
void |
setOutputOnSystemOut(boolean outputOnSystemOut)
Set the output-on-system-out property. |
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 CommandRunner(java.awt.Component parent, java.lang.String command, java.lang.String[] args, boolean daemon)
parent
- the parent window for the CommandRunner monitorcommand
- the executable to runargs
- the arguments to pass to the executabledaemon
- the daemon status of this Thread
public CommandRunner(java.awt.Component parent, java.lang.Class cls, java.lang.String[] args, boolean daemon)
parent
- the parent window for the CommandRunner monitorcls
- the class whose main method is to be runargs
- the arguments to pass to the executabledaemon
- the daemon status of this Thread
public CommandRunner(java.lang.Class cls, java.lang.String[] args, boolean daemon)
cls
- the class whose main method is to be runargs
- the arguments to pass to the executabledaemon
- the daemon status of this Thread
public CommandRunner(java.awt.Component parent, java.lang.Class cls, java.lang.String[] args)
parent
- the parent window for the CommandRunner monitorcls
- the class whose main method is to be runargs
- the arguments to pass to the executablepublic CommandRunner(java.lang.Class cls, java.lang.String[] args)
cls
- the class whose main method is to be runargs
- the arguments to pass to the executablepublic CommandRunner(java.lang.String command, java.lang.String[] args, boolean daemon)
command
- the executable to runargs
- the arguments to pass to the executabledaemon
- the daemon status of this Thread
public CommandRunner(java.awt.Component parent, java.lang.String command, java.lang.String[] args)
parent
- the parent window for the CommandRunner monitorcommand
- the executable to runargs
- the arguments to pass to the executablepublic CommandRunner(java.lang.String command, java.lang.String[] args)
command
- the executable to runargs
- the arguments to pass to the executableMethod Detail |
public void addListener(CommandRunner.Listener listener)
run()
, each
listener is notifyed of events concerning the run via its
CommandRunner.Listener
interface, in
arbitrary order.
listener
- the CommandRunner.Listener
object to add.public void removeListener(CommandRunner.Listener listener)
listener
- the CommandRunner.Listener
object to remove.public void run()
addListener
is notifyed of events concerning the run via its
CommandRunner.Listener
interface, in
arbitrary order.
public boolean isCloseWindowOnTermination()
public boolean isOpenWindowOnStartup()
public boolean isOutputOnSystemOut()
public void setCloseWindowOnTermination(boolean closeWindowOnTermination)
closeWindowOnTermination
- The closeWindowOnTermination to setpublic void setOpenWindowOnStartup(boolean openWindowOnStartup)
openWindowOnStartup
- The openWindowOnStartup to setpublic void setOutputOnSystemOut(boolean outputOnSystemOut)
outputOnSystemOut
- The outputOnSystemOut to setpublic boolean isCaptureOutput()
getLastOutput()
public java.lang.String getLastOutput()
isCaptureOutput()
is false.
public void setCaptureOutput(boolean captureOutput)
getLastOutput()
.
captureOutput
- The value to set.public boolean isOutputElapsedTime()
public void setOutputElapsedTime(boolean outputElapsedTime)
outputElapsedTime
- The outputElapsedTime to setpublic static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |