下面列出了org.apache.hadoop.mapreduce.JobACL#values ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Construct the jobACLs from the configuration so that they can be kept in
* the memory. If authorization is disabled on the JT, nothing is constructed
* and an empty map is returned.
*
* @return JobACL to AccessControlList map.
*/
public Map<JobACL, AccessControlList> constructJobACLs(Configuration conf) {
Map<JobACL, AccessControlList> acls =
new HashMap<JobACL, AccessControlList>();
// Don't construct anything if authorization is disabled.
if (!areACLsEnabled()) {
return acls;
}
for (JobACL aclName : JobACL.values()) {
String aclConfigName = aclName.getAclName();
String aclConfigured = conf.get(aclConfigName);
if (aclConfigured == null) {
// If ACLs are not configured at all, we grant no access to anyone. So
// jobOwner and cluster administrator _only_ can do 'stuff'
aclConfigured = " ";
}
acls.put(aclName, new AccessControlList(aclConfigured));
}
return acls;
}
/**
* Construct the jobACLs from the configuration so that they can be kept in
* the memory. If authorization is disabled on the JT, nothing is constructed
* and an empty map is returned.
*
* @return JobACL to AccessControlList map.
*/
public Map<JobACL, AccessControlList> constructJobACLs(Configuration conf) {
Map<JobACL, AccessControlList> acls =
new HashMap<JobACL, AccessControlList>();
// Don't construct anything if authorization is disabled.
if (!areACLsEnabled()) {
return acls;
}
for (JobACL aclName : JobACL.values()) {
String aclConfigName = aclName.getAclName();
String aclConfigured = conf.get(aclConfigName);
if (aclConfigured == null) {
// If ACLs are not configured at all, we grant no access to anyone. So
// jobOwner and cluster administrator _only_ can do 'stuff'
aclConfigured = " ";
}
acls.put(aclName, new AccessControlList(aclConfigured));
}
return acls;
}
/** Get the acls configured for the job **/
public Map<JobACL, AccessControlList> getJobAcls() {
Map<JobACL, AccessControlList> jobAcls =
new HashMap<JobACL, AccessControlList>();
for (JobACL jobACL : JobACL.values()) {
Utf8 jobACLsUtf8 = new Utf8(jobACL.getAclName());
if (datum.acls.containsKey(jobACLsUtf8)) {
jobAcls.put(jobACL, new AccessControlList(datum.acls.get(
jobACLsUtf8).toString()));
}
}
return jobAcls;
}
/** Get the acls configured for the job **/
public Map<JobACL, AccessControlList> getJobAcls() {
Map<JobACL, AccessControlList> jobAcls =
new HashMap<JobACL, AccessControlList>();
for (JobACL jobACL : JobACL.values()) {
Utf8 jobACLsUtf8 = new Utf8(jobACL.getAclName());
if (datum.acls.containsKey(jobACLsUtf8)) {
jobAcls.put(jobACL, new AccessControlList(datum.acls.get(
jobACLsUtf8).toString()));
}
}
return jobAcls;
}