本文整理了Java中org.apache.hadoop.util.ZKUtil.parseAuth()
方法的一些代码示例,展示了ZKUtil.parseAuth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKUtil.parseAuth()
方法的具体详情如下:
包路径:org.apache.hadoop.util.ZKUtil
类名称: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()));
}
内容来源于网络,如有侵权,请联系作者删除!