com.adventnet.utilities.common
Class ExecCommand

java.lang.Object
  extended by java.lang.Thread
      extended by com.adventnet.utilities.common.ExecCommand
All Implemented Interfaces:
java.lang.Runnable

public class ExecCommand
extends java.lang.Thread

This Utility class is used to get standard outputs and errors by executing Specific commands.


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 to be executed.
 int exitValue
          The Success or Failure of the Process Executed.
(package private)  java.lang.Process proc
           
(package private)  ExecCommand readErr
           
 boolean result
          True if the result is obtained without error.
 java.lang.StringBuffer stderr
          The Standard Error Value after the Execution of the command.
 java.lang.StringBuffer stdout
          The Standard Output got from the Execution of the Command.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ExecCommand()
           
ExecCommand(java.lang.String cmd)
          The Constuctor for ExecCommand.
 
Method Summary
 java.lang.StringBuffer getError()
          Getter for the Error values.
 java.lang.String getOutput()
          Method to get the Output after the Execution of the command.
 boolean getStdErr()
          The routine to read the standard error.
 void run()
          The run method - needed for kicking off a process.
 boolean runCommand(java.lang.String cmd)
          Method that Runs a command.
 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 to be executed.


stdout

public java.lang.StringBuffer stdout
The Standard Output got from the Execution of the Command.


stderr

public java.lang.StringBuffer stderr
The Standard Error Value after the Execution of the command.


result

public boolean result
True if the result is obtained without error.


exitValue

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


proc

java.lang.Process proc

readErr

ExecCommand readErr
Constructor Detail

ExecCommand

ExecCommand()

ExecCommand

public ExecCommand(java.lang.String cmd)
The Constuctor for ExecCommand.

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)
Method that Runs a command.

Parameters:
cmd - The Command to be executed.
Returns:
True for zero Exit else false.

getError

public java.lang.StringBuffer getError()
Getter for the Error values.

Returns:
The Error StringBuffer.

getStdErr

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

Returns:
The standard error values.

stopCommand

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


getOutput

public java.lang.String getOutput()
Method to get the Output after the Execution of the command.

Returns:
The Standard Output vlaues.