public static AuthenticationMethod getAuthenticationMethod(Configuration conf) { String value = conf.get(HADOOP_SECURITY_AUTHENTICATION, "simple"); try { return Enum.valueOf(AuthenticationMethod.class, StringUtils.toUpperCase(value)); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("Invalid attribute value for " + HADOOP_SECURITY_AUTHENTICATION + " of " + value); } }
private HostnameVerifier getHostnameVerifier(Configuration conf) throws GeneralSecurityException, IOException { return getHostnameVerifier(StringUtils.toUpperCase( conf.get(SSL_HOSTNAME_VERIFIER_KEY, "DEFAULT").trim())); }
public static StorageType parseStorageType(String s) { return StorageType.valueOf(StringUtils.toUpperCase(s)); }
private InitMode initMode() { LOG.debug("from system property: "+ System.getProperty(MS_INIT_MODE_KEY)); LOG.debug("from environment variable: "+ System.getenv(MS_INIT_MODE_KEY)); String m = System.getProperty(MS_INIT_MODE_KEY); String m2 = m == null ? System.getenv(MS_INIT_MODE_KEY) : m; return InitMode.valueOf( StringUtils.toUpperCase((m2 == null ? InitMode.NORMAL.name() : m2))); } }
/** * This method checks if the given HTTP request corresponds to a management * operation. * * @param request The HTTP request * @return true if the given HTTP request corresponds to a management * operation false otherwise * @throws IOException In case of I/O error. */ protected final boolean isManagementOperation(HttpServletRequest request) throws IOException { String op = ServletUtils.getParameter(request, KerberosDelegationTokenAuthenticator.OP_PARAM); op = (op != null) ? StringUtils.toUpperCase(op) : null; return DELEGATION_TOKEN_OPS.contains(op) && !request.getMethod().equals("OPTIONS"); }
/** * A util function to retrieve specific additional sasl property from config. * Used by subclasses to read sasl properties used by themselves. * @param conf the configuration * @param configKey the config key to look for * @param defaultQOP the default QOP if the key is missing * @return sasl property associated with the given key */ static Map<String, String> getSaslProperties(Configuration conf, String configKey, QualityOfProtection defaultQOP) { Map<String, String> saslProps = new TreeMap<>(); String[] qop = conf.getStrings(configKey, defaultQOP.toString()); for (int i=0; i < qop.length; i++) { qop[i] = QualityOfProtection.valueOf( StringUtils.toUpperCase(qop[i])).getSaslQop(); } saslProps.put(Sasl.QOP, StringUtils.join(",", qop)); saslProps.put(Sasl.SERVER_AUTH, "true"); return saslProps; } }
@Override public void setConf(Configuration conf) { this.conf = conf; properties = new TreeMap<String,String>(); String[] qop = conf.getTrimmedStrings( CommonConfigurationKeysPublic.HADOOP_RPC_PROTECTION, QualityOfProtection.AUTHENTICATION.toString()); for (int i=0; i < qop.length; i++) { qop[i] = QualityOfProtection.valueOf( StringUtils.toUpperCase(qop[i])).getSaslQop(); } properties.put(Sasl.QOP, StringUtils.join(",", qop)); properties.put(Sasl.SERVER_AUTH, "true"); }
@Override protected void processOptions(LinkedList<String> args) throws IOException { name = StringUtils.popOptionWithArgument("-n", args); String en = StringUtils.popOptionWithArgument("-e", args); if (en != null) { try { encoding = XAttrCodec.valueOf(StringUtils.toUpperCase(en)); } catch (IllegalArgumentException e) { throw new IllegalArgumentException( "Invalid/unsupported encoding option specified: " + en); } Preconditions.checkArgument(encoding != null, "Invalid/unsupported encoding option specified: " + en); } boolean r = StringUtils.popOption("-R", args); setRecursive(r); dump = StringUtils.popOption("-d", args); if (!dump && name == null) { throw new HadoopIllegalArgumentException( "Must specify '-n name' or '-d' option."); } if (args.isEmpty()) { throw new HadoopIllegalArgumentException("<path> is missing."); } if (args.size() > 1) { throw new HadoopIllegalArgumentException("Too many arguments."); } }
String op = ServletUtils.getParameter(request, KerberosDelegationTokenAuthenticator.OP_PARAM); op = (op != null) ? StringUtils.toUpperCase(op) : null; if (isManagementOperation(request)) { KerberosDelegationTokenAuthenticator.DelegationTokenOperation dtOp =
try { aclType = Enum.valueOf( AclEntryType.class, StringUtils.toUpperCase(split[index])); builder.setType(aclType); index++;
public RollingUpgradeOp(FSEditLogOpCodes code, String name) { super(code); this.name = StringUtils.toUpperCase(name); }
private static String getOp(QueryStringDecoder decoder) { Map<String, List<String>> parameters = decoder.parameters(); return parameters.containsKey("op") ? StringUtils.toUpperCase(parameters.get("op").get(0)) : null; }
/** * Attempt to parse a storage uri with storage class and URI. The storage * class component of the uri is case-insensitive. * * @param rawLocation Location string of the format [type]uri, where [type] is * optional. * @return A StorageLocation object if successfully parsed, null otherwise. * Does not throw any exceptions. */ public static StorageLocation parse(String rawLocation) throws IOException, SecurityException { Matcher matcher = regex.matcher(rawLocation); StorageType storageType = StorageType.DEFAULT; String location = rawLocation; if (matcher.matches()) { String classString = matcher.group(1); location = matcher.group(2).trim(); if (!classString.isEmpty()) { storageType = StorageType.valueOf(StringUtils.toUpperCase(classString)); } } //do Path.toURI instead of new URI(location) as this ensures that //"/a/b" and "/a/b/" are represented in a consistent manner return new StorageLocation(storageType, new Path(location).toUri()); }
try (PrintStream out = outputFile.equals("-") ? System.out : new PrintStream(outputFile, "UTF-8")) { switch (StringUtils.toUpperCase(processor)) { case "FILEDISTRIBUTION": long maxSize = Long.parseLong(cmd.getOptionValue("maxSize", "0"));
/** * Counters to measure the usage of the different file systems. * Always return the String array with two elements. First one is the name of * BYTES_READ counter and second one is of the BYTES_WRITTEN counter. */ protected static String[] getFileSystemCounterNames(String uriScheme) { String scheme = StringUtils.toUpperCase(uriScheme); return new String[]{scheme+"_BYTES_READ", scheme+"_BYTES_WRITTEN"}; }
@Override final E parse(final String str) { return Enum.valueOf(enumClass, StringUtils.toUpperCase(str)); } }
@Override final E parse(final String str) { return Enum.valueOf(enumClass, StringUtils.toUpperCase(str)); } }
/** Convert the given String to a StoragePolicySatisfierMode. */ public static StoragePolicySatisfierMode fromString(String s) { return MAP.get(StringUtils.toUpperCase(s)); } }
private InitMode initMode() { LOG.debug("from system property: "+ System.getProperty(MS_INIT_MODE_KEY)); LOG.debug("from environment variable: "+ System.getenv(MS_INIT_MODE_KEY)); String m = System.getProperty(MS_INIT_MODE_KEY); String m2 = m == null ? System.getenv(MS_INIT_MODE_KEY) : m; return InitMode.valueOf( StringUtils.toUpperCase((m2 == null ? InitMode.NORMAL.name() : m2))); } }
public QueueState getState(String queue) { String state = get(getQueuePrefix(queue) + STATE); return (state != null) ? QueueState.valueOf(StringUtils.toUpperCase(state)) : QueueState.RUNNING; }