private void execute(SchemaToolTask task, String taskArgs) throws HiveMetaException { try { StrTokenizer tokenizer = new StrTokenizer(argsBase + taskArgs, ' ', '\"'); SchemaToolCommandLine cl = new SchemaToolCommandLine(tokenizer.getTokenArray(), null); task.setCommandLineArguments(cl); } catch (Exception e) { throw new IllegalStateException("Could not parse comman line \n" + argsBase + taskArgs, e); } task.setHiveSchemaTool(schemaTool); task.execute(); } }
public static String[] matchStringArray(String text) { StrTokenizer strTokenizer = StrTokenizer.getCSVInstance(text); return strTokenizer.getTokenArray(); }
public static String[] matchStringArray(String text) { StrTokenizer strTokenizer = StrTokenizer.getCSVInstance(text); return strTokenizer.getTokenArray(); }
protected List<XmlFile> extractXmlFiles(String config) throws IOException { List<XmlFile> xmlFiles = new ArrayList<>(); StrTokenizer tokenizer = new StrTokenizer(config); for (String fileName : tokenizer.getTokenArray()) { xmlFiles.add(new XmlFile(fileName, readXml(fileName))); } return xmlFiles; }
@Override public String getContextConfigLocation() { String configProperty = AppContext.getProperty(SPRING_CONTEXT_CONFIG); if (StringUtils.isBlank(configProperty)) { throw new IllegalStateException("Missing " + SPRING_CONTEXT_CONFIG + " application property"); } File baseDir = new File(AppContext.getProperty("cuba.confDir")); StrTokenizer tokenizer = new StrTokenizer(configProperty); String[] tokenArray = tokenizer.getTokenArray(); StringBuilder locations = new StringBuilder(); for (String token : tokenArray) { String location; if (ResourceUtils.isUrl(token)) { location = token; } else { if (token.startsWith("/")) token = token.substring(1); File file = new File(baseDir, token); if (file.exists()) { location = file.toURI().toString(); } else { location = "classpath:" + token; } } locations.append(location).append(" "); } return locations.toString(); }
/** * Returns an array of a param values, given its key and the values delimiter * Values can be decoded or not * * @param key the param key * @param delimiter the values delimiter * @param decode whether to decode values * @return the list of vaalues */ public String[] getValues(String key, String delimiter, boolean decode) { String value = params.get(key); if (value != null) { if (decode) { value = decode(value); } return new StrTokenizer(value, delimiter).setIgnoreEmptyTokens(false).getTokenArray(); } return EMPTY; }
/** * Converts a String back to connection parameters. * @param input String from configuration * @return JDBC connection parameters */ public static Properties propertiesFromString(String input) { if (input != null && !input.isEmpty()) { Properties result = new Properties(); StrTokenizer propertyTokenizer = StrTokenizer.getCSVInstance(input); StrTokenizer valueTokenizer = StrTokenizer.getCSVInstance(); valueTokenizer.setDelimiterChar('='); while (propertyTokenizer.hasNext()) { valueTokenizer.reset(propertyTokenizer.nextToken()); String[] values = valueTokenizer.getTokenArray(); if (values.length == 2) { result.put(values[0], values[1]); } } return result; } else { return null; } } public boolean isDirect(){
_tokenizer.reset(rawEventRecordStr); final String[] rawEventFields = _tokenizer.getTokenArray(); final String[] header = csvHelper.getHeader();
public List<String> split(String input) { List<String> statements = new ArrayList<String>(); StrBuilder currentSql = new StrBuilder(); StrTokenizer lineTokenizer = new StrTokenizer(input); lineTokenizer.setDelimiterMatcher(StrMatcher.charSetMatcher("\r\n")); for (String line : lineTokenizer.getTokenArray()) { String strippedLine = StringUtils.stripEnd(line, null); if (!currentSql.isEmpty()) { currentSql.append(lineEnding.get()); } currentSql.append(strippedLine); if (delimiterType.matches(strippedLine, delimiter)) { statements.add(currentSql.substring(0, currentSql.length() - delimiter.length())); currentSql.clear(); } } if (!currentSql.isEmpty()) { statements.add(currentSql.toString()); } return statements; }
String[] tokenizedLine = StrTokenizer.getCSVInstance(line).getTokenArray(); if (evalMatrix == null) { evalMatrix = new String[FileUtils.readLines(eval).size()][tokenizedLine.length];
String[] tokenizedLine = StrTokenizer.getCSVInstance(line).getTokenArray(); if (evalMatrix == null) { evalMatrix = new String[FileUtils.readLines(eval).size()][tokenizedLine.length];
String[] dataFields = tokenizer.getTokenArray(); processFields(fields, dataFields);