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 and 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

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract InetSocketAddress` | `getProtocolAddress(Configuration conf)` Must be overridden by subclasses to get the address where the `GetUserMappingsProtocol` implementation is running.
    `protected org.apache.hadoop.tools.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 Detail

    - #### GetGroupsBase

          protected GetGroupsBase(Configuration conf)

      Create an instance of this tool using the given configuration.
      Parameters:
        `conf` -

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

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

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

    - #### getUgmProtocol

          protected org.apache.hadoop.tools.GetUserMappingsProtocol getUgmProtocol()
                                                                            throws IOException

      Get a client of the `GetUserMappingsProtocol`.
      Returns:
        A `GetUserMappingsProtocol` client proxy.
      Throws:
        `IOException`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.