|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.security.UserGroupInformation org.apache.hadoop.security.UnixUserGroupInformation
public class UnixUserGroupInformation
An implementation of UserGroupInformation in the Unix system
Field Summary | |
---|---|
static String |
UGI_PROPERTY_NAME
|
Fields inherited from class org.apache.hadoop.security.UserGroupInformation |
---|
LOG |
Constructor Summary | |
---|---|
UnixUserGroupInformation()
Default constructor |
|
UnixUserGroupInformation(String[] ugi)
Constructor with parameter user/group names |
|
UnixUserGroupInformation(String userName,
String[] groupNames)
Constructor with parameters user name and its group names. |
Method Summary | |
---|---|
static UnixUserGroupInformation |
createImmutable(String[] ugi)
Create an immutable UnixUserGroupInformation object. |
boolean |
equals(Object other)
Decide if two UGIs are the same |
String[] |
getGroupNames()
Return an array of group names |
String |
getUserName()
Return the user's name |
int |
hashCode()
Returns a hash code for this UGI. |
static UnixUserGroupInformation |
login()
Get current user's name and the names of all its groups from Unix. |
static UnixUserGroupInformation |
login(Configuration conf)
Equivalent to login(conf, false). |
static UnixUserGroupInformation |
login(Configuration conf,
boolean save)
Get a user's name & its group names from the given configuration; If it is not defined in the configuration, get the current user's information from Unix. |
void |
readFields(DataInput in)
Deserialize this object First check if this is a UGI in the string format. |
static UnixUserGroupInformation |
readFromConf(Configuration conf,
String attr)
Read a UGI from the given conf
The object is expected to store with the property name attr
as a comma separated string that starts
with the user name followed by group names. |
static void |
saveToConf(Configuration conf,
String attr,
UnixUserGroupInformation ugi)
Store the given ugi as a comma separated string in
conf as a property attr
The String starts with the user name followed by the default group names,
and other group names. |
String |
toString()
Convert this object to a string |
void |
write(DataOutput out)
Serialize this object First write a string marking that this is a UGI in the string format, then write this object's serialized form to the given data output |
Methods inherited from class org.apache.hadoop.security.UserGroupInformation |
---|
getCurrentUGI, readFrom, setCurrentUGI |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String UGI_PROPERTY_NAME
Constructor Detail |
---|
public UnixUserGroupInformation()
public UnixUserGroupInformation(String userName, String[] groupNames)
userName
- a user's namegroupNames
- groups list, first of which is the default group
IllegalArgumentException
- if any argument is nullpublic UnixUserGroupInformation(String[] ugi)
ugi
- an array containing user/group names, the first
element of which is the user name, the second of
which is the default group name.
IllegalArgumentException
- if the array size is less than 2
or any element is null.Method Detail |
---|
public static UnixUserGroupInformation createImmutable(String[] ugi)
UnixUserGroupInformation
object.
public String[] getGroupNames()
getGroupNames
in class UserGroupInformation
public String getUserName()
getUserName
in class UserGroupInformation
public void readFields(DataInput in) throws IOException
in
- input stream
IOException
- is thrown if encounter any error when readingpublic void write(DataOutput out) throws IOException
out
- output stream
IOException
- if encounter any error during writingpublic static void saveToConf(Configuration conf, String attr, UnixUserGroupInformation ugi)
ugi
as a comma separated string in
conf
as a property attr
The String starts with the user name followed by the default group names,
and other group names.
conf
- configurationattr
- property nameugi
- a UnixUserGroupInformationpublic static UnixUserGroupInformation readFromConf(Configuration conf, String attr) throws LoginException
conf
The object is expected to store with the property name attr
as a comma separated string that starts
with the user name followed by group names.
If the property name is not defined, return null.
It's assumed that there is only one UGI per user. If this user already
has a UGI in the ugi map, return the ugi in the map.
Otherwise, construct a UGI from the configuration, store it in the
ugi map and return it.
conf
- configurationattr
- property name
LoginException
- if the stored string is ill-formatted.public static UnixUserGroupInformation login() throws LoginException
LoginException
public static UnixUserGroupInformation login(Configuration conf) throws LoginException
LoginException
public static UnixUserGroupInformation login(Configuration conf, boolean save) throws LoginException
conf
- either a job configuration or client's configurationsave
- saving it to conf?
LoginException
- if not able to get the user/group informationpublic boolean equals(Object other)
equals
in class Object
other
- other object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |