org.apache.hadoop.tools
Class GetGroupsBase

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.tools.GetGroupsBase
All Implemented Interfaces:
Configurable, Tool
Direct Known Subclasses:
GetGroups

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
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
protected abstract  InetSocketAddress getProtocolAddress(Configuration conf)
          Must be overridden by subclasses to get the address where the GetUserMappingsProtocol implementation is running.
protected abstract  String getServerPrincipalName(Configuration conf)
          Must be overridden by subclasses to get the expected server principal name when Kerberos is enabled on the cluster.
 int run(String[] args)
          Get the groups for the users given and print formatted output to the PrintStream configured earlier.
 void setConf(Configuration conf)
          Set the configuration to be used by this object.
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf
 
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
 

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

setConf

public void setConf(Configuration conf)
Description copied from interface: Configurable
Set the configuration to be used by this object.

Specified by:
setConf in interface Configurable
Overrides:
setConf in class Configured

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

getServerPrincipalName

protected abstract String getServerPrincipalName(Configuration conf)
Must be overridden by subclasses to get the expected server principal name when Kerberos is enabled on the cluster.

Parameters:
conf - The configuration to use.
Returns:
The expected server principal name.


Copyright © 2009 The Apache Software Foundation