• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ScopedAclEntries类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ScopedAclEntries类属于org.apache.hadoop.fs.permission包,在下文中一共展示了ScopedAclEntries类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processPath

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  out.println("# file: " + item);
  out.println("# owner: " + item.stat.getOwner());
  out.println("# group: " + item.stat.getGroup());
  FsPermission perm = item.stat.getPermission();
  if (perm.getStickyBit()) {
    out.println("# flags: --" +
      (perm.getOtherAction().implies(FsAction.EXECUTE) ? "t" : "T"));
  }

  AclStatus aclStatus = item.fs.getAclStatus(item.path);
  List<AclEntry> entries = perm.getAclBit() ? aclStatus.getEntries()
      : Collections.<AclEntry> emptyList();
  ScopedAclEntries scopedEntries = new ScopedAclEntries(
    AclUtil.getAclFromPermAndEntries(perm, entries));
  printAclEntriesForSingleScope(aclStatus, perm,
      scopedEntries.getAccessEntries());
  printAclEntriesForSingleScope(aclStatus, perm,
      scopedEntries.getDefaultEntries());
  out.println();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:AclCommands.java


示例2: processPath

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  out.println("# file: " + item);
  out.println("# owner: " + item.stat.getOwner());
  out.println("# group: " + item.stat.getGroup());
  FsPermission perm = item.stat.getPermission();
  if (perm.getStickyBit()) {
    out.println("# flags: --" +
      (perm.getOtherAction().implies(FsAction.EXECUTE) ? "t" : "T"));
  }

  List<AclEntry> entries = perm.getAclBit() ?
    item.fs.getAclStatus(item.path).getEntries() :
    Collections.<AclEntry>emptyList();
  ScopedAclEntries scopedEntries = new ScopedAclEntries(
    AclUtil.getAclFromPermAndEntries(perm, entries));
  printAclEntriesForSingleScope(scopedEntries.getAccessEntries());
  printAclEntriesForSingleScope(scopedEntries.getDefaultEntries());
  out.println();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:AclCommands.java


示例3: processPath

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  out.println("# file: " + item);
  out.println("# owner: " + item.stat.getOwner());
  out.println("# group: " + item.stat.getGroup());
  FsPermission perm = item.stat.getPermission();
  if (perm.getStickyBit()) {
    out.println("# flags: --" +
      (perm.getOtherAction().implies(FsAction.EXECUTE) ? "t" : "T"));
  }

  AclStatus aclStatus = null;
  List<AclEntry> entries = null;
  if (perm.getAclBit()) {
    aclStatus = item.fs.getAclStatus(item.path);
    entries = aclStatus.getEntries();
  } else {
    aclStatus = null;
    entries = Collections.<AclEntry> emptyList();
  }
  ScopedAclEntries scopedEntries = new ScopedAclEntries(
    AclUtil.getAclFromPermAndEntries(perm, entries));
  printAclEntriesForSingleScope(aclStatus, perm,
      scopedEntries.getAccessEntries());
  printAclEntriesForSingleScope(aclStatus, perm,
      scopedEntries.getDefaultEntries());
  out.println();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:29,代码来源:AclCommands.java


示例4: copyDefaultsIfNeeded

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * Adds unspecified default entries by copying permissions from the
 * corresponding access entries.
 *
 * @param aclBuilder ArrayList<AclEntry> containing entries to build
 */
