當前位置: 首頁>>代碼示例>>Java>>正文


Java FsAction.implies方法代碼示例

本文整理匯總了Java中org.apache.hadoop.fs.permission.FsAction.implies方法的典型用法代碼示例。如果您正苦於以下問題:Java FsAction.implies方法的具體用法?Java FsAction.implies怎麽用?Java FsAction.implies使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.fs.permission.FsAction的用法示例。


在下文中一共展示了FsAction.implies方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkPublicPermsForAll

import org.apache.hadoop.fs.permission.FsAction; //導入方法依賴的package包/類
private static boolean checkPublicPermsForAll(FileSystem fs, 
      FileStatus status, FsAction dir, FsAction file) 
  throws IOException {
  FsPermission perms = status.getPermission();
  FsAction otherAction = perms.getOtherAction();
  if (status.isDirectory()) {
    if (!otherAction.implies(dir)) {
      return false;
    }
    
    for (FileStatus child : fs.listStatus(status.getPath())) {
      if(!checkPublicPermsForAll(fs, child, dir, file)) {
        return false;
      }
    }
    return true;
  }
  return (otherAction.implies(file));
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:FSDownload.java

示例2: checkPermissionOfOther

import org.apache.hadoop.fs.permission.FsAction; //導入方法依賴的package包/類
/**
 * Checks for a given path whether the Other permissions on it imply the permission in the passed
 * FsAction
 * 
 * @return true if the path in the uri is visible to all, false otherwise
 * @throws IOException
 */
public boolean checkPermissionOfOther(FileSystem fs, Path path, FsAction action,
    Map<URI, FileStatus> statCache) throws IOException {
  FileStatus status = getFileStatus(fs, path.toUri(), statCache);
  FsPermission perms = status.getPermission();
  FsAction otherAction = perms.getOtherAction();
  return otherAction.implies(action);
}
 
開發者ID:Tencent,項目名稱:angel,代碼行數:15,代碼來源:ClientDistributedCacheManager.java

示例3: setPermission

import org.apache.hadoop.fs.permission.FsAction; //導入方法依賴的package包/類
/**
 * Set permissions to the required value. Uses the java primitives instead
 * of forking if group == other.
 * @param f the file to change
 * @param permission the new permissions
 * @throws IOException
 */
public static void setPermission(File f, FsPermission permission
                                 ) throws IOException {
  FsAction user = permission.getUserAction();
  FsAction group = permission.getGroupAction();
  FsAction other = permission.getOtherAction();

  // use the native/fork if the group/other permissions are different
  // or if the native is available or on Windows
  if (group != other || NativeIO.isAvailable() || Shell.WINDOWS) {
    execSetPermission(f, permission);
    return;
  }

  boolean rv = true;

  // read perms
  rv = f.setReadable(group.implies(FsAction.READ), false);
  checkReturnValue(rv, f, permission);
  if (group.implies(FsAction.READ) != user.implies(FsAction.READ)) {
    rv = f.setReadable(user.implies(FsAction.READ), true);
    checkReturnValue(rv, f, permission);
  }

  // write perms
  rv = f.setWritable(group.implies(FsAction.WRITE), false);
  checkReturnValue(rv, f, permission);
  if (group.implies(FsAction.WRITE) != user.implies(FsAction.WRITE)) {
    rv = f.setWritable(user.implies(FsAction.WRITE), true);
    checkReturnValue(rv, f, permission);
  }

  // exec perms
  rv = f.setExecutable(group.implies(FsAction.EXECUTE), false);
  checkReturnValue(rv, f, permission);
  if (group.implies(FsAction.EXECUTE) != user.implies(FsAction.EXECUTE)) {
    rv = f.setExecutable(user.implies(FsAction.EXECUTE), true);
    checkReturnValue(rv, f, permission);
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:47,代碼來源:FileUtil.java

示例4: checkPermissionOfOther

import org.apache.hadoop.fs.permission.FsAction; //導入方法依賴的package包/類
/**
 * Checks for a given path whether the Other permissions on it 
 * imply the permission in the passed FsAction
 * @param fs
 * @param path
 * @param action
 * @return true if the path in the uri is visible to all, false otherwise
 * @throws IOException
 */
private static boolean checkPermissionOfOther(FileSystem fs, Path path,
    FsAction action, Map<URI, FileStatus> statCache) throws IOException {
  FileStatus status = getFileStatus(fs, path.toUri(), statCache);
  FsPermission perms = status.getPermission();
  FsAction otherAction = perms.getOtherAction();
  if (otherAction.implies(action)) {
    return true;
  }
  return false;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:ClientDistributedCacheManager.java

示例5: checkPermission

import org.apache.hadoop.fs.permission.FsAction; //導入方法依賴的package包/類
@Override
public void checkPermission(String fsOwner, String supergroup,
    UserGroupInformation callerUgi, INodeAttributes[] inodeAttrs,
    INode[] inodes, byte[][] pathByNameArr, int snapshotId, String path,
    int ancestorIndex, boolean doCheckOwner, FsAction ancestorAccess,
    FsAction parentAccess, FsAction access, FsAction subAccess,
    boolean ignoreEmptyDir)
    throws AccessControlException {
  for(; ancestorIndex >= 0 && inodes[ancestorIndex] == null;
      ancestorIndex--);
  checkTraverse(inodeAttrs, path, ancestorIndex);

  final INodeAttributes last = inodeAttrs[inodeAttrs.length - 1];
  if (parentAccess != null && parentAccess.implies(FsAction.WRITE)
      && inodeAttrs.length > 1 && last != null) {
    checkStickyBit(inodeAttrs[inodeAttrs.length - 2], last);
  }
  if (ancestorAccess != null && inodeAttrs.length > 1) {
    check(inodeAttrs, path, ancestorIndex, ancestorAccess);
  }
  if (parentAccess != null && inodeAttrs.length > 1) {
    check(inodeAttrs, path, inodeAttrs.length - 2, parentAccess);
  }
  if (access != null) {
    check(last, path, access);
  }
  if (subAccess != null) {
    INode rawLast = inodes[inodeAttrs.length - 1];
    checkSubAccess(pathByNameArr, inodeAttrs.length - 1, rawLast,
        snapshotId, subAccess, ignoreEmptyDir);
  }
  if (doCheckOwner) {
    checkOwner(last);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:36,代碼來源:FSPermissionChecker.java

示例6: setPermission

import org.apache.hadoop.fs.permission.FsAction; //導入方法依賴的package包/類
/**
 * Set permissions to the required value. Uses the java primitives instead
 * of forking if group == other.
 * @param f the file to change
 * @param permission the new permissions
 * @throws IOException
 */
public static void setPermission(File f, FsPermission permission
                                 ) throws IOException {
  FsAction user = permission.getUserAction();
  FsAction group = permission.getGroupAction();
  FsAction other = permission.getOtherAction();

  // use the native/fork if the group/other permissions are different
  // or if the native is available or on Windows
  if (group != other || NativeIO.isAvailable() || Shell.WINDOWS) {
    execSetPermission(f, permission);
    return;
  }
  
  boolean rv = true;
  
  // read perms
  rv = f.setReadable(group.implies(FsAction.READ), false);
  checkReturnValue(rv, f, permission);
  if (group.implies(FsAction.READ) != user.implies(FsAction.READ)) {
    rv = f.setReadable(user.implies(FsAction.READ), true);
    checkReturnValue(rv, f, permission);
  }

  // write perms
  rv = f.setWritable(group.implies(FsAction.WRITE), false);
  checkReturnValue(rv, f, permission);
  if (group.implies(FsAction.WRITE) != user.implies(FsAction.WRITE)) {
    rv = f.setWritable(user.implies(FsAction.WRITE), true);
    checkReturnValue(rv, f, permission);
  }

  // exec perms
  rv = f.setExecutable(group.implies(FsAction.EXECUTE), false);
  checkReturnValue(rv, f, permission);
  if (group.implies(FsAction.EXECUTE) != user.implies(FsAction.EXECUTE)) {
    rv = f.setExecutable(user.implies(FsAction.EXECUTE), true);
    checkReturnValue(rv, f, permission);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:47,代碼來源:FileUtil.java

示例7: checkPermissionOfOther

import org.apache.hadoop.fs.permission.FsAction; //導入方法依賴的package包/類
/**
 * Checks for a given path whether the Other permissions on it 
 * imply the permission in the passed FsAction
 * @param fs
 * @param path
 * @param action
 * @return true if the path in the uri is visible to all, false otherwise
 * @throws IOException
 */
private static boolean checkPermissionOfOther(FileSystem fs, Path path,
    FsAction action, LoadingCache<Path,Future<FileStatus>> statCache)
    throws IOException {
  FileStatus status = getFileStatus(fs, path, statCache);
  FsPermission perms = status.getPermission();
  FsAction otherAction = perms.getOtherAction();
  return otherAction.implies(action);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:18,代碼來源:FSDownload.java


注:本文中的org.apache.hadoop.fs.permission.FsAction.implies方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。