public abstract class ShellBase extends java.lang.Object implements ShellCommandMapper, GetlineCompleter, SIGINT
| Modifier and Type | Field and Description |
|---|---|
protected java.io.PrintStream |
err |
protected Getline |
gl |
protected java.io.PrintStream |
out |
static java.lang.String |
PROP_PAGE_SIZE |
| Constructor and Description |
|---|
ShellBase() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
complete(ShellCommandHandler handler,
java.lang.String line) |
java.lang.String |
complete(java.lang.String line) |
java.util.Iterator |
getCommandNameIterator()
Get an iterator for the command names.
|
org.hyperic.sigar.pager.PageControl |
getDefaultPageControl() |
java.io.PrintStream |
getErrStream() |
Getline |
getGetline() |
ShellCommandHandler |
getHandler(java.lang.String command)
Get the command handler for a command.
|
java.lang.String |
getHiddenInput(java.lang.String prompt)
If a command needs additional input via the console, they
can get it this way.
|
java.lang.String |
getInput(java.lang.String prompt)
If a command needs additional input via the console, they
can get it this way.
|
java.lang.String |
getInput(java.lang.String prompt,
boolean addToHistory)
If a command needs additional input via the console, they
can get it this way.
|
java.io.PrintStream |
getOutStream() |
int |
getPageSize()
Get the current page size used when paging data.
|
void |
handleCommand(java.lang.String line) |
void |
handleCommand(java.lang.String line,
java.lang.String[] args) |
boolean |
handlerIsHidden(java.lang.String handlerName) |
void |
handleSIGINT() |
boolean |
hasCompleter(ShellCommandHandler handler) |
void |
init(java.lang.String applicationName,
java.io.PrintStream out,
java.io.PrintStream err) |
void |
initHistory() |
void |
initHistory(java.io.File file) |
boolean |
isRedirected()
Check to see if the currently running shell command is being
redirected to a file.
|
void |
performPaging(org.hyperic.sigar.pager.PageFetcher fetcher) |
void |
performPaging(org.hyperic.sigar.pager.PageFetcher fetcher,
org.hyperic.sigar.pager.PageControl control) |
void |
processCommand(ShellCommandHandler handler,
java.lang.String[] args) |
void |
readRCFile(java.io.File rcFile,
boolean echoCommands)
Read a .rc file into the shell, invoking everything in it (without
saving the actions to history)
|
void |
registerCommandHandler(java.lang.String commandName,
ShellCommandHandler handler)
Register a new command handler.
|
void |
registerSigIntHandler() |
void |
run() |
void |
sendToErrStream(java.lang.String s)
Write a string to this shell's output stream.
|
void |
sendToOutStream(java.lang.String s)
Write a string to this shell's output stream.
|
void |
setHandlerHidden(java.lang.String handlerName,
boolean isHidden) |
void |
setPageSize(int size)
Set the page size for data paging.
|
void |
setPrompt(java.lang.String prompt)
Change the prompt
|
void |
shutdown() |
public static final java.lang.String PROP_PAGE_SIZE
protected Getline gl
protected java.io.PrintStream out
protected java.io.PrintStream err
public void handleSIGINT()
handleSIGINT in interface SIGINTpublic void initHistory()
throws java.io.IOException
java.io.IOExceptionpublic void initHistory(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic void registerSigIntHandler()
public void init(java.lang.String applicationName,
java.io.PrintStream out,
java.io.PrintStream err)
public void readRCFile(java.io.File rcFile,
boolean echoCommands)
throws java.io.IOException
rcFile - File to readjava.io.IOExceptionpublic void setPrompt(java.lang.String prompt)
prompt - public void registerCommandHandler(java.lang.String commandName,
ShellCommandHandler handler)
throws ShellCommandInitException
commandName - The command that this handler will process.handler - The handler to register.ShellCommandInitExceptionpublic java.lang.String getInput(java.lang.String prompt)
throws java.io.EOFException,
java.io.IOException
prompt - The prompt to display.java.io.EOFExceptionjava.io.IOExceptionpublic java.lang.String getInput(java.lang.String prompt,
boolean addToHistory)
throws java.io.EOFException,
java.io.IOException
prompt - The prompt to display.addToHistory - If true, the input entered will be added to the
history file.java.io.EOFExceptionjava.io.IOExceptionpublic java.lang.String getHiddenInput(java.lang.String prompt)
throws java.io.EOFException,
java.io.IOException
prompt - The prompt to display.java.io.EOFExceptionjava.io.IOExceptionpublic void sendToOutStream(java.lang.String s)
s - The string to write to the output stream.public void sendToErrStream(java.lang.String s)
s - The string to write to the output stream.public void run()
public void handleCommand(java.lang.String line)
public void handleCommand(java.lang.String line,
java.lang.String[] args)
public void processCommand(ShellCommandHandler handler, java.lang.String[] args) throws ShellCommandUsageException, ShellCommandExecException
public java.io.PrintStream getOutStream()
public java.io.PrintStream getErrStream()
public Getline getGetline()
public boolean hasCompleter(ShellCommandHandler handler)
public java.lang.String complete(ShellCommandHandler handler, java.lang.String line)
public java.lang.String complete(java.lang.String line)
complete in interface GetlineCompleterpublic ShellCommandHandler getHandler(java.lang.String command)
ShellCommandMappergetHandler in interface ShellCommandMapperShellCommandMapper.getHandler(java.lang.String)public void setHandlerHidden(java.lang.String handlerName,
boolean isHidden)
public boolean handlerIsHidden(java.lang.String handlerName)
public java.util.Iterator getCommandNameIterator()
ShellCommandMappergetCommandNameIterator in interface ShellCommandMapperShellCommandMapper.getCommandNameIterator()public void shutdown()
public boolean isRedirected()
public void setPageSize(int size)
size - Number of rows to include in a page of data -- if
0, then unlimited rows will be used.public int getPageSize()
public org.hyperic.sigar.pager.PageControl getDefaultPageControl()
public void performPaging(org.hyperic.sigar.pager.PageFetcher fetcher)
throws org.hyperic.sigar.pager.PageFetchException
org.hyperic.sigar.pager.PageFetchExceptionpublic void performPaging(org.hyperic.sigar.pager.PageFetcher fetcher,
org.hyperic.sigar.pager.PageControl control)
throws org.hyperic.sigar.pager.PageFetchException
org.hyperic.sigar.pager.PageFetchExceptionCopyright ? 2004-2011 Hyperic. All Rights Reserved.