org.apache.hadoop.security
Class ShellBasedIdMapping

java.lang.Object
  extended by org.apache.hadoop.security.ShellBasedIdMapping
All Implemented Interfaces:
IdMappingServiceProvider

public class ShellBasedIdMapping
extends Object
implements IdMappingServiceProvider

A simple shell-based implementation of IdMappingServiceProvider Map id to user name or group name. It does update every 15 minutes. Only a single instance of this class is expected to be on the server.


Constructor Summary
ShellBasedIdMapping(Configuration conf)
           
ShellBasedIdMapping(Configuration conf, String defaultStaticIdMappingFile)
           
 
Method Summary
 int getGid(String group)
           
 int getGidAllowingUnknown(String group)
           
 String getGroupName(int gid, String unknown)
           
 long getTimeout()
           
 int getUid(String user)
           
 int getUidAllowingUnknown(String user)
           
 String getUserName(int uid, String unknown)
           
static void updateMapInternal(com.google.common.collect.BiMap<Integer,String> map, String mapName, String command, String regex, Map<Integer,Integer> staticMapping)
          Get the whole list of users and groups and save them in the maps.
 void updateMaps()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShellBasedIdMapping

public ShellBasedIdMapping(Configuration conf,
                           String defaultStaticIdMappingFile)
                    throws IOException
Throws:
IOException

ShellBasedIdMapping

public ShellBasedIdMapping(Configuration conf)
                    throws IOException
Throws:
IOException
Method Detail

getTimeout

public long getTimeout()

updateMapInternal

public static void updateMapInternal(com.google.common.collect.BiMap<Integer,String> map,
                                     String mapName,
                                     String command,
                                     String regex,
                                     Map<Integer,Integer> staticMapping)
                              throws IOException
Get the whole list of users and groups and save them in the maps.

Throws:
IOException

updateMaps

public void updateMaps()
                throws IOException
Throws:
IOException

getUid

public int getUid(String user)
           throws IOException
Specified by:
getUid in interface IdMappingServiceProvider
Throws:
IOException

getGid

public int getGid(String group)
           throws IOException
Specified by:
getGid in interface IdMappingServiceProvider
Throws:
IOException

getUserName

public String getUserName(int uid,
                          String unknown)
Specified by:
getUserName in interface IdMappingServiceProvider

getGroupName

public String getGroupName(int gid,
                           String unknown)
Specified by:
getGroupName in interface IdMappingServiceProvider

getUidAllowingUnknown

public int getUidAllowingUnknown(String user)
Specified by:
getUidAllowingUnknown in interface IdMappingServiceProvider

getGidAllowingUnknown

public int getGidAllowingUnknown(String group)
Specified by:
getGidAllowingUnknown in interface IdMappingServiceProvider


Copyright © 2014 Apache Software Foundation. All Rights Reserved.