alma::acs::commandcenter::engine::NativeCommand Class Reference

Collaboration diagram for alma::acs::commandcenter::engine::NativeCommand:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

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.

Author:
mschilli

Constructor & Destructor Documentation

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]
alma::acs::commandcenter::engine::NativeCommand::NativeCommand ( String  command,
boolean  foreground,
long  maxExecutionTime,
String  endMark,
long  interval,
long  delay 
) [inline]

References log, NEW, and status.


Member Function Documentation

void alma::acs::commandcenter::engine::NativeCommand::addListener ( NativeCommand.Listener  po  )  [inline]
void alma::acs::commandcenter::engine::NativeCommand::changeStatus ( String  newStatus  )  [inline, protected]
void alma::acs::commandcenter::engine::NativeCommand::fireOutputWritten ( InputStream  sourceStream,
String  additionalOutput 
) [inline, protected]
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]
Returns:
null if no exit value due to ungraceful process death

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.

Returns:

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]
void alma::acs::commandcenter::engine::NativeCommand::removeListener ( NativeCommand.Listener  po  )  [inline]

References listeners.

void alma::acs::commandcenter::engine::NativeCommand::run (  )  [inline]
void alma::acs::commandcenter::engine::NativeCommand::send ( String  text  )  [inline]

Writes the given text to the STDIN of the process.

Parameters:
text the input to send to the process

References command, log, process, and stdin.

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.

Parameters:
threads - null for default

References threadFactory, and threadFactoryDefault.


Member Data Documentation

final String alma::acs::commandcenter::engine::NativeCommand::CANNOTRUN = "unable to run" [static]

Referenced by NativeCommand().

Referenced by NativeCommand().

Referenced by run().

Referenced by run().

Referenced by run().

Referenced by run().

Vector<NativeCommand.Listener> alma::acs::commandcenter::engine::NativeCommand::listeners = new Vector<NativeCommand.Listener>() [protected]

Referenced by NativeCommand().

Referenced by run(), and send().

Referenced by run(), and setThreadFactory().

Initial value:
 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]

Referenced by run().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2