当前位置: 首页>>代码示例>>Java>>正文


Java FsPermission.getGroupAction方法代码示例

本文整理汇总了Java中org.apache.hadoop.fs.permission.FsPermission.getGroupAction方法的典型用法代码示例。如果您正苦于以下问题:Java FsPermission.getGroupAction方法的具体用法?Java FsPermission.getGroupAction怎么用?Java FsPermission.getGroupAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.fs.permission.FsPermission的用法示例。


在下文中一共展示了FsPermission.getGroupAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPinning

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
@Override
public void setPinning(ExtendedBlock block) throws IOException {
  if (!blockPinningEnabled) {
    return;
  }

  File f = getBlockFile(block);
  Path p = new Path(f.getAbsolutePath());
  
  FsPermission oldPermission = localFS.getFileStatus(
      new Path(f.getAbsolutePath())).getPermission();
  //sticky bit is used for pinning purpose
  FsPermission permission = new FsPermission(oldPermission.getUserAction(),
      oldPermission.getGroupAction(), oldPermission.getOtherAction(), true);
  localFS.setPermission(p, permission);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:FsDatasetImpl.java

示例2: setPermission

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的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

示例3: addImplicitUwx

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private static PermissionStatus addImplicitUwx(PermissionStatus parentPerm,
    PermissionStatus perm) {
  FsPermission p = parentPerm.getPermission();
  FsPermission ancestorPerm = new FsPermission(
      p.getUserAction().or(FsAction.WRITE_EXECUTE),
      p.getGroupAction(),
      p.getOtherAction());
  return new PermissionStatus(perm.getUserName(), perm.getGroupName(),
      ancestorPerm);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FSDirMkdirOp.java

示例4: setPermission

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的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

示例5: ignoreStickyBit

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private static FsPermission ignoreStickyBit(FsPermission original) {
  return new FsPermission(original.getUserAction(),
      original.getGroupAction(), original.getOtherAction());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:NativeAzureFileSystemBaseTest.java


注:本文中的org.apache.hadoop.fs.permission.FsPermission.getGroupAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。