congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
StringUtils.getTrimmedStringCollection
Code IndexAdd Tabnine to your IDE (free)

How to use
getTrimmedStringCollection
method
in
org.apache.hadoop.util.StringUtils

Best Java code snippets using org.apache.hadoop.util.StringUtils.getTrimmedStringCollection (Showing top 20 results out of 315)

origin: org.apache.hadoop/hadoop-common

/**
 * 
 * @param hostEntries comma separated ip/cidr/host addresses
 */
public MachineList(String hostEntries) {
 this(StringUtils.getTrimmedStringCollection(hostEntries));
}
origin: apache/flink

/**
 * Get the comma delimited values of the <code>name</code> property as
 * a collection of <code>String</code>s, trimmed of the leading and trailing whitespace.
 * If no such property is specified then empty <code>Collection</code> is returned.
 *
 * @param name property name.
 * @return property value as a collection of <code>String</code>s, or empty <code>Collection</code>
 */
public Collection<String> getTrimmedStringCollection(String name) {
 String valueString = get(name);
 if (null == valueString) {
  Collection<String> empty = new ArrayList<String>();
  return empty;
 }
 return StringUtils.getTrimmedStringCollection(valueString);
}
origin: apache/flink

/**
 * Get the comma delimited values of the <code>name</code> property as
 * a collection of <code>String</code>s, trimmed of the leading and trailing whitespace.
 * If no such property is specified then empty <code>Collection</code> is returned.
 *
 * @param name property name.
 * @return property value as a collection of <code>String</code>s, or empty <code>Collection</code>
 */
public Collection<String> getTrimmedStringCollection(String name) {
  String valueString = get(name);
  if (null == valueString) {
    Collection<String> empty = new ArrayList<String>();
    return empty;
  }
  return StringUtils.getTrimmedStringCollection(valueString);
}
origin: apache/hbase

/**
 * Returns a list of strings from a comma-delimited configuration value.
 *
 * @param conf configuration to check
 * @param name configuration property name
 * @param defaultValue default value if no value found for name
 * @return list of strings from comma-delimited configuration value, or an
 *     empty list if not found
 */
private static List<String> getTrimmedStringList(Configuration conf,
 String name, String defaultValue) {
 String valueString = conf.get(name, defaultValue);
 if (valueString == null) {
  return new ArrayList<>();
 }
 return new ArrayList<>(StringUtils.getTrimmedStringCollection(valueString));
}
origin: org.apache.hadoop/hadoop-common

/** 
 * Get the comma delimited values of the <code>name</code> property as 
 * a collection of <code>String</code>s, trimmed of the leading and trailing whitespace.  
 * If no such property is specified then empty <code>Collection</code> is returned.
 *
 * @param name property name.
 * @return property value as a collection of <code>String</code>s, or empty <code>Collection</code> 
 */
public Collection<String> getTrimmedStringCollection(String name) {
 String valueString = get(name);
 if (null == valueString) {
  Collection<String> empty = new ArrayList<String>();
  return empty;
 }
 return StringUtils.getTrimmedStringCollection(valueString);
}

origin: org.apache.hadoop/hadoop-common

/**
 * Build ACL from the given two Strings.
 * The Strings contain comma separated values.
 *
 * @param aclString build ACL from array of Strings
 */
private void buildACL(String[] userGroupStrings) {
 users = new HashSet<String>();
 groups = new HashSet<String>();
 for (String aclPart : userGroupStrings) {
  if (aclPart != null && isWildCardACLValue(aclPart)) {
   allAllowed = true;
   break;
  }
 }
 if (!allAllowed) {      
  if (userGroupStrings.length >= 1 && userGroupStrings[0] != null) {
   users = StringUtils.getTrimmedStringCollection(userGroupStrings[0]);
  } 
  
  if (userGroupStrings.length == 2 && userGroupStrings[1] != null) {
   groups = StringUtils.getTrimmedStringCollection(userGroupStrings[1]);
   groupsMapping.cacheGroupsAdd(new LinkedList<String>(groups));
  }
 }
}

origin: apache/hive

org.apache.hadoop.util.StringUtils.getTrimmedStringCollection(userListStr));
org.apache.hadoop.util.StringUtils.getTrimmedStringCollection(groupListStr));
origin: org.apache.hadoop/hadoop-hdfs

/**
 * Parse configuration setting dfs.namenode.protected.directories to retrieve
 * the set of protected directories.
 *
 * @param protectedDirsString
 *          a comma separated String representing a bunch of paths.
 * @return a TreeSet
 */
@VisibleForTesting
static SortedSet<String> parseProtectedDirectories(
  final String protectedDirsString) {
 return parseProtectedDirectories(StringUtils
   .getTrimmedStringCollection(protectedDirsString));
}
origin: org.apache.hadoop/hadoop-hdfs

private static void setRenameReservedMapInternal(String renameReserved) {
 Collection<String> pairs =
   StringUtils.getTrimmedStringCollection(renameReserved);
 for (String p : pairs) {
  String[] pair = StringUtils.split(p, '/', '=');
  Preconditions.checkArgument(pair.length == 2,
    "Could not parse key-value pair " + p);
  String key = pair[0];
  String value = pair[1];
  Preconditions.checkArgument(DFSUtil.isReservedPathComponent(key),
    "Unknown reserved path " + key);
  Preconditions.checkArgument(DFSUtil.isValidNameForComponent(value),
    "Invalid rename path for " + key + ": " + value);
  LOG.info("Will rename reserved path " + key + " to " + value);
  renameReservedMap.put(key, value);
 }
}
origin: org.apache.hadoop/hadoop-hdfs

