gpt4 book ai didi

org.apache.hadoop.util.ZKUtil.parseACLs()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 10:26:49 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.util.ZKUtil.parseACLs()方法的一些代码示例,展示了ZKUtil.parseACLs()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKUtil.parseACLs()方法的具体详情如下:
包路径:org.apache.hadoop.util.ZKUtil
类名称:ZKUtil
方法名:parseACLs

ZKUtil.parseACLs介绍

[英]Parse comma separated list of ACL entries to secure generated nodes, e.g. sasl:hdfs/host1@MY.DOMAIN:cdrwa,sasl:hdfs/host2@MY.DOMAIN:cdrwa
[中]解析以逗号分隔的ACL条目列表以保护生成的节点,例如:sasl:hdfs/host1@MY.DOMAIN:cdrwa,sasl:hdfs/host2@MY.DOMAIN:cdrwa

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Utility method to fetch the ZK ACLs from the configuration.
 * @throws java.io.IOException if the Zookeeper ACLs configuration file
 * cannot be read
 */
public static List<ACL> getZKAcls(Configuration conf) throws IOException {
 // Parse authentication from configuration.
 String zkAclConf = conf.get(CommonConfigurationKeys.ZK_ACL,
   CommonConfigurationKeys.ZK_ACL_DEFAULT);
 try {
  zkAclConf = ZKUtil.resolveConfIndirection(zkAclConf);
  return ZKUtil.parseACLs(zkAclConf);
 } catch (IOException | ZKUtil.BadAclFormatException e) {
  LOG.error("Couldn't read ACLs based on {}",
    CommonConfigurationKeys.ZK_ACL);
  throw e;
 }
}

代码示例来源:origin: apache/kylin

