
Classes | |
| interface | Listener |
| class | ListenerAdapter |
| class | Reader |
| class | Spawner |
| class | Watcher |
Public Member Functions | |
| NativeCommand (String command, boolean foreground) | |
| NativeCommand (String command, boolean foreground, long maxExecutionTime) | |
| NativeCommand (String command, boolean foreground, long maxExecutionTime, String endMark) | |
| NativeCommand (String command, boolean foreground, long maxExecutionTime, String endMark, long interval, long delay) | |
| void | setThreadFactory (ThreadFactory threads) |
| void | addListener (NativeCommand.Listener po) |
| void | removeListener (NativeCommand.Listener po) |
| String | getStatus () |
| Integer | getExitValue () |
| Throwable | getLatestException () |
| void | send (String text) |
| void | run () |
Static Public Attributes | |
| static final String | NEW = "new" |
| static final String | RUNNING = "running" |
| static final String | TERMINATED = "terminated" |
| static final String | CANNOTRUN = "unable to run" |
| static final String | TIMEOUT = "timed out" |
| static final long | NO_TIMEOUT = -1 |
| static long | DEFAULT_WATCHER_INTERVAL = 1000 |
| static long | DEFAULT_WATCHER_DELAY = 500 |
Protected Member Functions | |
| void | changeStatus (String newStatus) |
| void | fireStatusChanged (String oldStatus, String newStatus) |
| void | fireOutputWritten (InputStream sourceStream, String additionalOutput) |
Protected Attributes | |
| OutputStreamWriter | stdin |
| Vector< NativeCommand.Listener > | listeners = new Vector<NativeCommand.Listener>() |
| String | command |
| Process | process |
| long | interval |
| long | delay |
| long | maxExecutionTime |
| String | status |
| boolean | foreground |
| String | endMark |
| Throwable | latestException |
| Integer | exitValue = null |
| Logger | log |
| ThreadFactory | threadFactoryDefault |
| ThreadFactory | threadFactory = threadFactoryDefault |
Static Protected Attributes | |
| static Timer | watchers |
Describes and encapsulates a native command. A native command triggers a process, and provides various bells and whistles around the pure process object as provided by the Java Runtime.
The native command can be run a) within its own thread (as it implements Runnable), or b) directly via a call to its run() method.
| alma::acs::commandcenter::engine::NativeCommand::NativeCommand | ( | String | command, | |
| boolean | foreground | |||
| ) | [inline] |
References NO_TIMEOUT.
| alma::acs::commandcenter::engine::NativeCommand::NativeCommand | ( | String | command, | |
| boolean | foreground, | |||
| long | maxExecutionTime | |||
| ) | [inline] |
| alma::acs::commandcenter::engine::NativeCommand::NativeCommand | ( | String | command, | |
| boolean | foreground, | |||
| long | maxExecutionTime, | |||
| String | endMark | |||
| ) | [inline] |
References DEFAULT_WATCHER_DELAY, and DEFAULT_WATCHER_INTERVAL.
| alma::acs::commandcenter::engine::NativeCommand::NativeCommand | ( | String | command, | |
| boolean | foreground, | |||
| long | maxExecutionTime, | |||
| String | endMark, | |||
| long | interval, | |||
| long | delay | |||
| ) | [inline] |
| void alma::acs::commandcenter::engine::NativeCommand::addListener | ( | NativeCommand.Listener | po | ) | [inline] |
References listeners.
Referenced by alma::acs::commandcenter::engine::Executor::localOutProc(), and alma::acs::commandcenter::engine::Executor::remoteNative().
| void alma::acs::commandcenter::engine::NativeCommand::changeStatus | ( | String | newStatus | ) | [inline, protected] |
References fireStatusChanged(), process, status, and TERMINATED.
Referenced by alma::acs::commandcenter::engine::NativeCommand::Watcher::run(), and alma::acs::commandcenter::engine::NativeCommand::Spawner::run().
| void alma::acs::commandcenter::engine::NativeCommand::fireOutputWritten | ( | InputStream | sourceStream, | |
| String | additionalOutput | |||
| ) | [inline, protected] |
References listeners, and process.
Referenced by alma::acs::commandcenter::engine::NativeCommand::Reader::run().
| void alma::acs::commandcenter::engine::NativeCommand::fireStatusChanged | ( | String | oldStatus, | |
| String | newStatus | |||
| ) | [inline, protected] |
References listeners.
Referenced by changeStatus().
| Integer alma::acs::commandcenter::engine::NativeCommand::getExitValue | ( | ) | [inline] |
References exitValue.
Referenced by alma::acs::commandcenter::engine::Executor::localOutProc(), and alma::acs::commandcenter::engine::Executor::remoteNative().
| Throwable alma::acs::commandcenter::engine::NativeCommand::getLatestException | ( | ) | [inline] |
Returns the most recent occured error. Note that the internal exception cache is reset by this method, thus it can only be called once for each error.
References latestException.
Referenced by alma::acs::commandcenter::engine::Executor::localOutProc(), and alma::acs::commandcenter::engine::Executor::remoteNative().
| String alma::acs::commandcenter::engine::NativeCommand::getStatus | ( | ) | [inline] |
References status.
Referenced by alma::acs::commandcenter::engine::Executor::localOutProc(), and alma::acs::commandcenter::engine::Executor::remoteNative().
| void alma::acs::commandcenter::engine::NativeCommand::removeListener | ( | NativeCommand.Listener | po | ) | [inline] |
References listeners.
| void alma::acs::commandcenter::engine::NativeCommand::run | ( | ) | [inline] |
We use four delegates:
The delegates give feedback to the main thread by provoking InterruptedExceptions on it.
References CANNOTRUN, delay, endMark, foreground, alma::acs::commandcenter::engine::NativeCommand::Reader::interruptThreadOnExpectedOutput(), alma::acs::commandcenter::engine::NativeCommand::Watcher::interruptThreadOnTaskTermination(), interval, log, process, alma::acs::commandcenter::engine::NativeCommand::Spawner::run(), status, stdin, threadFactory, and watchers.
Referenced by alma::acs::commandcenter::engine::Executor::localOutProc(), and alma::acs::commandcenter::engine::Executor::remoteNative().
| void alma::acs::commandcenter::engine::NativeCommand::send | ( | String | text | ) | [inline] |
| void alma::acs::commandcenter::engine::NativeCommand::setThreadFactory | ( | ThreadFactory | threads | ) | [inline] |
This class executes various actions concurrently. With this setter, clients can control the threads to be used.
| threads | - null for default |
References threadFactory, and threadFactoryDefault.
final String alma::acs::commandcenter::engine::NativeCommand::CANNOTRUN = "unable to run" [static] |
String alma::acs::commandcenter::engine::NativeCommand::command [protected] |
Referenced by alma::acs::commandcenter::engine::NativeCommand::Spawner::run(), and send().
long alma::acs::commandcenter::engine::NativeCommand::DEFAULT_WATCHER_DELAY = 500 [static] |
Referenced by NativeCommand().
long alma::acs::commandcenter::engine::NativeCommand::DEFAULT_WATCHER_INTERVAL = 1000 [static] |
Referenced by NativeCommand().
long alma::acs::commandcenter::engine::NativeCommand::delay [protected] |
Referenced by run().
String alma::acs::commandcenter::engine::NativeCommand::endMark [protected] |
Referenced by run().
Integer alma::acs::commandcenter::engine::NativeCommand::exitValue = null [protected] |
Referenced by getExitValue(), and alma::acs::commandcenter::engine::NativeCommand::Watcher::run().
boolean alma::acs::commandcenter::engine::NativeCommand::foreground [protected] |
Referenced by run().
long alma::acs::commandcenter::engine::NativeCommand::interval [protected] |
Referenced by run().
Throwable alma::acs::commandcenter::engine::NativeCommand::latestException [protected] |
Referenced by getLatestException(), and alma::acs::commandcenter::engine::NativeCommand::Spawner::run().
Vector<NativeCommand.Listener> alma::acs::commandcenter::engine::NativeCommand::listeners = new Vector<NativeCommand.Listener>() [protected] |
Referenced by addListener(), fireOutputWritten(), fireStatusChanged(), and removeListener().
Logger alma::acs::commandcenter::engine::NativeCommand::log [protected] |
Referenced by NativeCommand(), alma::acs::commandcenter::engine::NativeCommand::Reader::run(), run(), and send().
long alma::acs::commandcenter::engine::NativeCommand::maxExecutionTime [protected] |
final String alma::acs::commandcenter::engine::NativeCommand::NEW = "new" [static] |
Referenced by NativeCommand().
final long alma::acs::commandcenter::engine::NativeCommand::NO_TIMEOUT = -1 [static] |
Referenced by NativeCommand(), and alma::acs::commandcenter::engine::NativeCommand::Watcher::run().
Process alma::acs::commandcenter::engine::NativeCommand::process [protected] |
final String alma::acs::commandcenter::engine::NativeCommand::RUNNING = "running" [static] |
String alma::acs::commandcenter::engine::NativeCommand::status [protected] |
Referenced by changeStatus(), getStatus(), NativeCommand(), alma::acs::commandcenter::engine::NativeCommand::Watcher::run(), and run().
OutputStreamWriter alma::acs::commandcenter::engine::NativeCommand::stdin [protected] |
final String alma::acs::commandcenter::engine::NativeCommand::TERMINATED = "terminated" [static] |
Referenced by changeStatus(), and alma::acs::commandcenter::engine::NativeCommand::Watcher::run().
ThreadFactory alma::acs::commandcenter::engine::NativeCommand::threadFactory = threadFactoryDefault [protected] |
Referenced by run(), and setThreadFactory().
ThreadFactory alma::acs::commandcenter::engine::NativeCommand::threadFactoryDefault [protected] |
new ThreadFactory(){ public Thread newThread (Runnable r) { return new Thread(r); } }
The default thread factory for background actions.
Referenced by setThreadFactory().
final String alma::acs::commandcenter::engine::NativeCommand::TIMEOUT = "timed out" [static] |
Timer alma::acs::commandcenter::engine::NativeCommand::watchers [static, protected] |
Referenced by run().
1.6.2