com.adventnet.utils.agent
Class RunCmd

java.lang.Object
  extended by java.lang.Thread
      extended by com.adventnet.utils.agent.RunCmd
All Implemented Interfaces:
java.lang.Runnable

public class RunCmd
extends java.lang.Thread

This Utility class is for executing the Various run time commands of the Agent.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 java.lang.String command
          The Command given for execution.
 int exitValue
          The Success or Failure of the Process Executed.
(package private)  java.lang.Process proc
           
(package private)  RunCmd readErr
           
 boolean result
          True if the Command is executed.
 java.lang.StringBuffer stderr
          This is the Standard Error Values after the Command execution.
 java.lang.StringBuffer stdout
          This is the Standard Output Buffer after the execution of the command.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RunCmd()
           
RunCmd(java.lang.String cmd)
          The Default Constructor for RunCmd.
 
Method Summary
 java.lang.StringBuffer getError()
          This methos is the Getter for the Errors occured during the Execution.
 boolean getStdErr()
          The routine to read the standard error Value.
 void run()
          The run method - needed for kicking off a process.
 boolean runCommand(java.lang.String cmd)
          Runs a command and returns true on zero exit.
 void stopCommand()
          To stop the thread and the process.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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
 

Field Detail

command

public java.lang.String command
The Command given for execution.


stdout

public java.lang.StringBuffer stdout
This is the Standard Output Buffer after the execution of the command.


stderr

public java.lang.StringBuffer stderr
This is the Standard Error Values after the Command execution.


result

public boolean result
True if the Command is executed.


exitValue

public int exitValue
The Success or Failure of the Process Executed.


proc

java.lang.Process proc

readErr

RunCmd readErr
Constructor Detail

RunCmd

RunCmd()

RunCmd

public RunCmd(java.lang.String cmd)
The Default Constructor for RunCmd.

Parameters:
cmd - the Command to be executed.
Method Detail

run

public void run()
The run method - needed for kicking off a process.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

runCommand

public boolean runCommand(java.lang.String cmd)
Runs a command and returns true on zero exit.

Parameters:
cmd - The Coammand to be Executed.
Returns:
True id the Command is executed.

getError

public java.lang.StringBuffer getError()
This methos is the Getter for the Errors occured during the Execution.

Returns:
The Errors occured.

getStdErr

public boolean getStdErr()
The routine to read the standard error Value.

Returns:
The Boolean Value for the error.

stopCommand

public void stopCommand()
To stop the thread and the process.