Java Code Examples for org.apache.hadoop.util.StringUtils#getStrings()

The following examples show how to use org.apache.hadoop.util.StringUtils#getStrings() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZookeeperUtils.java    From jstorm with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: ZKConfig.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: StreamJob.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: StreamJob.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: TezUtilsInternal.java    From tez with Apache License 2.0 5 votes vote down vote up
public static <T extends Enum<T>> Set<T> getEnums(Configuration conf, String confName,
    Class<T> enumType, String defaultValues) {
  String[] names = conf.getStrings(confName);
  if (names == null) {
    names = StringUtils.getStrings(defaultValues);
  }
  if (names == null) {
    return null;
  }
  Set<T> enums = new HashSet<>();
  for (String name : names) {
    enums.add(Enum.valueOf(enumType, name));
  }
  return enums;
}
 
Example 6
Source File: StreamJob.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: YarnRemoteInterpreterProcess.java    From zeppelin with Apache License 2.0 4 votes vote down vote up
private String[] getDefaultMRApplicationClasspath() {
  return StringUtils.getStrings(MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH);
}
 
Example 8
Source File: Configuration.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/** 
 * 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);
  }
}
 
Example 9
Source File: Configuration.java    From big-c with Apache License 2.0 3 votes vote down vote up
/** 
 * 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);
  }
}
 
Example 10
Source File: Configuration.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
	}
}
 
Example 11
Source File: Configuration.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
  }
}
 
Example 12
Source File: Configuration.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
	}
}
 
Example 13
Source File: Configuration.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
  }
}
 
Example 14
Source File: Configuration.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/** 
 * 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);
}
 
Example 15
Source File: Configuration.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example 16
Source File: Configuration.java    From hadoop-gpu with Apache License 2.0 2 votes vote down vote up
/** 
 * 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);
}
 
Example 17
Source File: Configuration.java    From big-c with Apache License 2.0 2 votes vote down vote up
/** 
 * 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);
}
 
Example 18
Source File: Configuration.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example 19
Source File: Configuration.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example 20
Source File: Configuration.java    From RDFS with Apache License 2.0 2 votes vote down vote up
/** 
 * 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);
}