FsShell (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.fs, class: FsShell

Package org.apache.hadoop.fs

# Class FsShell

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FsShell

All Implemented Interfaces:
  `Configurable`, `Tool`

@Private public class FsShell extends Configured implements Tool
Provide command line access to a FileSystem.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected class`
  `FsShell.Help`
  Displays short usage of commands sans the long description
  `protected class`
  `FsShell.Usage`
  Display help for commands with their short usage and long description.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected CommandFactory`
  `commandFactory`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FsShell()`
  Default ctor with no configuration.
  `FsShell(Configuration conf)`
  Construct a FsShell with the given configuration.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Performs any necessary cleanup
  `Path`
  `getCurrentTrashDir()`
  Returns the Trash object associated with this shell.
  `Path`
  `getCurrentTrashDir(Path path)`
  Returns the current trash location for the path specified
  `protected FileSystem`
  `getFS()`
  `protected FsShell.Help`
  `getHelp()`
  `protected Trash`
  `getTrash()`
  `protected String`
  `getUsagePrefix()`
  `protected void`
  `init()`
  `static void`
  `main(String[] argv)`
  main() has some simple utility methods
  `protected static FsShell`
  `newShellInstance()`
  `protected void`
  `registerCommands(CommandFactory factory)`
  `int`
  `run(String[] argv)`
  run

  ### Methods inherited from class org.apache.hadoop.conf.Configured

  `getConf, setConf`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.apache.hadoop.conf.Configurable

  `getConf, setConf`

- ## Field Details

  - ### commandFactory

    protected CommandFactory commandFactory

- ## Constructor Details

  - ### FsShell

    public FsShell()
    Default ctor with no configuration. Be sure to invoke `Configured.setConf(Configuration)` with a valid configuration prior to running commands.

  - ### FsShell

    public FsShell(Configuration conf)
    Construct a FsShell with the given configuration. Commands can be executed via `run(String[])`
    Parameters:
      `conf` - the hadoop configuration

- ## Method Details

  - ### getFS

    protected FileSystem getFS() throws IOException
    Throws:
      `IOException`

  - ### getTrash

    protected Trash getTrash() throws IOException
    Throws:
      `IOException`

  - ### getHelp

    protected FsShell.Help getHelp() throws IOException
    Throws:
      `IOException`

  - ### init

    protected void init()

  - ### registerCommands

    protected void registerCommands(CommandFactory factory)

  - ### getCurrentTrashDir

    public Path getCurrentTrashDir() throws IOException
    Returns the Trash object associated with this shell.
    Returns:
      Path to the trash
    Throws:
      `IOException` - upon error

  - ### getCurrentTrashDir

    public Path getCurrentTrashDir(Path path) throws IOException
    Returns the current trash location for the path specified
    Parameters:
      `path` - to be deleted
    Returns:
      path to the trash
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### getUsagePrefix

    protected String getUsagePrefix()

  - ### run

    public int run(String[] argv)
    run
    Specified by:
      `run` in interface `Tool`
    Parameters:
      `argv` - command specific arguments.
    Returns:
      exit code.

  - ### close

    public void close() throws IOException
    Performs any necessary cleanup
    Throws:
      `IOException` - upon error

  - ### main

    public static void main(String[] argv) throws Exception
    main() has some simple utility methods
    Parameters:
      `argv` - the command and its arguments
    Throws:
      `Exception` - upon error

  - ### newShellInstance

    protected static FsShell newShellInstance()