本文整理了Java中org.apache.hadoop.hive.common.FileUtils.isOwnerOfFileHierarchy()
方法的一些代码示例,展示了FileUtils.isOwnerOfFileHierarchy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.isOwnerOfFileHierarchy()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.common.FileUtils
类名称:FileUtils
方法名:isOwnerOfFileHierarchy
暂无
代码示例来源:origin: apache/hive
public static boolean isOwnerOfFileHierarchy(FileSystem fs, FileStatus fileStatus, String userName)
throws IOException, InterruptedException {
return isOwnerOfFileHierarchy(fs, fileStatus, userName, true);
}
代码示例来源:origin: apache/hive
private static Set<SQLPrivTypeGrant> getPrivilegesFromFS(
String userName, FileSystem fs,
FileStatus fileStatus, boolean recurse) throws Exception {
Set<SQLPrivTypeGrant> privs = new HashSet<SQLPrivTypeGrant>();
LOG.info("Checking fs privileges of user {} for {} {} ",
userName, fileStatus.toString(), (recurse? "recursively":"without recursion"));
if (FileUtils.isOwnerOfFileHierarchy(fs, fileStatus, userName, recurse)) {
privs.add(SQLPrivTypeGrant.OWNER_PRIV);
}
if (FileUtils.isActionPermittedForFileHierarchy(fs, fileStatus, userName, FsAction.WRITE, recurse)) {
privs.add(SQLPrivTypeGrant.INSERT_NOGRANT);
privs.add(SQLPrivTypeGrant.DELETE_NOGRANT);
}
if (FileUtils.isActionPermittedForFileHierarchy(fs, fileStatus, userName, FsAction.READ, recurse)) {
privs.add(SQLPrivTypeGrant.SELECT_NOGRANT);
}
LOG.debug("addPrivilegesFromFS:[{}] asked for privileges on [{}] with recurse={} and obtained:[{}]",
userName, fileStatus, recurse, privs);
return privs;
}
代码示例来源:origin: apache/drill
private static Set<SQLPrivTypeGrant> getPrivilegesFromFS(
String userName, FileSystem fs,
FileStatus fileStatus, boolean recurse) throws Exception {
Set<SQLPrivTypeGrant> privs = new HashSet<SQLPrivTypeGrant>();
LOG.debug("Checking fs privileges for {} {}",
fileStatus.toString(), (recurse? "recursively":"without recursion"));
if (FileUtils.isOwnerOfFileHierarchy(fs, fileStatus, userName, recurse)) {
privs.add(SQLPrivTypeGrant.OWNER_PRIV);
}
if (FileUtils.isActionPermittedForFileHierarchy(fs, fileStatus, userName, FsAction.WRITE, recurse)) {
privs.add(SQLPrivTypeGrant.INSERT_NOGRANT);
privs.add(SQLPrivTypeGrant.DELETE_NOGRANT);
}
if (FileUtils.isActionPermittedForFileHierarchy(fs, fileStatus, userName, FsAction.READ, recurse)) {
privs.add(SQLPrivTypeGrant.SELECT_NOGRANT);
}
LOG.debug("addPrivilegesFromFS:[{}] asked for privileges on [{}] with recurse={} and obtained:[{}]",
userName, fileStatus, recurse, privs);
return privs;
}
代码示例来源:origin: apache/hive
srcs = srcFs.getFileStatus(srcf);
String runningUser = UserGroupInformation.getLoginUser().getShortUserName();
boolean isOwned = FileUtils.isOwnerOfFileHierarchy(srcFs, srcs, configuredOwner, false);
if (configuredOwner.equals(runningUser)) {
代码示例来源:origin: org.apache.hive/hive-common
public static boolean isOwnerOfFileHierarchy(FileSystem fs, FileStatus fileStatus, String userName)
throws IOException, InterruptedException {
return isOwnerOfFileHierarchy(fs, fileStatus, userName, true);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public static boolean isOwnerOfFileHierarchy(FileSystem fs, FileStatus fileStatus, String userName)
throws IOException {
if (!fileStatus.getOwner().equals(userName)) {
return false;
}
if (!fileStatus.isDir()) {
// no sub dirs to be checked
return true;
}
// check all children
FileStatus[] childStatuses = fs.listStatus(fileStatus.getPath());
for (FileStatus childStatus : childStatuses) {
// check children recursively
if (!isOwnerOfFileHierarchy(fs, childStatus, userName)) {
return false;
}
}
return true;
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
fs = FileSystem.get(filePath.toUri(), conf);
FileStatus fileStatus = FileUtils.getPathOrParentThatExists(fs, filePath);
if (FileUtils.isOwnerOfFileHierarchy(fs, fileStatus, userName)) {
availPrivs.addPrivilege(SQLPrivTypeGrant.OWNER_PRIV);
内容来源于网络,如有侵权,请联系作者删除!