org.apache.accumulo.core.util.shell
Class Shell

java.lang.Object
  extended by org.apache.accumulo.core.util.shell.ShellOptions
      extended by 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


Nested Class Summary
static class Shell.Command
          The Command class represents a command to be run in the shell.
static class Shell.PrintFile
           
static interface Shell.PrintLine
           
static class Shell.PrintShell
           
 
Field Summary
static String CHARSET
           
 Map<String,Shell.Command> commandFactory
           
 Map<String,Shell.Command[]> commandGrouping
           
protected  boolean configError
           
protected  String execCommand
           
protected  String execFile
           
protected  int exitCode
           
protected  Instance instance
           
 Map<String,List<IteratorSetting>> iteratorProfiles
           
static org.apache.log4j.Logger log
           
static int NO_FIXED_ARG_LENGTH_CHECK
           
protected  jline.ConsoleReader reader
           
 Map<String,List<IteratorSetting>> scanIteratorOptions
           
protected  boolean verbose
           
 
Fields inherited from class org.apache.accumulo.core.util.shell.ShellOptions
helpLongOption, helpOption, tableOption, userOption
 
Constructor Summary
Shell()
           
Shell(jline.ConsoleReader reader)
           
Shell(jline.ConsoleReader reader, PrintWriter writer)
           
 
Method Summary
 void checkTableState()
           
 boolean config(String... args)
           
 void execCommand(String input, boolean ignoreAuthTimeout, boolean echoPrompt)
           
 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.
 String getPrincipal()
           
 jline.ConsoleReader getReader()
           
 String getTableName()
           
 AuthenticationToken getToken()
           
 boolean hasExited()
           
static boolean isDebuggingEnabled()
           
 boolean isMasking()
           
 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(org.apache.commons.cli.CommandLine cl)
           
 void setLogErrorsToConsole()
           
 void setTableName(String tableName)
           
 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
 

Field Detail

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

exitCode

protected int exitCode

instance

protected Instance instance

reader

protected jline.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

configError

protected boolean configError

execFile

protected String execFile

execCommand

protected String execCommand

verbose

protected boolean verbose
Constructor Detail

Shell

public Shell()
      throws IOException
Throws:
IOException

Shell

public Shell(jline.ConsoleReader reader)

Shell

public Shell(jline.ConsoleReader reader,
             PrintWriter writer)
Method Detail

config

public boolean config(String... args)

setInstance

protected void setInstance(org.apache.commons.cli.CommandLine cl)

getConnector

public Connector getConnector()

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException

start

public int start()
          throws IOException
Throws:
IOException

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.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()


Copyright © 2013 Apache Accumulo Project. All Rights Reserved.