com.metamatrix.core.commandshell
Class CommandShell

java.lang.Object
  extended by com.metamatrix.core.commandshell.CommandShell
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ConnectorShell

public class CommandShell
extends java.lang.Object
implements java.lang.Cloneable

Reads input from standard input and directs commands read to the underlying target object.


Field Summary
static java.lang.String DEFAULT_LOG_FILE
           
 
Constructor Summary
CommandShell(CommandTarget commandTarget)
           
 
Method Summary
 CommandShell copy(CommandTarget commandTarget)
           
 java.lang.String execute(java.lang.String commandLine)
          Run a single command as if it was entered on standard input.
 java.lang.String expandFileName(java.lang.String localFileName)
           
protected  java.lang.String getCommandPrompt()
           
 java.lang.String getHelp()
           
 java.lang.String getNextCommandLine()
           
protected  java.lang.String[] getParameterNames(java.lang.String methodName)
           
 java.lang.String[] getScriptNames(java.lang.String fileName)
           
 java.lang.Object getTarget()
           
 void quit()
           
 void run(java.lang.String[] args, java.lang.String logFile)
          Start reading commands from standard input.
 void runScript(java.lang.String fileName, java.lang.String scriptName, java.lang.StringBuffer transcript, ScriptResultListener listener)
          Load a series of commands from a specific script in a file and execute the commands.
 void setDefaultFilePath(java.lang.String defaultFilePath)
           
 void setPrintStackTraceOnException(boolean printStackTraceOnException)
           
 void setSilent(boolean silent)
           
protected  boolean showHelpFor(java.lang.String methodName, java.util.Set methodsToIgnore)
           
 void turnOffExceptionHandling()
           
 void turnOnExceptionHandling()
           
 void write(java.lang.String text)
           
 void writeln(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOG_FILE

public static final java.lang.String DEFAULT_LOG_FILE
See Also:
Constant Field Values
Constructor Detail

CommandShell

public CommandShell(CommandTarget commandTarget)
Method Detail

copy

public CommandShell copy(CommandTarget commandTarget)

setDefaultFilePath

public void setDefaultFilePath(java.lang.String defaultFilePath)

expandFileName

public java.lang.String expandFileName(java.lang.String localFileName)

run

public void run(java.lang.String[] args,
                java.lang.String logFile)
Start reading commands from standard input.


writeln

public void writeln(java.lang.String text)

write

public void write(java.lang.String text)

getCommandPrompt

protected java.lang.String getCommandPrompt()

quit

public void quit()

getScriptNames

public java.lang.String[] getScriptNames(java.lang.String fileName)

runScript

public void runScript(java.lang.String fileName,
                      java.lang.String scriptName,
                      java.lang.StringBuffer transcript,
                      ScriptResultListener listener)
Load a series of commands from a specific script in a file and execute the commands.

Parameters:
fileName - The name of the file containing the script to run.
scriptName - The name of the script within the file.
transcript - Results of each command will be written to here.
listener - When the script indicates the results should be checked, this object will be invoked.

getNextCommandLine

public java.lang.String getNextCommandLine()
                                    throws java.io.IOException
Throws:
java.io.IOException

getTarget

public java.lang.Object getTarget()

getHelp

public java.lang.String getHelp()

showHelpFor

protected boolean showHelpFor(java.lang.String methodName,
                              java.util.Set methodsToIgnore)

getParameterNames

protected java.lang.String[] getParameterNames(java.lang.String methodName)

turnOnExceptionHandling

public void turnOnExceptionHandling()

turnOffExceptionHandling

public void turnOffExceptionHandling()

setPrintStackTraceOnException

public void setPrintStackTraceOnException(boolean printStackTraceOnException)

execute

public java.lang.String execute(java.lang.String commandLine)
Run a single command as if it was entered on standard input.

Parameters:
commandLine - The command to execute.
Returns:
The results of executing the command on the target object.

setSilent

public void setSilent(boolean silent)


Copyright © 2009. All Rights Reserved.