public static List<ACL> getZKAcls() throws Exception {
  // Parse ACLs from configuration.
  String zkAclConf = KylinConfig.getInstanceFromEnv().getZKAcls();
  try {
    zkAclConf = ZKUtil.resolveConfIndirection(zkAclConf);
    return ZKUtil.parseACLs(zkAclConf);
  } catch (Exception e) {
    logger.error("Couldn't read ACLs based on 'kylin.env.zookeeper.zk-acl' in kylin.properties");
    throw e;
  }
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

private void initZK() throws HadoopIllegalArgumentException, IOException,
  KeeperException {
 zkQuorum = conf.get(ZK_QUORUM_KEY);
 int zkTimeout = conf.getInt(ZK_SESSION_TIMEOUT_KEY,
   ZK_SESSION_TIMEOUT_DEFAULT);
 // Parse ACLs from configuration.
 String zkAclConf = conf.get(ZK_ACL_KEY, ZK_ACL_DEFAULT);
 zkAclConf = ZKUtil.resolveConfIndirection(zkAclConf);
 List<ACL> zkAcls = ZKUtil.parseACLs(zkAclConf);
 if (zkAcls.isEmpty()) {
  zkAcls = Ids.CREATOR_ALL_ACL;
 }
 
 // Parse authentication from configuration.
 List<ZKAuthInfo> zkAuths = SecurityUtil.getZKAuthInfos(conf, ZK_AUTH_KEY);
 // Sanity check configuration.
 Preconditions.checkArgument(zkQuorum != null,
   "Missing required configuration '%s' for ZooKeeper quorum",
   ZK_QUORUM_KEY);
 Preconditions.checkArgument(zkTimeout > 0,
   "Invalid ZK session timeout %s", zkTimeout);
 
 int maxRetryNum = conf.getInt(
   CommonConfigurationKeys.HA_FC_ELECTOR_ZK_OP_RETRIES_KEY,
   CommonConfigurationKeys.HA_FC_ELECTOR_ZK_OP_RETRIES_DEFAULT);
 elector = new ActiveStandbyElector(zkQuorum,
   zkTimeout, getParentZnode(), zkAcls, zkAuths,
   new ElectorCallbacks(), maxRetryNum);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Parse an ACL list. This includes configuration indirection
 * {@link ZKUtil#resolveConfIndirection(String)}
 * @param zkAclConf configuration string
 * @return an ACL list
 * @throws IOException on a bad ACL parse
 */
public List<ACL> parseACLs(String zkAclConf) throws IOException {
 try {
  return ZKUtil.parseACLs(ZKUtil.resolveConfIndirection(zkAclConf));
 } catch (ZKUtil.BadAclFormatException e) {
  throw new IOException("Parsing " + zkAclConf + " :" + e, e);
 }
}

代码示例来源:origin: io.hops/hadoop-yarn-registry

/**
 * Parse an ACL list. This includes configuration indirection
 * {@link ZKUtil#resolveConfIndirection(String)}
 * @param zkAclConf configuration string
 * @return an ACL list
 * @throws IOException on a bad ACL parse
 */
public List<ACL> parseACLs(String zkAclConf) throws IOException {
 try {
  return ZKUtil.parseACLs(ZKUtil.resolveConfIndirection(zkAclConf));
 } catch (ZKUtil.BadAclFormatException e) {
  throw new IOException("Parsing " + zkAclConf + " :" + e, e);
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

/**
 * Utility method to fetch the ZK ACLs from the configuration
 */
public static List<ACL> getZKAcls(Configuration conf) throws Exception {
 // Parse authentication from configuration.
 String zkAclConf =
   conf.get(YarnConfiguration.RM_ZK_ACL,
     YarnConfiguration.DEFAULT_RM_ZK_ACL);
 try {
  zkAclConf = ZKUtil.resolveConfIndirection(zkAclConf);
  return ZKUtil.parseACLs(zkAclConf);
 } catch (Exception e) {
  LOG.error("Couldn't read ACLs based on " + YarnConfiguration.RM_ZK_ACL);
  throw e;
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

/**
 * Utility method to fetch the ZK ACLs from the configuration
 */
public static List<ACL> getZKAcls(Configuration conf) throws Exception {
 // Parse authentication from configuration.
 String zkAclConf =
   conf.get(YarnConfiguration.RM_ZK_ACL,
     YarnConfiguration.DEFAULT_RM_ZK_ACL);
 try {
  zkAclConf = ZKUtil.resolveConfIndirection(zkAclConf);
  return ZKUtil.parseACLs(zkAclConf);
 } catch (Exception e) {
  LOG.error("Couldn't read ACLs based on " + YarnConfiguration.RM_ZK_ACL);
  throw e;
 }
}

代码示例来源:origin: com.cloudera.llama/llama

public List<ACL> getZkAcls() throws LlamaException {
 // Parse authentication from configuration.
 String zkAclConf = conf.get(ZK_ACL, ZK_ACL_DEFAULT);
 try {
  zkAclConf = ZKUtil.resolveConfIndirection(zkAclConf);
  return ZKUtil.parseACLs(zkAclConf);
 } catch (Exception e) {
  throw new LlamaException(e, ErrorCode.ILLEGAL_ARGUMENT,
    "Couldn't read ACLs based on ", ZK_ACL);
 }
}

代码示例来源:origin: org.apache.kylin/kylin-storage-hbase

public static List<ACL> getZKAcls() throws Exception {
  // Parse ACLs from configuration.
  String zkAclConf = KylinConfig.getInstanceFromEnv().getZKAcls();
  try {
    zkAclConf = ZKUtil.resolveConfIndirection(zkAclConf);
    return ZKUtil.parseACLs(zkAclConf);
  } catch (Exception e) {
    logger.error("Couldn't read ACLs based on 'kylin.env.zookeeper.zk-acl' in kylin.properties");
    throw e;
  }
}

代码示例来源:origin: io.hops/hadoop-common

List<ACL> zkAcls = ZKUtil.parseACLs(zkAclConf);
if (zkAcls.isEmpty()) {
 zkAcls = Ids.CREATOR_ALL_ACL;

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

List<ACL> zkAcls = ZKUtil.parseACLs(zkAclConf);
if (zkAcls.isEmpty()) {
 zkAcls = Ids.CREATOR_ALL_ACL;

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testNullACL() {
 List<ACL> result = ZKUtil.parseACLs(null);
 assertTrue(result.isEmpty());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
public void testNullACL() {
 List<ACL> result = ZKUtil.parseACLs(null);
 assertTrue(result.isEmpty());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
public void testEmptyACL() {
 List<ACL> result = ZKUtil.parseACLs("");
 assertTrue(result.isEmpty());
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testEmptyACL() {
 List<ACL> result = ZKUtil.parseACLs("");
 assertTrue(result.isEmpty());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

List<ACL> zkAcls = ZKUtil.parseACLs(zkAclConf);
if (zkAcls.isEmpty()) {
 zkAcls = Ids.CREATOR_ALL_ACL;

代码示例来源:origin: ch.cern.hadoop/hadoop-common

private static void badAcl(String acls, String expectedErr) {
 try {
  ZKUtil.parseACLs(acls);
  fail("Should have failed to parse '" + acls + "'");
 } catch (BadAclFormatException e) {
  assertEquals(expectedErr, e.getMessage());
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

private static void badAcl(String acls, String expectedErr) {
 try {
  ZKUtil.parseACLs(acls);
  fail("Should have failed to parse '" + acls + "'");
 } catch (BadAclFormatException e) {
  assertEquals(expectedErr, e.getMessage());
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
public void testGoodACLs() {
 List<ACL> result = ZKUtil.parseACLs(
   "sasl:hdfs/host1@MY.DOMAIN:cdrwa, sasl:hdfs/host2@MY.DOMAIN:ca");
 ACL acl0 = result.get(0);
 assertEquals(Perms.CREATE | Perms.DELETE | Perms.READ |
   Perms.WRITE | Perms.ADMIN, acl0.getPerms());
 assertEquals("sasl", acl0.getId().getScheme());
 assertEquals("hdfs/host1@MY.DOMAIN", acl0.getId().getId());
 
 ACL acl1 = result.get(1);
 assertEquals(Perms.CREATE | Perms.ADMIN, acl1.getPerms());
 assertEquals("sasl", acl1.getId().getScheme());
 assertEquals("hdfs/host2@MY.DOMAIN", acl1.getId().getId());
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testGoodACLs() {
 List<ACL> result = ZKUtil.parseACLs(
   "sasl:hdfs/host1@MY.DOMAIN:cdrwa, sasl:hdfs/host2@MY.DOMAIN:ca");
 ACL acl0 = result.get(0);
 assertEquals(Perms.CREATE | Perms.DELETE | Perms.READ |
   Perms.WRITE | Perms.ADMIN, acl0.getPerms());
 assertEquals("sasl", acl0.getId().getScheme());
 assertEquals("hdfs/host1@MY.DOMAIN", acl0.getId().getId());
 
 ACL acl1 = result.get(1);
 assertEquals(Perms.CREATE | Perms.ADMIN, acl1.getPerms());
 assertEquals("sasl", acl1.getId().getScheme());
 assertEquals("hdfs/host2@MY.DOMAIN", acl1.getId().getId());
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com