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

The following examples show how to use org.apache.hadoop.util.StringUtils#getTrimmedStrings() . 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: Dispatcher.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Read set of host names from a file
 * 
 * @return set of host names
 */
static Set<String> getHostListFromFile(String fileName, String type) {
  Set<String> nodes = new HashSet<String>();
  try {
    HostsFileReader.readFileToSet(type, fileName, nodes);
    return StringUtils.getTrimmedStrings(nodes);
  } catch (IOException e) {
    throw new IllegalArgumentException(
        "Failed to read host list from file: " + fileName);
  }
}
 
Example 2
Source File: Dispatcher.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Read set of host names from a file
 * 
 * @return set of host names
 */
static Set<String> getHostListFromFile(String fileName, String type) {
  Set<String> nodes = new HashSet<String>();
  try {
    HostsFileReader.readFileToSet(type, fileName, nodes);
    return StringUtils.getTrimmedStrings(nodes);
  } catch (IOException e) {
    throw new IllegalArgumentException(
        "Failed to read host list from file: " + fileName);
  }
}
 
Example 3
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s,
 *         or default value.
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
  String valueString = get(name);
  if (null == valueString) {
    return defaultValue;
  } else {
    return StringUtils.getTrimmedStrings(valueString);
  }
}
 
Example 4
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s,
 *         or default value.
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
	String valueString = get(name);
	if (null == valueString) {
		return defaultValue;
	} else {
		return StringUtils.getTrimmedStrings(valueString);
	}
}
 
Example 5
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s,
 *         or default value.
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
  String valueString = get(name);
  if (null == valueString) {
    return defaultValue;
  } else {
    return StringUtils.getTrimmedStrings(valueString);
  }
}
 
Example 6
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s, 
 *         or default value. 
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
  String valueString = get(name);
  if (null == valueString) {
    return defaultValue;
  } else {
    return StringUtils.getTrimmedStrings(valueString);
  }
}
 
Example 7
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s, 
 *         or default value. 
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
  String valueString = get(name);
  if (null == valueString) {
    return defaultValue;
  } else {
    return StringUtils.getTrimmedStrings(valueString);
  }
}
 
Example 8
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s,
 *         or default value.
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
	String valueString = get(name);
	if (null == valueString) {
		return defaultValue;
	} else {
		return StringUtils.getTrimmedStrings(valueString);
	}
}
 
Example 9
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s,
 *         or default value.
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
  String valueString = get(name);
  if (null == valueString) {
    return defaultValue;
  } else {
    return StringUtils.getTrimmedStrings(valueString);
  }
}
 
Example 10
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, trimmed of the leading and trailing whitespace.
 * 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 trimmed <code>String</code>s,
 *         or default value.
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
	String valueString = get(name);
	if (null == valueString) {
		return defaultValue;
	} else {
		return StringUtils.getTrimmedStrings(valueString);
	}
}
 
Example 11
Source File: Dispatcher.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Parse a comma separated string to obtain set of host names
 * 
 * @return set of host names
 */
static Set<String> parseHostList(String string) {
  String[] addrs = StringUtils.getTrimmedStrings(string);
  return new HashSet<String>(Arrays.asList(addrs));
}
 
Example 12
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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 *
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s,
 *         or empty array.
 */
public String[] getTrimmedStrings(String name) {
	String valueString = get(name);
	return StringUtils.getTrimmedStrings(valueString);
}
 
Example 13
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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 * 
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s, 
 *         or empty array. 
 */
public String[] getTrimmedStrings(String name) {
  String valueString = get(name);
  return StringUtils.getTrimmedStrings(valueString);
}
 
Example 14
Source File: Dispatcher.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Parse a comma separated string to obtain set of host names
 * 
 * @return set of host names
 */
static Set<String> parseHostList(String string) {
  String[] addrs = StringUtils.getTrimmedStrings(string);
  return new HashSet<String>(Arrays.asList(addrs));
}
 
Example 15
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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 *
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s,
 *         or empty array.
 */
public String[] getTrimmedStrings(String name) {
  String valueString = get(name);
  return StringUtils.getTrimmedStrings(valueString);
}
 
Example 16
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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 * 
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s, 
 *         or empty array. 
 */
public String[] getTrimmedStrings(String name) {
  String valueString = get(name);
  return StringUtils.getTrimmedStrings(valueString);
}
 
Example 17
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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 *
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s,
 *         or empty array.
 */
public String[] getTrimmedStrings(String name) {
  String valueString = get(name);
  return StringUtils.getTrimmedStrings(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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 *
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s,
 *         or empty array.
 */
public String[] getTrimmedStrings(String name) {
	String valueString = get(name);
	return StringUtils.getTrimmedStrings(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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 *
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s,
 *         or empty array.
 */
public String[] getTrimmedStrings(String name) {
	String valueString = get(name);
	return StringUtils.getTrimmedStrings(valueString);
}
 
Example 20
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, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 *
 * @param name property name.
 * @return property value as an array of trimmed <code>String</code>s,
 *         or empty array.
 */
public String[] getTrimmedStrings(String name) {
  String valueString = get(name);
  return StringUtils.getTrimmedStrings(valueString);
}