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

Package org.apache.hadoop.tools

# Class GetGroupsBase

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.tools.GetGroupsBase

All Implemented Interfaces:
  `Configurable`, `Tool`

public abstract class GetGroupsBase extends Configured implements Tool
Base class for the HDFS and MR implementations of tools which fetch and display the groups that users belong to.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `GetGroupsBase(Configuration conf)`
  Create an instance of this tool using the given configuration.
  `protected`
  `GetGroupsBase(Configuration conf, PrintStream out)`
  Used exclusively for testing.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract InetSocketAddress`
  `getProtocolAddress(Configuration conf)`
  Must be overridden by subclasses to get the address where the `GetUserMappingsProtocol` implementation is running.
  `protected GetUserMappingsProtocol`
  `getUgmProtocol()`
  Get a client of the `GetUserMappingsProtocol`.
  `int`
  `run(String[] args)`
  Get the groups for the users given and print formatted output to the `PrintStream` configured earlier.

  ### 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`

- ## Constructor Details

  - ### GetGroupsBase

    protected GetGroupsBase(Configuration conf)
    Create an instance of this tool using the given configuration.
    Parameters:
      `conf` - configuration.

  - ### GetGroupsBase

    protected GetGroupsBase(Configuration conf, PrintStream out)
    Used exclusively for testing.
    Parameters:
      `conf` - The configuration to use.
      `out` - The PrintStream to write to, instead of System.out

- ## Method Details

  - ### run

    public int run(String[] args) throws Exception
    Get the groups for the users given and print formatted output to the `PrintStream` configured earlier.
    Specified by:
      `run` in interface `Tool`
    Parameters:
      `args` - command specific arguments.
    Returns:
      exit code.
    Throws:
      `Exception` - command exception.

  - ### getProtocolAddress

    protected abstract InetSocketAddress getProtocolAddress(Configuration conf) throws IOException
    Must be overridden by subclasses to get the address where the `GetUserMappingsProtocol` implementation is running.
    Parameters:
      `conf` - The configuration to use.
    Returns:
      The address where the service is listening.
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### getUgmProtocol

    protected GetUserMappingsProtocol getUgmProtocol() throws IOException
    Get a client of the `GetUserMappingsProtocol`.
    Returns:
      A `GetUserMappingsProtocol` client proxy.
    Throws:
      `IOException` - raised on errors performing I/O.