/** * Returns a collection of strings. * @param str comma separated string values * @return an <code>ArrayList</code> of string values */ public static Collection<String> getStringCollection(String str){ String delim = ","; return getStringCollection(str, delim); }
/** * Get the comma delimited values of the <code>name</code> property as * a collection of <code>String</code>s. * If no such property is specified then empty collection is returned. * <p> * This is an optimized version of {@link #getStrings(String)} * * @param name property name. * @return property value as a collection of <code>String</code>s. */ public Collection<String> getStringCollection(String name) { String valueString = get(name); return StringUtils.getStringCollection(valueString); }
/** * Get the comma delimited values of the <code>name</code> property as * a collection of <code>String</code>s. * If no such property is specified then empty collection is returned. * <p> * This is an optimized version of {@link #getStrings(String)} * * @param name property name. * @return property value as a collection of <code>String</code>s. */ public Collection<String> getStringCollection(String name) { String valueString = get(name); return StringUtils.getStringCollection(valueString); }
/** * Get the comma delimited values of the <code>name</code> property as * a collection of <code>String</code>s. * If no such property is specified then empty collection is returned. * <p> * This is an optimized version of {@link #getStrings(String)} * * @param name property name. * @return property value as a collection of <code>String</code>s. */ public Collection<String> getStringCollection(String name) { String valueString = get(name); return StringUtils.getStringCollection(valueString); }
/** * Returns an arraylist of strings. * @param str the string values * @param delim delimiter to separate the values * @return the arraylist of the separated string values */ public static String[] getStrings(String str, String delim){ Collection<String> values = getStringCollection(str, delim); if(values.size() == 0) { return null; } return values.toArray(new String[values.size()]); }
/** * From a string which columns names (including hive column), return a list * of string columns * * @param columns comma separated list of columns * @return list with virtual columns removed */ public static List<String> getColumnNames(final String columns) { return (List<String>) VirtualColumn. removeVirtualColumns(StringUtils.getStringCollection(columns)); }
/** * From a string which columns names (including hive column), return a list * of string columns * * @param columns comma separated list of columns * @return list with virtual columns removed */ public static List<String> getColumnNames(final String columns) { return (List<String>) VirtualColumn. removeVirtualColumns(StringUtils.getStringCollection(columns)); }
private void parseStaticMapping(Configuration conf) { String staticMapping = conf.get( CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES_DEFAULT); Collection<String> mappings = StringUtils.getStringCollection( staticMapping, ";"); Map<String, List<String>> staticUserToGroupsMap = new HashMap<String, List<String>>(); for (String users : mappings) { Collection<String> userToGroups = StringUtils.getStringCollection(users, "="); if (userToGroups.size() < 1 || userToGroups.size() > 2) { throw new HadoopIllegalArgumentException("Configuration " + CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES + " is invalid"); } String[] userToGroupsArray = userToGroups.toArray(new String[userToGroups .size()]); String user = userToGroupsArray[0]; List<String> groups = Collections.emptyList(); if (userToGroupsArray.length == 2) { groups = (List<String>) StringUtils .getStringCollection(userToGroupsArray[1]); } staticUserToGroupsMap.put(user, groups); } staticMapRef.set( staticUserToGroupsMap.isEmpty() ? null : staticUserToGroupsMap); }
/** * Parses a string representation of an ACL spec into a list of AclEntry * objects. Example: "user::rwx,user:foo:rw-,group::r--,other::---" * The expected format of ACL entries in the string parameter is the same * format produced by the {@link #toStringStable()} method. * * @param aclSpec * String representation of an ACL spec. * @param includePermission * for setAcl operations this will be true. i.e. AclSpec should * include permissions.<br> * But for removeAcl operation it will be false. i.e. AclSpec should * not contain permissions.<br> * Example: "user:foo,group:bar" * @return Returns list of {@link AclEntry} parsed */ public static List<AclEntry> parseAclSpec(String aclSpec, boolean includePermission) { List<AclEntry> aclEntries = new ArrayList<AclEntry>(); Collection<String> aclStrings = StringUtils.getStringCollection(aclSpec, ","); for (String aclStr : aclStrings) { AclEntry aclEntry = parseAclEntry(aclStr, includePermission); aclEntries.add(aclEntry); } return aclEntries; }
/** * Returns a collection of strings. * @param str comma seperated string values * @return an <code>ArrayList</code> of string values */ public static Collection<String> getStringCollection(String str){ String delim = ","; return getStringCollection(str, delim); }
/** * Returns a collection of strings. * @param str comma seperated string values * @return an <code>ArrayList</code> of string values */ public static Collection<String> getStringCollection(String str){ String delim = ","; return getStringCollection(str, delim); }
/** * Returns a collection of strings. * @param str comma seperated string values * @return an <code>ArrayList</code> of string values */ public static Collection<String> getStringCollection(String str) { String delim = ","; return getStringCollection(str, delim); }
/** * Split a classpath. This uses the local path separator so MUST NOT * be used to work with remote classpaths * @param localpath local path * @return a splite */ public Collection<String> splitClasspath(String localpath) { String separator = System.getProperty("path.separator"); return StringUtils.getStringCollection(localpath, separator); }
/** * {@inheritDoc} */ @Override public List<String> getColumns(final String columns) { final List<String> result = (List<String>) StringUtils.getStringCollection(columns); result.removeAll(virtualColumns); return result; }
/** * Returns an arraylist of strings. * @param str the comma seperated string values * @return the arraylist of the comma seperated string values */ public static String[] getStrings(String str){ Collection<String> values = getStringCollection(str); if(values.size() == 0) { return null; } return values.toArray(new String[values.size()]); }
/** * Returns an arraylist of strings. * @param str the comma seperated string values * @return the arraylist of the comma seperated string values */ public static String[] getStrings(String str){ Collection<String> values = getStringCollection(str); if(values.size() == 0) { return null; } return values.toArray(new String[values.size()]); }
/** * Returns an arraylist of strings. * @param str the comma seperated string values * @return the arraylist of the comma seperated string values */ public static String[] getStrings(String str){ Collection<String> values = getStringCollection(str); if(values.size() == 0) { return null; } return values.toArray(new String[values.size()]); }
/** * Returns an arraylist of strings. * @param str the comma seperated string values * @return the arraylist of the comma seperated string values */ public static String[] getStrings(String str){ Collection<String> values = getStringCollection(str); if(values.size() == 0) { return null; } return values.toArray(new String[values.size()]); }
/** * From a string which columns names (including hive column), return a list * of string columns * * @param columns comma separated list of columns * @return list with virtual columns removed */ private static List<String> getColumnNames(final String columns) { return (List<String>) VirtualColumn. removeVirtualColumns(StringUtils.getStringCollection(columns)); }
private void retrieveAvailableZoneList() throws IOException { if (availableZoneIDs != null){ return; } Properties props = UDFContext.getUDFContext().getUDFProperties(PigImplConstants.PIG_DATETIME_ZONES_LIST.getClass()); Collection<String> zoneList = StringUtils.getStringCollection(props.getProperty(PigImplConstants.PIG_DATETIME_ZONES_LIST)); if (zoneList == null || zoneList.size() == 0){ throw new IOException("Datetime zone information not set"); } availableZoneIDs = new ArrayList<>(zoneList); }