org.apache.accumulo.core.util.shell
Class Shell
java.lang.Object
org.apache.accumulo.core.util.shell.ShellOptions
org.apache.accumulo.core.util.shell.Shell
- Direct Known Subclasses:
- MockShell
public class Shell
- extends ShellOptions
A convenient console interface to perform basic accumulo functions Includes auto-complete, help, and quoted strings with escape sequences
Method Summary |
void |
checkTableState()
|
boolean |
config(String... args)
Configures the shell using the provided options. |
void |
execCommand(String input,
boolean ignoreAuthTimeout,
boolean echoPrompt)
|
ClassLoader |
getClassLoader(org.apache.commons.cli.CommandLine cl,
Shell shellState)
|
Connector |
getConnector()
|
String |
getDefaultPrompt()
|
boolean |
getExit()
|
int |
getExitCode()
|
Class<? extends Formatter> |
getFormatter()
Return the formatter for the current table. |
Class<? extends Formatter> |
getFormatter(String tableName)
Return the formatter for the given table. |
Instance |
getInstance()
|
String |
getPrincipal()
|
jline.console.ConsoleReader |
getReader()
|
String |
getTableName()
|
AuthenticationToken |
getToken()
|
boolean |
hasExited()
|
static boolean |
isDebuggingEnabled()
|
boolean |
isMasking()
|
boolean |
isTabCompletion()
|
boolean |
isVerbose()
|
static void |
main(String[] args)
|
void |
printBinaryRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate)
|
void |
printBinaryRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate,
Shell.PrintLine outFile)
|
void |
printException(Exception e)
|
void |
printInfo()
|
void |
printLines(Iterator<String> lines,
boolean paginate)
|
void |
printLines(Iterator<String> lines,
boolean paginate,
Shell.PrintLine out)
|
void |
printRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate,
Class<? extends Formatter> formatterClass)
|
void |
printRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate,
Class<? extends Formatter> formatterClass,
Shell.PrintLine outFile)
|
void |
printVerboseInfo()
|
String |
readMaskedLine(String prompt,
Character mask)
|
static String |
repeat(String s,
int c)
|
void |
resetExitCode()
|
static void |
setDebugging(boolean debuggingEnabled)
|
void |
setExit(boolean exit)
|
protected void |
setInstance(ShellOptionsJC options)
Sets the instance used by the shell based on the given options. |
void |
setLogErrorsToConsole()
|
void |
setTableName(String tableName)
|
void |
shutdown()
|
int |
start()
|
void |
updateUser(String principal,
AuthenticationToken token)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
public static final org.apache.log4j.Logger log
CHARSET
public static final String CHARSET
- See Also:
- Constant Field Values
NO_FIXED_ARG_LENGTH_CHECK
public static final int NO_FIXED_ARG_LENGTH_CHECK
- See Also:
- Constant Field Values
COMMENT_PREFIX
public static final String COMMENT_PREFIX
- See Also:
- Constant Field Values
HISTORY_DIR_NAME
public static final String HISTORY_DIR_NAME
- See Also:
- Constant Field Values
HISTORY_FILE_NAME
public static final String HISTORY_FILE_NAME
- See Also:
- Constant Field Values
exitCode
protected int exitCode
instance
protected Instance instance
reader
protected jline.console.ConsoleReader reader
scanIteratorOptions
public Map<String,List<IteratorSetting>> scanIteratorOptions
iteratorProfiles
public Map<String,List<IteratorSetting>> iteratorProfiles
commandFactory
public final Map<String,Shell.Command> commandFactory
commandGrouping
public final Map<String,Shell.Command[]> commandGrouping
execFile
protected File execFile
execCommand
protected String execCommand
verbose
protected boolean verbose
Shell
public Shell()
throws IOException
- Throws:
IOException
Shell
public Shell(jline.console.ConsoleReader reader,
PrintWriter writer)
config
public boolean config(String... args)
- Configures the shell using the provided options. Not for client use.
- Returns:
- true if the shell was successfully configured, false otherwise.
setInstance
protected void setInstance(ShellOptionsJC options)
- Sets the instance used by the shell based on the given options.
- Parameters:
options
- shell options
getConnector
public Connector getConnector()
getInstance
public Instance getInstance()
getClassLoader
public ClassLoader getClassLoader(org.apache.commons.cli.CommandLine cl,
Shell shellState)
throws AccumuloException,
TableNotFoundException,
AccumuloSecurityException,
IOException,
org.apache.commons.vfs2.FileSystemException
- Throws:
AccumuloException
TableNotFoundException
AccumuloSecurityException
IOException
org.apache.commons.vfs2.FileSystemException
main
public static void main(String[] args)
throws IOException
- Throws:
IOException
start
public int start()
throws IOException
- Throws:
IOException
shutdown
public void shutdown()
printInfo
public void printInfo()
throws IOException
- Throws:
IOException
printVerboseInfo
public void printVerboseInfo()
throws IOException
- Throws:
IOException
getDefaultPrompt
public String getDefaultPrompt()
execCommand
public void execCommand(String input,
boolean ignoreAuthTimeout,
boolean echoPrompt)
throws IOException
- Throws:
IOException
printLines
public final void printLines(Iterator<String> lines,
boolean paginate)
throws IOException
- Throws:
IOException
printLines
public final void printLines(Iterator<String> lines,
boolean paginate,
Shell.PrintLine out)
throws IOException
- Throws:
IOException
printRecords
public final void printRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate,
Class<? extends Formatter> formatterClass,
Shell.PrintLine outFile)
throws IOException
- Throws:
IOException
printRecords
public final void printRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate,
Class<? extends Formatter> formatterClass)
throws IOException
- Throws:
IOException
printBinaryRecords
public final void printBinaryRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate,
Shell.PrintLine outFile)
throws IOException
- Throws:
IOException
printBinaryRecords
public final void printBinaryRecords(Iterable<Map.Entry<Key,Value>> scanner,
boolean printTimestamps,
boolean paginate)
throws IOException
- Throws:
IOException
repeat
public static String repeat(String s,
int c)
checkTableState
public void checkTableState()
printException
public final void printException(Exception e)
setDebugging
public static final void setDebugging(boolean debuggingEnabled)
isDebuggingEnabled
public static final boolean isDebuggingEnabled()
getExitCode
public int getExitCode()
resetExitCode
public void resetExitCode()
setExit
public void setExit(boolean exit)
getExit
public boolean getExit()
isVerbose
public boolean isVerbose()
setTableName
public void setTableName(String tableName)
getTableName
public String getTableName()
getReader
public jline.console.ConsoleReader getReader()
updateUser
public void updateUser(String principal,
AuthenticationToken token)
throws AccumuloException,
AccumuloSecurityException
- Throws:
AccumuloException
AccumuloSecurityException
getPrincipal
public String getPrincipal()
getToken
public AuthenticationToken getToken()
getFormatter
public Class<? extends Formatter> getFormatter()
- Return the formatter for the current table.
- Returns:
- the formatter class for the current table
getFormatter
public Class<? extends Formatter> getFormatter(String tableName)
- Return the formatter for the given table.
- Parameters:
tableName
- the table name
- Returns:
- the formatter class for the given table
setLogErrorsToConsole
public void setLogErrorsToConsole()
readMaskedLine
public String readMaskedLine(String prompt,
Character mask)
throws IOException
- Throws:
IOException
isMasking
public boolean isMasking()
hasExited
public boolean hasExited()
isTabCompletion
public boolean isTabCompletion()
Copyright © 2015 Apache Accumulo Project. All rights reserved.