if (excludeDatanodes != null) {
 for (String host : StringUtils
   .getTrimmedStringCollection(excludeDatanodes)) {
  int idx = host.indexOf(":");
  if (idx != -1) {          
origin: ch.cern.hadoop/hadoop-common

/**
 * 
 * @param hostEntries comma separated ip/cidr/host addresses
 */
public MachineList(String hostEntries) {
 this(StringUtils.getTrimmedStringCollection(hostEntries));
}
origin: io.prestosql.hadoop/hadoop-apache

/**
 * 
 * @param hostEntries comma separated ip/cidr/host addresses
 */
public MachineList(String hostEntries) {
 this(StringUtils.getTrimmedStringCollection(hostEntries));
}
origin: io.hops/hadoop-common

/**
 * 
 * @param hostEntries comma separated ip/cidr/host addresses
 */
public MachineList(String hostEntries) {
 this(StringUtils.getTrimmedStringCollection(hostEntries));
}
origin: com.github.jiayuhan-it/hadoop-common

/**
 * 
 * @param hostEntries comma separated ip/cidr/host addresses
 */
public MachineList(String hostEntries) {
 this(StringUtils.getTrimmedStringCollection(hostEntries));
}
origin: platonai/pulsar

/**
 * Get the comma delimited values of property as
 * a collection of <code>String</code>s, trimmed of the leading and trailing whitespace.
 * If no such property is specified then empty <code>Collection</code> is returned.
 *
 * @return property value as a collection of <code>String</code>s, or empty <code>Collection</code>
 */
public Collection<String> getTrimmedStringCollection() {
  if (null == value) {
    return Collections.emptyList();
  }
  return StringUtils.getTrimmedStringCollection(value);
}
origin: com.github.jiayuhan-it/hadoop-common

@Test 
public void testGetUniqueNonEmptyTrimmedStrings (){
 final String TO_SPLIT = ",foo, bar,baz,,blah,blah,bar,";
 Collection<String> col = StringUtils.getTrimmedStringCollection(TO_SPLIT);
 assertEquals(4, col.size());
 assertTrue(col.containsAll(Arrays.asList(new String[]{"foo","bar","baz","blah"})));
}
origin: ch.cern.hadoop/hadoop-common

@Test 
public void testGetUniqueNonEmptyTrimmedStrings (){
 final String TO_SPLIT = ",foo, bar,baz,,blah,blah,bar,";
 Collection<String> col = StringUtils.getTrimmedStringCollection(TO_SPLIT);
 assertEquals(4, col.size());
 assertTrue(col.containsAll(Arrays.asList(new String[]{"foo","bar","baz","blah"})));
}
origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testStaticIPHostNameList()throws UnknownHostException {
 //create MachineList with a list of of Hostnames
 InetAddress addressHost1 = InetAddress.getByName("1.2.3.1");
 InetAddress addressHost4 = InetAddress.getByName("1.2.3.4");
 MachineList.InetAddressFactory addressFactory = 
  Mockito.mock(MachineList.InetAddressFactory.class);
 Mockito.when(addressFactory.getByName("host1")).thenReturn(addressHost1);
 Mockito.when(addressFactory.getByName("host4")).thenReturn(addressHost4);
 MachineList ml = new MachineList(
   StringUtils.getTrimmedStringCollection(HOST_LIST), addressFactory);
 //test for inclusion with an known IP
 assertTrue(ml.includes("1.2.3.4"));
 //test for exclusion with an unknown IP
 assertFalse(ml.includes("1.2.3.5"));
}
origin: com.github.jiayuhan-it/hadoop-common

 @Test
 public void testGetCollection() {
  //create MachineList with a mix of ip addresses , hostnames and ip ranges
  MachineList ml = new MachineList(HOSTNAME_IP_CIDR_LIST);

  Collection<String> col = ml.getCollection();
  //test getCollectionton to return the full collection
  assertEquals(7,ml.getCollection().size());

  for (String item:StringUtils.getTrimmedStringCollection(HOSTNAME_IP_CIDR_LIST)) {
   assertTrue(col.contains(item));
  }
 }
}
origin: ch.cern.hadoop/hadoop-common

 @Test
 public void testGetCollection() {
  //create MachineList with a mix of ip addresses , hostnames and ip ranges
  MachineList ml = new MachineList(HOSTNAME_IP_CIDR_LIST);

  Collection<String> col = ml.getCollection();
  //test getCollectionton to return the full collection
  assertEquals(7,ml.getCollection().size());

  for (String item:StringUtils.getTrimmedStringCollection(HOSTNAME_IP_CIDR_LIST)) {
   assertTrue(col.contains(item));
  }
 }
}
org.apache.hadoop.utilStringUtilsgetTrimmedStringCollection

Javadoc

Splits a comma separated value String, trimming leading and trailing whitespace on each value. Duplicate and empty values are removed.

Popular methods of StringUtils

  • stringifyException
    Make a string representation of the exception.
  • join
    Concatenates strings, using a separator.
  • split
  • arrayToString
  • toLowerCase
    Converts all of the characters in this String to lower case with Locale.ENGLISH.
  • escapeString
  • startupShutdownMessage
    Print a log message for starting up and shutting down
  • getStrings
    Returns an arraylist of strings.
  • toUpperCase
    Converts all of the characters in this String to upper case with Locale.ENGLISH.
  • byteToHexString
    Given an array of bytes it will convert the bytes to a hex string representation of the bytes
  • formatTime
    Given the time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec.
  • unEscapeString
  • formatTime,
  • unEscapeString,
  • getStringCollection,
  • byteDesc,
  • formatPercent,
  • getTrimmedStrings,
  • equalsIgnoreCase,
  • format,
  • formatTimeDiff

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • String (java.lang)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now