gpt4 book ai didi

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

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

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

ZKUtil.parseAuth介绍

[英]Parse a comma-separated list of authentication mechanisms. Each such mechanism should be of the form 'scheme:auth' -- the same syntax used for the 'addAuth' command in the ZK CLI.
[中]解析以逗号分隔的身份验证机制列表。每个这样的机制的形式都应该是“scheme:auth”——与ZK CLI中的“addAuth”命令使用的语法相同。

代码示例

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

public static List<ZKUtil.ZKAuthInfo> getZKAuths() throws Exception {
  // Parse Auths from configuration.
  String zkAuthConf = KylinConfig.getInstanceFromEnv().getZKAuths();
  try {
    zkAuthConf = ZKUtil.resolveConfIndirection(zkAuthConf);
    if (zkAuthConf != null) {
      return ZKUtil.parseAuth(zkAuthConf);
    } else {
      return Collections.emptyList();
    }
  } catch (Exception e) {
    logger.error("Couldn't read Auth based on 'kylin.env.zookeeper.zk-auth' in kylin.properties");
    throw e;
  }
}

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

/**
  * Utility method to fetch ZK auth info from the configuration.
  * @throws java.io.IOException if the Zookeeper ACLs configuration file
  * cannot be read
  * @throws ZKUtil.BadAuthFormatException if the auth format is invalid
  */
 public static List<ZKUtil.ZKAuthInfo> getZKAuthInfos(Configuration conf,
   String configKey) throws IOException {
  char[] zkAuthChars = conf.getPassword(configKey);
  String zkAuthConf =
    zkAuthChars != null ? String.valueOf(zkAuthChars) : null;
  try {
   zkAuthConf = ZKUtil.resolveConfIndirection(zkAuthConf);
   if (zkAuthConf != null) {
    return ZKUtil.parseAuth(zkAuthConf);
   } else {
    return Collections.emptyList();
   }
  } catch (IOException | ZKUtil.BadAuthFormatException e) {
   LOG.error("Couldn't read Auth based on {}", configKey);
   throw e;
  }
 }
}

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

/**
  * Utility method to fetch ZK auth info from the configuration
  */
 public static List<ZKUtil.ZKAuthInfo> getZKAuths(Configuration conf)
   throws Exception {
  String zkAuthConf = conf.get(YarnConfiguration.RM_ZK_AUTH);
  try {
   zkAuthConf = ZKUtil.resolveConfIndirection(zkAuthConf);
   if (zkAuthConf != null) {
    return ZKUtil.parseAuth(zkAuthConf);
   } else {
    return Collections.emptyList();
   }
  } catch (Exception e) {
   LOG.error("Couldn't read Auth based on " + YarnConfiguration.RM_ZK_AUTH);
   throw e;
  }
 }
}

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

/**
  * Utility method to fetch ZK auth info from the configuration
  */
 public static List<ZKUtil.ZKAuthInfo> getZKAuths(Configuration conf)
   throws Exception {
  String zkAuthConf = conf.get(YarnConfiguration.RM_ZK_AUTH);
  try {
   zkAuthConf = ZKUtil.resolveConfIndirection(zkAuthConf);
   if (zkAuthConf != null) {
    return ZKUtil.parseAuth(zkAuthConf);
   } else {
    return Collections.emptyList();
   }
  } catch (Exception e) {
   LOG.error("Couldn't read Auth based on " + YarnConfiguration.RM_ZK_AUTH);
   throw e;
  }
 }
}

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

public List<ZKUtil.ZKAuthInfo> getZkAuths() throws LlamaException {
  String zkAuthConf = conf.get(ZK_AUTH);
  try {
   zkAuthConf = ZKUtil.resolveConfIndirection(zkAuthConf);
   if (zkAuthConf != null) {
    return ZKUtil.parseAuth(zkAuthConf);
   } else {
    return Collections.emptyList();
   }
  } catch (Exception e) {
   throw new LlamaException(e, ErrorCode.ILLEGAL_ARGUMENT,
     "Couldn't read Auth based on ", ZK_AUTH);
  }
 }
}

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

public static List<ZKUtil.ZKAuthInfo> getZKAuths() throws Exception {
  // Parse Auths from configuration.
  String zkAuthConf = KylinConfig.getInstanceFromEnv().getZKAuths();
  try {
    zkAuthConf = ZKUtil.resolveConfIndirection(zkAuthConf);
    if (zkAuthConf != null) {
      return ZKUtil.parseAuth(zkAuthConf);
    } else {
      return Collections.emptyList();
    }
  } catch (Exception e) {
    logger.error("Couldn't read Auth based on 'kylin.env.zookeeper.zk-auth' in kylin.properties");
    throw e;
  }
}

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

List<ZKAuthInfo> zkAuths;
if (zkAuthConf != null) {
 zkAuths = ZKUtil.parseAuth(zkAuthConf);
} else {
 zkAuths = Collections.emptyList();

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

List<ZKAuthInfo> zkAuths;
if (zkAuthConf != null) {
 zkAuths = ZKUtil.parseAuth(zkAuthConf);
} else {
 zkAuths = Collections.emptyList();

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

List<ZKAuthInfo> zkAuths;
if (zkAuthConf != null) {
 zkAuths = ZKUtil.parseAuth(zkAuthConf);
} else {
 zkAuths = Collections.emptyList();

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

@Test
public void testEmptyAuth() {
 List<ZKAuthInfo> result = ZKUtil.parseAuth("");
 assertTrue(result.isEmpty());
}

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

@Test
public void testNullAuth() {
 List<ZKAuthInfo> result = ZKUtil.parseAuth(null);
 assertTrue(result.isEmpty());
}

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

@Test
public void testNullAuth() {
 List<ZKAuthInfo> result = ZKUtil.parseAuth(null);
 assertTrue(result.isEmpty());
}

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

@Test
public void testEmptyAuth() {
 List<ZKAuthInfo> result = ZKUtil.parseAuth("");
 assertTrue(result.isEmpty());
}

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

List<ZKAuthInfo> zkAuths;
if (zkAuthConf != null) {
 zkAuths = ZKUtil.parseAuth(zkAuthConf);
} else {
 zkAuths = Collections.emptyList();

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

@Test
public void testGoodAuths() {
 List<ZKAuthInfo> result = ZKUtil.parseAuth(
   "scheme:data,\n   scheme2:user:pass");
 assertEquals(2, result.size());
 ZKAuthInfo auth0 = result.get(0);
 assertEquals("scheme", auth0.getScheme());
 assertEquals("data", new String(auth0.getAuth()));
 
 ZKAuthInfo auth1 = result.get(1);
 assertEquals("scheme2", auth1.getScheme());
 assertEquals("user:pass", new String(auth1.getAuth()));
}

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

@Test
public void testGoodAuths() {
 List<ZKAuthInfo> result = ZKUtil.parseAuth(
   "scheme:data,\n   scheme2:user:pass");
 assertEquals(2, result.size());
 ZKAuthInfo auth0 = result.get(0);
 assertEquals("scheme", auth0.getScheme());
 assertEquals("data", new String(auth0.getAuth()));
 
 ZKAuthInfo auth1 = result.get(1);
 assertEquals("scheme2", auth1.getScheme());
 assertEquals("user:pass", new String(auth1.getAuth()));
}

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