com.stericson.RootTools.execution
Class Command

java.lang.Object
  extended by com.stericson.RootTools.execution.Command
Direct Known Subclasses:
CommandCapture, JavaCommandCapture

public abstract class Command
extends java.lang.Object


Constructor Summary
Command(int id, boolean handlerEnabled, boolean javaCommand, android.content.Context context, java.lang.String... command)
          Constructor for executing Java commands rather than binaries
Command(int id, boolean javaCommand, android.content.Context context, java.lang.String... command)
          Constructor for executing Java commands rather than binaries
Command(int id, boolean handlerEnabled, java.lang.String... command)
          Constructor for executing a normal shell command
Command(int id, int timeout, boolean javaCommand, android.content.Context context, java.lang.String... command)
          Constructor for executing Java commands rather than binaries
Command(int id, int timeout, java.lang.String... command)
          Constructor for executing a normal shell command
Command(int id, java.lang.String... command)
          Constructor for executing a normal shell command
 
Method Summary
abstract  void commandCompleted(int id, int exitCode)
           
protected  void commandFinished()
           
abstract  void commandOutput(int id, java.lang.String line)
           
abstract  void commandTerminated(int id, java.lang.String reason)
           
protected  void finishCommand()
           
 java.lang.String getCommand()
           
 int getExitCode()
           
 boolean isExecuting()
           
 boolean isFinished()
           
 boolean isHandlerEnabled()
           
protected  void output(int id, java.lang.String line)
           
protected  void setExitCode(int code)
           
protected  void startExecution()
           
 void terminate(java.lang.String reason)
           
protected  void terminated(java.lang.String reason)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command(int id,
               java.lang.String... command)
Constructor for executing a normal shell command

Parameters:
id - the id of the command being executed
command - the command, or commands, to be executed.

Command

public Command(int id,
               boolean handlerEnabled,
               java.lang.String... command)
Constructor for executing a normal shell command

Parameters:
id - the id of the command being executed
handlerEnabled - when true the handler will be used to call the callback methods if possible.
command - the command, or commands, to be executed.

Command

public Command(int id,
               int timeout,
               java.lang.String... command)
Constructor for executing a normal shell command

Parameters:
id - the id of the command being executed
timeout - the time allowed before the shell will give up executing the command and throw a TimeoutException.
command - the command, or commands, to be executed.

Command

public Command(int id,
               boolean javaCommand,
               android.content.Context context,
               java.lang.String... command)
Constructor for executing Java commands rather than binaries

Parameters:
javaCommand - when True, it is a java command.
context - needed to execute java command.

Command

public Command(int id,
               boolean handlerEnabled,
               boolean javaCommand,
               android.content.Context context,
               java.lang.String... command)
Constructor for executing Java commands rather than binaries

Parameters:
javaCommand - when True, it is a java command.
context - needed to execute java command.

Command

public Command(int id,
               int timeout,
               boolean javaCommand,
               android.content.Context context,
               java.lang.String... command)
Constructor for executing Java commands rather than binaries

Parameters:
javaCommand - when True, it is a java command.
context - needed to execute java command.
Method Detail

commandOutput

public abstract void commandOutput(int id,
                                   java.lang.String line)

commandTerminated

public abstract void commandTerminated(int id,
                                       java.lang.String reason)

commandCompleted

public abstract void commandCompleted(int id,
                                      int exitCode)

finishCommand

protected void finishCommand()

commandFinished

protected void commandFinished()

getCommand

public java.lang.String getCommand()

isExecuting

public boolean isExecuting()

isHandlerEnabled

public boolean isHandlerEnabled()

isFinished

public boolean isFinished()

getExitCode

public int getExitCode()

setExitCode

protected void setExitCode(int code)

startExecution

protected void startExecution()

terminate

public void terminate(java.lang.String reason)

terminated

protected void terminated(java.lang.String reason)

output

protected void output(int id,
                      java.lang.String line)