/** * Returns an arraylist of strings. * @param str the comma separated string values * @return the arraylist of the comma separated string values */ public static String[] getStrings(String str){ String delim = ","; return getStrings(str, delim); }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then <code>null</code> is returned. * * @param name property name. * @return property value as an array of <code>String</code>s, * or <code>null</code>. */ public String[] getStrings(String name) { String valueString = get(name); return StringUtils.getStrings(valueString); }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then <code>null</code> is returned. * * @param name property name. * @return property value as an array of <code>String</code>s, * or <code>null</code>. */ public String[] getStrings(String name) { String valueString = get(name); return StringUtils.getStrings(valueString); }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then default value is returned. * * @param name property name. * @param defaultValue The default value * @return property value as an array of <code>String</code>s, * or default value. */ public String[] getStrings(String name, String... defaultValue) { String valueString = get(name); if (valueString == null) { return defaultValue; } else { return StringUtils.getStrings(valueString); } }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then default value is returned. * * @param name property name. * @param defaultValue The default value * @return property value as an array of <code>String</code>s, * or default value. */ public String[] getStrings(String name, String... defaultValue) { String valueString = get(name); if (valueString == null) { return defaultValue; } else { return StringUtils.getStrings(valueString); } }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then <code>null</code> is returned. * * @param name property name. * @return property value as an array of <code>String</code>s, * or <code>null</code>. */ public String[] getStrings(String name) { String valueString = get(name); return StringUtils.getStrings(valueString); }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then default value is returned. * * @param name property name. * @param defaultValue The default value * @return property value as an array of <code>String</code>s, * or default value. */ public String[] getStrings(String name, String... defaultValue) { String valueString = get(name); if (valueString == null) { return defaultValue; } else { return StringUtils.getStrings(valueString); } }
/** * Take a quorum list and split it to (trimmed) pairs * @param hostPortQuorumList list of form h1:port, h2:port2,... * @return a possibly empty list of values between commas. They may not be * valid hostname:port pairs */ public static List<String> splitToPairs(String hostPortQuorumList) { // split an address hot String[] strings = StringUtils.getStrings(hostPortQuorumList); int len = 0; if (strings != null) { len = strings.length; } List<String> tuples = new ArrayList<String>(len); if (strings != null) { for (String s : strings) { tuples.add(s.trim()); } } return tuples; }
private static boolean checkInputFormatForLlapEncode(Configuration conf, String ifName) { String formatList = HiveConf.getVar(conf, ConfVars.LLAP_IO_ENCODE_FORMATS); if (LOG.isDebugEnabled()) { LOG.debug("Checking " + ifName + " against " + formatList); } String[] formats = StringUtils.getStrings(formatList); if (formats != null) { for (String format : formats) { // TODO: should we check isAssignableFrom? if (ifName.equals(format)) { if (LOG.isInfoEnabled()) { LOG.info("Using SerDe-based LLAP reader for " + ifName); } return true; } } } return false; }
/** * Get the client ZK Quorum servers string * @param conf the configuration to read * @return Client quorum servers, or null if not specified */ public static String getClientZKQuorumServersString(Configuration conf) { String clientQuromServers = conf.get(HConstants.CLIENT_ZOOKEEPER_QUORUM); if (clientQuromServers == null) { return null; } int defaultClientPort = conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT, HConstants.DEFAULT_ZOOKEEPER_CLIENT_PORT); String clientZkClientPort = Integer.toString(conf.getInt(HConstants.CLIENT_ZOOKEEPER_CLIENT_PORT, defaultClientPort)); // Build the ZK quorum server string with "server:clientport" list, separated by ',' final String[] serverHosts = StringUtils.getStrings(clientQuromServers); return buildZKQuorumServerString(serverHosts, clientZkClientPort); } }
public static Collection<Class<?>> getClassNamesFromConfig(HiveConf hiveConf, ConfVars confVar) { String[] classNames = org.apache.hadoop.util.StringUtils.getStrings(HiveConf.getVar(hiveConf, confVar)); if (classNames == null) { return new ArrayList<>(0); } Collection<Class<?>> classList = new ArrayList<Class<?>>(classNames.length); for (String className : classNames) { if (StringUtils.isEmpty(className)) { continue; } try { classList.add(Class.forName(className)); } catch (Exception ex) { LOG.warn("Cannot create class {} for {} checks", className, confVar.varname); } } return classList; }
/** * Split a quorum list into a list of hostnames and ports * @param hostPortQuorumList split to a list of hosts and ports * @return a list of values */ public static List<HostAndPort> splitToHostsAndPorts(String hostPortQuorumList) { // split an address hot String[] strings = StringUtils.getStrings(hostPortQuorumList); int len = 0; if (strings != null) { len = strings.length; } List<HostAndPort> list = new ArrayList<HostAndPort>(len); if (strings != null) { for (String s : strings) { list.add(HostAndPort.fromString(s.trim()).withDefaultPort(DEFAULT_PORT)); } } return list; }
LOG.debug("Checking " + ifName + " against " + formatList); String[] formats = StringUtils.getStrings(formatList); if (formats != null) { for (String format : formats) {
case NFLY: final URI[] targetUris = StringUtils.stringToURI( StringUtils.getStrings(target)); newLink = new INodeLink<T>(fullPath, aUgi, getTargetFileSystem(settings, targetUris), targetUris);
private static Set<String> parseConnectUsersFromConf(String value) { //Removed the logic to convert the allowed users to lower case, as user names need to be case sensitive return Sets.newHashSet(StringUtils.getStrings(value)); } }
/** * Get the comma delimited values of the <code>name</code> property as * an array of <code>String</code>s. * If no such property is specified then <code>null</code> is returned. * * @param name property name. * @return property value as an array of <code>String</code>s, * or <code>null</code>. */ public String[] getStrings(String name) { String valueString = get(name); return StringUtils.getStrings(valueString); }
private static Set<String> parseConnectUsersFromConf(String value) { if (value != null) { value = value.toLowerCase(); } return Sets.newHashSet(StringUtils.getStrings(value)); } }
public static void addMapReduceToClasspath(Map<String, String> env, Configuration conf) { boolean crossPlatform = conf.getBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM, MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM); for (String c : conf.getStrings(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH, crossPlatform ? StringUtils.getStrings(MRJobConfig.DEFAULT_MAPREDUCE_CROSS_PLATFORM_APPLICATION_CLASSPATH) : StringUtils.getStrings(MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH))) { MRApps.addToEnvironment(env, ApplicationConstants.Environment.CLASSPATH.name(), c.trim(), conf); } }
/** * get the uris of all the files/caches */ protected void getURIs(String lcacheArchives, String lcacheFiles) { String archives[] = StringUtils.getStrings(lcacheArchives); String files[] = StringUtils.getStrings(lcacheFiles); fileURIs = StringUtils.stringToURI(files); archiveURIs = StringUtils.stringToURI(archives); }
/** * get the uris of all the files/caches */ protected void getURIs(String lcacheArchives, String lcacheFiles) { String archives[] = StringUtils.getStrings(lcacheArchives); String files[] = StringUtils.getStrings(lcacheFiles); fileURIs = StringUtils.stringToURI(files); archiveURIs = StringUtils.stringToURI(archives); }