Class CommandShell

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.tools.CommandShell
All Implemented Interfaces:
Configurable, Tool
Direct Known Subclasses:
CredentialShell, DtUtilShell, KeyShell

public abstract class CommandShell extends Configured implements Tool
This program is a CLI utility base class utilizing hadoop Tool class.
  • Constructor Details

    • CommandShell

      public CommandShell()
  • Method Details

    • getCommandUsage

      public abstract String getCommandUsage()
      Return usage string for the command including any summary of subcommands.
      Returns:
      command usage.
    • setSubCommand

      public void setSubCommand(CommandShell.SubCommand cmd)
    • setOut

      public void setOut(PrintStream p)
    • getOut

      public PrintStream getOut()
    • setErr

      public void setErr(PrintStream p)
    • getErr

      public PrintStream getErr()
    • run

      public int run(String[] args) throws Exception
      Description copied from interface: Tool
      Execute the command with the given arguments.
      Specified by:
      run in interface Tool
      Parameters:
      args - command specific arguments.
      Returns:
      exit code.
      Throws:
      Exception - command exception.
    • init

      protected abstract int init(String[] args) throws Exception
      Parse the command line arguments and initialize subcommand instance.
      Parameters:
      args - arguments.
      Returns:
      0 if the argument(s) were recognized, 1 otherwise
      Throws:
      Exception - init exception.
    • printShellUsage

      protected final void printShellUsage()
    • printException

      protected void printException(Exception ex)