Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes

alma.acs.commandcenter.engine.NativeCommand Class Reference

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

Member Function Documentation

void alma.acs.commandcenter.engine.NativeCommand.addListener ( NativeCommand.Listener  po  ) 
void alma.acs.commandcenter.engine.NativeCommand.changeStatus ( String  newStatus  )  [protected]
void alma.acs.commandcenter.engine.NativeCommand.fireOutputWritten ( InputStream  sourceStream,
String  additionalOutput 
) [protected]
void alma.acs.commandcenter.engine.NativeCommand.fireStatusChanged ( String  oldStatus,
String  newStatus 
) [protected]
Integer alma.acs.commandcenter.engine.NativeCommand.getExitValue (  ) 
Returns:
null if no exit value due to ungraceful process death

References alma.acs.commandcenter.engine.NativeCommand.exitValue.

Referenced by alma.acs.commandcenter.engine.Executor.localOutProc().

Throwable alma.acs.commandcenter.engine.NativeCommand.getLatestException (  ) 

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 alma.acs.commandcenter.engine.NativeCommand.latestException.

Referenced by alma.acs.commandcenter.engine.Executor.localOutProc().

String alma.acs.commandcenter.engine.NativeCommand.getStatus (  ) 
void alma.acs.commandcenter.engine.NativeCommand.removeListener ( NativeCommand.Listener  po  ) 
void alma.acs.commandcenter.engine.NativeCommand.run (  ) 
void alma.acs.commandcenter.engine.NativeCommand.send ( String  text  ) 
void alma.acs.commandcenter.engine.NativeCommand.setThreadFactory ( ThreadFactory  threads  ) 

This class executes various actions concurrently. With this setter, clients can control the threads to be used.

Parameters:
threads - null for default

References alma.acs.commandcenter.engine.NativeCommand.threadFactory, and alma.acs.commandcenter.engine.NativeCommand.threadFactoryDefault.


Member Data Documentation

final String alma.acs.commandcenter.engine.NativeCommand.CANNOTRUN = "unable to run" [static]
Vector<NativeCommand.Listener> alma.acs.commandcenter.engine.NativeCommand.listeners = new Vector<NativeCommand.Listener>() [protected]
final String alma.acs.commandcenter.engine.NativeCommand.NEW = "new" [static]
final String alma.acs.commandcenter.engine.NativeCommand.RUNNING = "running" [static]
OutputStreamWriter alma.acs.commandcenter.engine.NativeCommand.stdin [protected]
final String alma.acs.commandcenter.engine.NativeCommand.TERMINATED = "terminated" [static]
Initial value:
 new ThreadFactory(){
                public Thread newThread (Runnable r) {
                        return new Thread(r);
                }
        }

The default thread factory for background actions.

Referenced by alma.acs.commandcenter.engine.NativeCommand.setThreadFactory().

final String alma.acs.commandcenter.engine.NativeCommand.TIMEOUT = "timed out" [static]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties