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


Java AclEntry.getScope方法代码示例

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


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

示例1: processOptions

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  cf.parse(args);
  setRecursive(cf.getOpt("R"));
  // Mix of remove and modify acl flags are not allowed
  boolean bothRemoveOptions = cf.getOpt("b") && cf.getOpt("k");
  boolean bothModifyOptions = cf.getOpt("m") && cf.getOpt("x");
  boolean oneRemoveOption = cf.getOpt("b") || cf.getOpt("k");
  boolean oneModifyOption = cf.getOpt("m") || cf.getOpt("x");
  boolean setOption = cf.getOpt("-set");
  if ((bothRemoveOptions || bothModifyOptions)
      || (oneRemoveOption && oneModifyOption)
      || (setOption && (oneRemoveOption || oneModifyOption))) {
    throw new HadoopIllegalArgumentException(
        "Specified flags contains both remove and modify flags");
  }

  // Only -m, -x and --set expects <acl_spec>
  if (oneModifyOption || setOption) {
    if (args.size() < 2) {
      throw new HadoopIllegalArgumentException("<acl_spec> is missing");
    }
    aclEntries = AclEntry.parseAclSpec(args.removeFirst(), !cf.getOpt("x"));
  }

  if (args.isEmpty()) {
    throw new HadoopIllegalArgumentException("<path> is missing");
  }
  if (args.size() > 1) {
    throw new HadoopIllegalArgumentException("Too many arguments");
  }

  // In recursive mode, save a separate list of just the access ACL entries.
  // Only directories may have a default ACL.  When a recursive operation
  // encounters a file under the specified path, it must pass only the
  // access ACL entries.
  if (isRecursive() && (oneModifyOption || setOption)) {
    accessAclEntries = Lists.newArrayList();
    for (AclEntry entry: aclEntries) {
      if (entry.getScope() == AclEntryScope.ACCESS) {
        accessAclEntries.add(entry);
      }
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:46,代码来源:AclCommands.java

示例2: filterDefaultAclEntries

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
/**
 * Filters (discards) any existing default ACL entries.  The new ACL retains
 * only the access ACL entries.
 *
 * @param existingAcl List<AclEntry> existing ACL
 * @return List<AclEntry> new ACL
 * @throws AclException if validation fails
 */
public static List<AclEntry> filterDefaultAclEntries(
    List<AclEntry> existingAcl) throws AclException {
  ArrayList<AclEntry> aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES);
  for (AclEntry existingEntry: existingAcl) {
    if (existingEntry.getScope() == DEFAULT) {
      // Default entries sort after access entries, so we can exit early.
      break;
    }
    aclBuilder.add(existingEntry);
  }
  return buildAndValidateAcl(aclBuilder);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:AclTransformation.java


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