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


Java AclEntry.parseAclSpec方法代码示例

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


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

示例1: testMultipleAclSpecParsing

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
@Test
public void testMultipleAclSpecParsing() throws Exception {
  List<AclEntry> parsedList = AclEntry.parseAclSpec(
      "group::rwx,user:user1:rwx,user:user2:rw-,"
          + "group:group1:rw-,default:group:group1:rw-", true);

  AclEntry basicAcl = new AclEntry.Builder().setType(AclEntryType.GROUP)
      .setPermission(FsAction.ALL).build();
  AclEntry user1Acl = new AclEntry.Builder().setType(AclEntryType.USER)
      .setPermission(FsAction.ALL).setName("user1").build();
  AclEntry user2Acl = new AclEntry.Builder().setType(AclEntryType.USER)
      .setPermission(FsAction.READ_WRITE).setName("user2").build();
  AclEntry group1Acl = new AclEntry.Builder().setType(AclEntryType.GROUP)
      .setPermission(FsAction.READ_WRITE).setName("group1").build();
  AclEntry defaultAcl = new AclEntry.Builder().setType(AclEntryType.GROUP)
      .setPermission(FsAction.READ_WRITE).setName("group1")
      .setScope(AclEntryScope.DEFAULT).build();
  List<AclEntry> expectedList = new ArrayList<AclEntry>();
  expectedList.add(basicAcl);
  expectedList.add(user1Acl);
  expectedList.add(user2Acl);
  expectedList.add(group1Acl);
  expectedList.add(defaultAcl);
  assertEquals("Parsed Acl not correct", expectedList, parsedList);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:26,代码来源:TestAclCommands.java

示例2: 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

示例3: testSetfaclValidationsWithoutPermissions

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
@Test
public void testSetfaclValidationsWithoutPermissions() throws Exception {
  List<AclEntry> parsedList = new ArrayList<AclEntry>();
  try {
    parsedList = AclEntry.parseAclSpec("user:user1:", true);
  } catch (IllegalArgumentException e) {
  }
  assertTrue(parsedList.size() == 0);
  assertFalse("setfacl should fail with less arguments",
      0 == runCommand(new String[] { "-setfacl", "-m", "user:user1:",
          "/path" }));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:13,代码来源:TestAclCommands.java

示例4: testMultipleAclSpecParsingWithoutPermissions

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
@Test
public void testMultipleAclSpecParsingWithoutPermissions() throws Exception {
  List<AclEntry> parsedList = AclEntry.parseAclSpec(
      "user::,user:user1:,group::,group:group1:,mask::,other::,"
          + "default:user:user1::,default:mask::", false);

  AclEntry owner = new AclEntry.Builder().setType(AclEntryType.USER).build();
  AclEntry namedUser = new AclEntry.Builder().setType(AclEntryType.USER)
      .setName("user1").build();
  AclEntry group = new AclEntry.Builder().setType(AclEntryType.GROUP).build();
  AclEntry namedGroup = new AclEntry.Builder().setType(AclEntryType.GROUP)
      .setName("group1").build();
  AclEntry mask = new AclEntry.Builder().setType(AclEntryType.MASK).build();
  AclEntry other = new AclEntry.Builder().setType(AclEntryType.OTHER).build();
  AclEntry defaultUser = new AclEntry.Builder()
      .setScope(AclEntryScope.DEFAULT).setType(AclEntryType.USER)
      .setName("user1").build();
  AclEntry defaultMask = new AclEntry.Builder()
      .setScope(AclEntryScope.DEFAULT).setType(AclEntryType.MASK).build();
  List<AclEntry> expectedList = new ArrayList<AclEntry>();
  expectedList.add(owner);
  expectedList.add(namedUser);
  expectedList.add(group);
  expectedList.add(namedGroup);
  expectedList.add(mask);
  expectedList.add(other);
  expectedList.add(defaultUser);
  expectedList.add(defaultMask);
  assertEquals("Parsed Acl not correct", expectedList, parsedList);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:31,代码来源:TestAclCommands.java

示例5: getAclPermission

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
public List<AclEntry> getAclPermission(boolean includePermission) {
  final String v = getValue();
  return (v != null ? AclEntry.parseAclSpec(v, includePermission) : AclEntry
      .parseAclSpec(DEFAULT, includePermission));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:AclPermissionParam.java

示例6: FSSetAcl

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
/**
 * Creates a set-acl executor.
 *
 * @param path path to set the acl.
 * @param aclSpec acl to set.
 */
public FSSetAcl(String path, String aclSpec) {
  this.path = new Path(path);
  this.aclEntries = AclEntry.parseAclSpec(aclSpec, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FSOperations.java

示例7: FSModifyAclEntries

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
/**
 * Creates a modify-acl executor.
 *
 * @param path path to set the acl.
 * @param aclSpec acl to set.
 */
public FSModifyAclEntries(String path, String aclSpec) {
  this.path = new Path(path);
  this.aclEntries = AclEntry.parseAclSpec(aclSpec, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FSOperations.java

示例8: FSRemoveAclEntries

import org.apache.hadoop.fs.permission.AclEntry; //导入方法依赖的package包/类
/**
 * Creates a remove acl entry executor.
 *
 * @param path path to set the acl.
 * @param aclSpec acl parts to remove.
 */
public FSRemoveAclEntries(String path, String aclSpec) {
  this.path = new Path(path);
  this.aclEntries = AclEntry.parseAclSpec(aclSpec, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FSOperations.java


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