private static void copyDefaultsIfNeeded(List<AclEntry> aclBuilder) {
  Collections.sort(aclBuilder, ACL_ENTRY_COMPARATOR);
  ScopedAclEntries scopedEntries = new ScopedAclEntries(aclBuilder);
  if (!scopedEntries.getDefaultEntries().isEmpty()) {
    List<AclEntry> accessEntries = scopedEntries.getAccessEntries();
    List<AclEntry> defaultEntries = scopedEntries.getDefaultEntries();
    List<AclEntry> copiedEntries = Lists.newArrayListWithCapacity(3);
    for (AclEntryType type: EnumSet.of(USER, GROUP, OTHER)) {
      AclEntry defaultEntryKey = new AclEntry.Builder().setScope(DEFAULT)
        .setType(type).build();
      int defaultEntryIndex = Collections.binarySearch(defaultEntries,
        defaultEntryKey, ACL_ENTRY_COMPARATOR);
      if (defaultEntryIndex < 0) {
        AclEntry accessEntryKey = new AclEntry.Builder().setScope(ACCESS)
          .setType(type).build();
        int accessEntryIndex = Collections.binarySearch(accessEntries,
          accessEntryKey, ACL_ENTRY_COMPARATOR);
        if (accessEntryIndex >= 0) {
          copiedEntries.add(new AclEntry.Builder()
            .setScope(DEFAULT)
            .setType(type)
            .setPermission(accessEntries.get(accessEntryIndex).getPermission())
            .build());
        }
      }
    }
    // Add all copied entries when done to prevent potential issues with binary
    // search on a modified aclBulider during the main loop.
    aclBuilder.addAll(copiedEntries);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:AclTransformation.java


示例5: checkMaxEntries

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
private static void checkMaxEntries(ScopedAclEntries scopedEntries)
    throws AclException {
  List<AclEntry> accessEntries = scopedEntries.getAccessEntries();
  List<AclEntry> defaultEntries = scopedEntries.getDefaultEntries();
  if (accessEntries.size() > MAX_ENTRIES) {
    throw new AclException("Invalid ACL: ACL has " + accessEntries.size()
        + " access entries, which exceeds maximum of " + MAX_ENTRIES + ".");
  }
  if (defaultEntries.size() > MAX_ENTRIES) {
    throw new AclException("Invalid ACL: ACL has " + defaultEntries.size()
        + " default entries, which exceeds maximum of " + MAX_ENTRIES + ".");
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:14,代码来源:AclTransformation.java


示例6: copyINodeDefaultAcl

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * If a default ACL is defined on a parent directory, then copies that default
 * ACL to a newly created child file or directory.
 *
 * @param child INode newly created child
 */
public static void copyINodeDefaultAcl(INode child) {
  INodeDirectory parent = child.getParent();
  AclFeature parentAclFeature = parent.getAclFeature();
  if (parentAclFeature == null || !(child.isFile() || child.isDirectory())) {
    return;
  }

  // Split parent's entries into access vs. default.
  List<AclEntry> featureEntries = getEntriesFromAclFeature(parent
      .getAclFeature());
  ScopedAclEntries scopedEntries = new ScopedAclEntries(featureEntries);
  List<AclEntry> parentDefaultEntries = scopedEntries.getDefaultEntries();

  // The parent may have an access ACL but no default ACL.  If so, exit.
  if (parentDefaultEntries.isEmpty()) {
    return;
  }

  // Pre-allocate list size for access entries to copy from parent.
  List<AclEntry> accessEntries = Lists.newArrayListWithCapacity(
    parentDefaultEntries.size());

  FsPermission childPerm = child.getFsPermission();

  // Copy each default ACL entry from parent to new child's access ACL.
  boolean parentDefaultIsMinimal = AclUtil.isMinimalAcl(parentDefaultEntries);
  for (AclEntry entry: parentDefaultEntries) {
    AclEntryType type = entry.getType();
    String name = entry.getName();
    AclEntry.Builder builder = new AclEntry.Builder()
      .setScope(AclEntryScope.ACCESS)
      .setType(type)
      .setName(name);

    // The child's initial permission bits are treated as the mode parameter,
    // which can filter copied permission values for owner, mask and other.
    final FsAction permission;
    if (type == AclEntryType.USER && name == null) {
      permission = entry.getPermission().and(childPerm.getUserAction());
    } else if (type == AclEntryType.GROUP && parentDefaultIsMinimal) {
      // This only happens if the default ACL is a minimal ACL: exactly 3
      // entries corresponding to owner, group and other.  In this case,
      // filter the group permissions.
      permission = entry.getPermission().and(childPerm.getGroupAction());
    } else if (type == AclEntryType.MASK) {
      // Group bits from mode parameter filter permission of mask entry.
      permission = entry.getPermission().and(childPerm.getGroupAction());
    } else if (type == AclEntryType.OTHER) {
      permission = entry.getPermission().and(childPerm.getOtherAction());
    } else {
      permission = entry.getPermission();
    }

    builder.setPermission(permission);
    accessEntries.add(builder.build());
  }

  // A new directory also receives a copy of the parent's default ACL.
  List<AclEntry> defaultEntries = child.isDirectory() ? parentDefaultEntries :
    Collections.<AclEntry>emptyList();

  final FsPermission newPerm;
  if (!AclUtil.isMinimalAcl(accessEntries) || !defaultEntries.isEmpty()) {
    // Save the new ACL to the child.
    child.addAclFeature(createAclFeature(accessEntries, defaultEntries));
    newPerm = createFsPermissionForExtendedAcl(accessEntries, childPerm);
  } else {
    // The child is receiving a minimal ACL.
    newPerm = createFsPermissionForMinimalAcl(accessEntries, childPerm);
  }

  child.setPermission(newPerm);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:80,代码来源:AclStorage.java


示例7: readINodeLogicalAcl

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * Reads the existing ACL of an inode.  This method always returns the full
 * logical ACL of the inode after reading relevant data from the inode's
 * {@link FsPermission} and {@link AclFeature}.  Note that every inode
 * logically has an ACL, even if no ACL has been set explicitly.  If the inode
 * does not have an extended ACL, then the result is a minimal ACL consising of
 * exactly 3 entries that correspond to the owner, group and other permissions.
 * This method always reads the inode's current state and does not support
 * querying by snapshot ID.  This is because the method is intended to support
 * ACL modification APIs, which always apply a delta on top of current state.
 *
 * @param inode INode to read
 * @return List<AclEntry> containing all logical inode ACL entries
 */
public static List<AclEntry> readINodeLogicalAcl(INode inode) {
  FsPermission perm = inode.getFsPermission();
  AclFeature f = inode.getAclFeature();
  if (f == null) {
    return AclUtil.getMinimalAcl(perm);
  }

  final List<AclEntry> existingAcl;
  // Split ACL entries stored in the feature into access vs. default.
  List<AclEntry> featureEntries = getEntriesFromAclFeature(f);
  ScopedAclEntries scoped = new ScopedAclEntries(featureEntries);
  List<AclEntry> accessEntries = scoped.getAccessEntries();
  List<AclEntry> defaultEntries = scoped.getDefaultEntries();

  // Pre-allocate list size for the explicit entries stored in the feature
  // plus the 3 implicit entries (owner, group and other) from the permission
  // bits.
  existingAcl = Lists.newArrayListWithCapacity(featureEntries.size() + 3);

  if (!accessEntries.isEmpty()) {
    // Add owner entry implied from user permission bits.
    existingAcl.add(new AclEntry.Builder().setScope(AclEntryScope.ACCESS)
        .setType(AclEntryType.USER).setPermission(perm.getUserAction())
        .build());

    // Next add all named user and group entries taken from the feature.
    existingAcl.addAll(accessEntries);

    // Add mask entry implied from group permission bits.
    existingAcl.add(new AclEntry.Builder().setScope(AclEntryScope.ACCESS)
        .setType(AclEntryType.MASK).setPermission(perm.getGroupAction())
        .build());

    // Add other entry implied from other permission bits.
    existingAcl.add(new AclEntry.Builder().setScope(AclEntryScope.ACCESS)
        .setType(AclEntryType.OTHER).setPermission(perm.getOtherAction())
        .build());
  } else {
    // It's possible that there is a default ACL but no access ACL. In this
    // case, add the minimal access ACL implied by the permission bits.
    existingAcl.addAll(AclUtil.getMinimalAcl(perm));
  }

  // Add all default entries after the access entries.
  existingAcl.addAll(defaultEntries);

  // The above adds entries in the correct order, so no need to sort here.
  return existingAcl;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:64,代码来源:AclStorage.java


示例8: buildAndValidateAcl

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * Builds the final list of ACL entries to return by trimming, sorting and
 * validating the ACL entries that have been added.
 *
 * @param aclBuilder ArrayList<AclEntry> containing entries to build
 * @return List<AclEntry> unmodifiable, sorted list of ACL entries
 * @throws AclException if validation fails
 */
private static List<AclEntry> buildAndValidateAcl(
    ArrayList<AclEntry> aclBuilder) throws AclException {
  if (aclBuilder.size() > MAX_ENTRIES) {
    throw new AclException("Invalid ACL: ACL has " + aclBuilder.size() +
      " entries, which exceeds maximum of " + MAX_ENTRIES + ".");
  }
  aclBuilder.trimToSize();
  Collections.sort(aclBuilder, ACL_ENTRY_COMPARATOR);
  // Full iteration to check for duplicates and invalid named entries.
  AclEntry prevEntry = null;
  for (AclEntry entry: aclBuilder) {
    if (prevEntry != null &&
        ACL_ENTRY_COMPARATOR.compare(prevEntry, entry) == 0) {
      throw new AclException(
        "Invalid ACL: multiple entries with same scope, type and name.");
    }
    if (entry.getName() != null && (entry.getType() == MASK ||
        entry.getType() == OTHER)) {
      throw new AclException(
        "Invalid ACL: this entry type must not have a name: " + entry + ".");
    }
    prevEntry = entry;
  }
  // Search for the required base access entries.  If there is a default ACL,
  // then do the same check on the default entries.
  ScopedAclEntries scopedEntries = new ScopedAclEntries(aclBuilder);
  for (AclEntryType type: EnumSet.of(USER, GROUP, OTHER)) {
    AclEntry accessEntryKey = new AclEntry.Builder().setScope(ACCESS)
      .setType(type).build();
    if (Collections.binarySearch(scopedEntries.getAccessEntries(),
        accessEntryKey, ACL_ENTRY_COMPARATOR) < 0) {
      throw new AclException(
        "Invalid ACL: the user, group and other entries are required.");
    }
    if (!scopedEntries.getDefaultEntries().isEmpty()) {
      AclEntry defaultEntryKey = new AclEntry.Builder().setScope(DEFAULT)
        .setType(type).build();
      if (Collections.binarySearch(scopedEntries.getDefaultEntries(),
          defaultEntryKey, ACL_ENTRY_COMPARATOR) < 0) {
        throw new AclException(
          "Invalid default ACL: the user, group and other entries are required.");
      }
    }
  }
  return Collections.unmodifiableList(aclBuilder);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:55,代码来源:AclTransformation.java


示例9: buildAndValidateAcl

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * Builds the final list of ACL entries to return by trimming, sorting and
 * validating the ACL entries that have been added.
 *
 * @param aclBuilder ArrayList<AclEntry> containing entries to build
 * @return List<AclEntry> unmodifiable, sorted list of ACL entries
 * @throws AclException if validation fails
 */
private static List<AclEntry> buildAndValidateAcl(
    ArrayList<AclEntry> aclBuilder) throws AclException {
  aclBuilder.trimToSize();
  Collections.sort(aclBuilder, ACL_ENTRY_COMPARATOR);
  // Full iteration to check for duplicates and invalid named entries.
  AclEntry prevEntry = null;
  for (AclEntry entry: aclBuilder) {
    if (prevEntry != null &&
        ACL_ENTRY_COMPARATOR.compare(prevEntry, entry) == 0) {
      throw new AclException(
        "Invalid ACL: multiple entries with same scope, type and name.");
    }
    if (entry.getName() != null && (entry.getType() == MASK ||
        entry.getType() == OTHER)) {
      throw new AclException(
        "Invalid ACL: this entry type must not have a name: " + entry + ".");
    }
    prevEntry = entry;
  }

  ScopedAclEntries scopedEntries = new ScopedAclEntries(aclBuilder);
  checkMaxEntries(scopedEntries);

  // Search for the required base access entries.  If there is a default ACL,
  // then do the same check on the default entries.
  for (AclEntryType type: EnumSet.of(USER, GROUP, OTHER)) {
    AclEntry accessEntryKey = new AclEntry.Builder().setScope(ACCESS)
      .setType(type).build();
    if (Collections.binarySearch(scopedEntries.getAccessEntries(),
        accessEntryKey, ACL_ENTRY_COMPARATOR) < 0) {
      throw new AclException(
        "Invalid ACL: the user, group and other entries are required.");
    }
    if (!scopedEntries.getDefaultEntries().isEmpty()) {
      AclEntry defaultEntryKey = new AclEntry.Builder().setScope(DEFAULT)
        .setType(type).build();
      if (Collections.binarySearch(scopedEntries.getDefaultEntries(),
          defaultEntryKey, ACL_ENTRY_COMPARATOR) < 0) {
        throw new AclException(
          "Invalid default ACL: the user, group and other entries are required.");
      }
    }
  }
  return Collections.unmodifiableList(aclBuilder);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:54,代码来源:AclTransformation.java


示例10: copyINodeDefaultAcl

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * If a default ACL is defined on a parent directory, then copies that default
 * ACL to a newly created child file or directory.
 *
 * @param child INode newly created child
 */
public static void copyINodeDefaultAcl(INode child) {
  INodeDirectory parent = child.getParent();
  AclFeature parentAclFeature = parent.getAclFeature();
  if (parentAclFeature == null || !(child.isFile() || child.isDirectory())) {
    return;
  }

  // Split parent's entries into access vs. default.
  List<AclEntry> featureEntries = parent.getAclFeature().getEntries();
  ScopedAclEntries scopedEntries = new ScopedAclEntries(featureEntries);
  List<AclEntry> parentDefaultEntries = scopedEntries.getDefaultEntries();

  // The parent may have an access ACL but no default ACL.  If so, exit.
  if (parentDefaultEntries.isEmpty()) {
    return;
  }

  // Pre-allocate list size for access entries to copy from parent.
  List<AclEntry> accessEntries = Lists.newArrayListWithCapacity(
    parentDefaultEntries.size());

  FsPermission childPerm = child.getFsPermission();

  // Copy each default ACL entry from parent to new child's access ACL.
  boolean parentDefaultIsMinimal = AclUtil.isMinimalAcl(parentDefaultEntries);
  for (AclEntry entry: parentDefaultEntries) {
    AclEntryType type = entry.getType();
    String name = entry.getName();
    AclEntry.Builder builder = new AclEntry.Builder()
      .setScope(AclEntryScope.ACCESS)
      .setType(type)
      .setName(name);

    // The child's initial permission bits are treated as the mode parameter,
    // which can filter copied permission values for owner, mask and other.
    final FsAction permission;
    if (type == AclEntryType.USER && name == null) {
      permission = entry.getPermission().and(childPerm.getUserAction());
    } else if (type == AclEntryType.GROUP && parentDefaultIsMinimal) {
      // This only happens if the default ACL is a minimal ACL: exactly 3
      // entries corresponding to owner, group and other.  In this case,
      // filter the group permissions.
      permission = entry.getPermission().and(childPerm.getGroupAction());
    } else if (type == AclEntryType.MASK) {
      // Group bits from mode parameter filter permission of mask entry.
      permission = entry.getPermission().and(childPerm.getGroupAction());
    } else if (type == AclEntryType.OTHER) {
      permission = entry.getPermission().and(childPerm.getOtherAction());
    } else {
      permission = entry.getPermission();
    }

    builder.setPermission(permission);
    accessEntries.add(builder.build());
  }

  // A new directory also receives a copy of the parent's default ACL.
  List<AclEntry> defaultEntries = child.isDirectory() ? parentDefaultEntries :
    Collections.<AclEntry>emptyList();

  final FsPermission newPerm;
  if (!AclUtil.isMinimalAcl(accessEntries) || !defaultEntries.isEmpty()) {
    // Save the new ACL to the child.
    child.addAclFeature(createAclFeature(accessEntries, defaultEntries));
    newPerm = createFsPermissionForExtendedAcl(accessEntries, childPerm);
  } else {
    // The child is receiving a minimal ACL.
    newPerm = createFsPermissionForMinimalAcl(accessEntries, childPerm);
  }

  child.setPermission(newPerm);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:79,代码来源:AclStorage.java


示例11: readINodeLogicalAcl

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * Reads the existing ACL of an inode.  This method always returns the full
 * logical ACL of the inode after reading relevant data from the inode's
 * {@link FsPermission} and {@link AclFeature}.  Note that every inode
 * logically has an ACL, even if no ACL has been set explicitly.  If the inode
 * does not have an extended ACL, then the result is a minimal ACL consising of
 * exactly 3 entries that correspond to the owner, group and other permissions.
 * This method always reads the inode's current state and does not support
 * querying by snapshot ID.  This is because the method is intended to support
 * ACL modification APIs, which always apply a delta on top of current state.
 *
 * @param inode INode to read
 * @return List<AclEntry> containing all logical inode ACL entries
 */
public static List<AclEntry> readINodeLogicalAcl(INode inode) {
  FsPermission perm = inode.getFsPermission();
  AclFeature f = inode.getAclFeature();
  if (f == null) {
    return AclUtil.getMinimalAcl(perm);
  }

  final List<AclEntry> existingAcl;
  // Split ACL entries stored in the feature into access vs. default.
  List<AclEntry> featureEntries = f.getEntries();
  ScopedAclEntries scoped = new ScopedAclEntries(featureEntries);
  List<AclEntry> accessEntries = scoped.getAccessEntries();
  List<AclEntry> defaultEntries = scoped.getDefaultEntries();

  // Pre-allocate list size for the explicit entries stored in the feature
  // plus the 3 implicit entries (owner, group and other) from the permission
  // bits.
  existingAcl = Lists.newArrayListWithCapacity(featureEntries.size() + 3);

  if (!accessEntries.isEmpty()) {
    // Add owner entry implied from user permission bits.
    existingAcl.add(new AclEntry.Builder().setScope(AclEntryScope.ACCESS)
        .setType(AclEntryType.USER).setPermission(perm.getUserAction())
        .build());

    // Next add all named user and group entries taken from the feature.
    existingAcl.addAll(accessEntries);

    // Add mask entry implied from group permission bits.
    existingAcl.add(new AclEntry.Builder().setScope(AclEntryScope.ACCESS)
        .setType(AclEntryType.MASK).setPermission(perm.getGroupAction())
        .build());

    // Add other entry implied from other permission bits.
    existingAcl.add(new AclEntry.Builder().setScope(AclEntryScope.ACCESS)
        .setType(AclEntryType.OTHER).setPermission(perm.getOtherAction())
        .build());
  } else {
    // It's possible that there is a default ACL but no access ACL. In this
    // case, add the minimal access ACL implied by the permission bits.
    existingAcl.addAll(AclUtil.getMinimalAcl(perm));
  }

  // Add all default entries after the access entries.
  existingAcl.addAll(defaultEntries);

  // The above adds entries in the correct order, so no need to sort here.
  return existingAcl;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:64,代码来源:AclStorage.java


示例12: ValidatedAclSpec

import org.apache.hadoop.fs.permission.ScopedAclEntries; //导入依赖的package包/类
/**
 * Creates a ValidatedAclSpec by pre-validating and sorting the given ACL
 * entries.  Pre-validation checks that it does not exceed the maximum
 * entries.  This check is performed before modifying the ACL, and it's
 * actually insufficient for enforcing the maximum number of entries.
 * Transformation logic can create additional entries automatically,such as
 * the mask and some of the default entries, so we also need additional
 * checks during transformation.  The up-front check is still valuable here
 * so that we don't run a lot of expensive transformation logic while
 * holding the namesystem lock for an attacker who intentionally sent a huge
 * ACL spec.
 *
 * @param aclSpec List<AclEntry> containing unvalidated input ACL spec
 * @throws AclException if validation fails
 */
public ValidatedAclSpec(List<AclEntry> aclSpec) throws AclException {
  Collections.sort(aclSpec, ACL_ENTRY_COMPARATOR);
  checkMaxEntries(new ScopedAclEntries(aclSpec));
  this.aclSpec = aclSpec;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:21,代码来源:AclTransformation.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HSAdminRefreshProtocolClientSideTranslatorPB类代码示例发布时间:2022-05-23
下一篇:
Java AlibabaAliqinFcSmsNumSendResponse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap