List of usage examples for org.apache.commons.lang StringUtils split
public static String[] split(String str, String separatorChars)
Splits the provided text into an array, separators specified.
From source file:acromusashi.stream.ml.anomaly.lof.LofPointCreator.java
/** * {@inheritDoc}// w ww .j av a 2 s . co m */ @Override public void execute(TridentTuple tuple, TridentCollector collector) { String receivedStr = tuple.getString(0); String[] splitedStr = StringUtils.split(receivedStr, this.delimeter); int dataNum = splitedStr.length; double[] points = new double[splitedStr.length]; try { for (int index = 0; index < dataNum; index++) { points[index] = Double.parseDouble(splitedStr[index].trim()); } LofPoint result = new LofPoint(); result.setDataId(UUID.randomUUID().toString()); result.setDataPoint(points); result.setJudgeDate(new Date(getCurrentTime())); collector.emit(new Values(result)); } catch (Exception ex) { logger.warn("Received data is invalid. skip this data. ReceivedData=" + receivedStr, ex); } }
From source file:com.dianping.lion.util.UrlUtils.java
public static List<String> getParameterNames(String url) { if (url == null) { throw new NullPointerException("Param[url] cannot be null."); }/*w w w.j ava 2 s .c o m*/ List<String> parameterNames = new ArrayList<String>(); String queryString = StringUtils.substringAfter(url, "?"); if (queryString != null) { String[] segments = StringUtils.split(queryString, "&"); for (String segment : segments) { String param = StringUtils.substringBefore(segment, "="); if (!parameterNames.contains(param)) { parameterNames.add(param); } } } return parameterNames; }
From source file:com.alibaba.otter.manager.web.home.module.action.AutoKeeperClusterAction.java
public void doAdd(@FormGroup("autokeeperClusterInfo") Group autokeeperClusterInfo, @FormField(name = "formAutokeeperClusterError", group = "autokeeperClusterInfo") CustomErrors err, Navigator nav) throws Exception { AutoKeeperCluster autoKeeperCluster = new AutoKeeperCluster(); autokeeperClusterInfo.setProperties(autoKeeperCluster); String zkClustersString = autokeeperClusterInfo.getField("zookeeperClusters").getStringValue(); String[] zkClusters = StringUtils.split(zkClustersString, ";"); autoKeeperCluster.setServerList(Arrays.asList(zkClusters)); try {/* w w w . j a v a 2 s .c o m*/ autoKeeperClusterService.createAutoKeeperCluster(autoKeeperCluster); } catch (RepeatConfigureException rce) { err.setMessage("invalidNode"); return; } nav.redirectTo(WebConstant.AUTO_KEEPER_CLUSTERS_LINK); }
From source file:com.spleefleague.core.command.BasicCommand.java
public BasicCommand(CorePlugin plugin, String name, String usage, Rank requiredRank, Rank... additionalRanks) { this.plugin = plugin; this.name = name; this.requiredRank = requiredRank; this.additionalRanks = Sets.newHashSet(additionalRanks); usage = usage.replaceAll(Pattern.quote("<command>"), name); this.usages = StringUtils.split(usage, "\n"); plugin.getCommand(name).setExecutor(this); }
From source file:br.com.bluesoft.guardian.faker.Internet.java
/** * Generates a random image url based on the lorempixel service. All the images provided by this service are released * under the creative commons license (CC BY-SA). For more information, please visit: http://lorempixel.com/ * * @return an url to a random image.//from w w w . j ava 2 s .co m * @see <a href="http://lorempixel.com/">lorempixel - Placeholder Images for every case</a> */ public String image() { String[] dimension = StringUtils.split(fakeValuesService.fetchString("internet.image_dimension"), 'x'); if (dimension.length == 0) return ""; return image(Integer.valueOf(StringUtils.trim(dimension[0])), Integer.valueOf(StringUtils.trim(dimension[1])), randomService.nextBoolean(), null); }
From source file:gov.nih.nci.eagle.util.EAGLEListLoader.java
public static UserListBean loadDefaultLists(UserListBean userListBean, HttpSession session) throws OperationNotSupportedException { ListManager listManager = new ListManager(); // use RBT stuff for testing // this is obviously testing stuff // String oligos = "E09264,E09358,E09448,E09503,E09661,E09664,E09690,E09804,E09811,E09860,E09867,E09885,E09893,HF0087,HF0251,HF0285,HF0291,HF0327,HF0329,HF0332,HF0434,HF0453,HF0471,HF0488,HF0510,HF0599,HF0615,HF0639,HF0670,HF0726,HF0749,HF0813,HF0816,HF0822,HF0828,HF0831,HF0835,HF0897,HF0899,HF0914,HF0920,HF0931,HF0960,HF0962,HF0966,HF0975,HF1136,HF1150,HF1156,HF1167,HF1185,HF1219,HF1227,HF1235,HF1264,HF1325,HF1334,HF1345,HF1348,HF1380,HF1381,HF1433,HF1489,HF1493,HF1502,HF1551,HF1553,HF1606,HF1613,HF1677,MD508984"; // String astros = "E09137,E09176,E09214,E09262,E09334,E09362,E09394,E09408,E09471,E09542,E09673,E09743,E09759,E09800,E09801,E09818,E09826,E09848,E09900,E09922,E09923,E09945,HF0017,HF0026,HF0108,HF0152,HF0189,HF0223,HF0450,HF0491,HF0608,HF0757,HF0778,HF0953,HF1000,HF1032,HF1114,HF1139,HF1232,HF1246,HF1269,HF1295,HF1316,HF1344,HF1366,HF1398,HF1407,HF1442,HF1463,HF1469,HF1487,HF1511,HF1568,HF1581,HF1587,HF1708,MD547038,MD554082"; //first 5+ astros are not in rbinary // String oligos = "IGC-10-1107,IGC-08-1053,IGC-02-1067,IGC-02-1059"; // String astros = "IGC-10-1051,IGC-12-1077,IGC-09-1090,IGC-03-1007"; // String ftest = "IGC-08-1094,IGC-09-1085,IGC-13-1106,IGC-04-1113"; ReadablePropertyPlaceholder propBean = (ReadablePropertyPlaceholder) SpringContext.getBean("patientLists"); Properties props = propBean.getProps(); for (Object listName : props.keySet()) { if (listName.toString().indexOf("data.") != -1) continue; List<String> sampleList = new ArrayList<String>(); String samples = props.getProperty(listName.toString()); sampleList = Arrays.asList(StringUtils.split(samples, ",")); EAGLEListValidator listValidator = new EAGLEListValidator(ListType.PatientDID, sampleList); UserList mySampleList = listManager.createList(ListType.PatientDID, listName.toString(), sampleList, listValidator);/* www . j ava2 s . co m*/ mySampleList.setListOrigin(ListOrigin.Default); userListBean.addList(mySampleList); } // List<String> oligoSamplesList = new ArrayList<String>(); // oligoSamplesList = Arrays.asList( StringUtils.split(oligos, ",") ); // // // EAGLEListValidator listValidator = new EAGLEListValidator(ListType.PatientDID, ListSubType.Default, oligoSamplesList); // UserList myOligoSampleList = listManager.createList(ListType.PatientDID,"testOligo",oligoSamplesList,listValidator); // myOligoSampleList.setListSubType(ListSubType.Default); // userListBean.addList(myOligoSampleList); // // List<String> astroSamplesList = new ArrayList<String>(); // astroSamplesList = Arrays.asList( StringUtils.split(astros, ",") ); // // listValidator = new EAGLEListValidator(ListType.PatientDID, ListSubType.Default, astroSamplesList); // UserList myAstroSampleList = listManager.createList(ListType.PatientDID,"testAstro",astroSamplesList,listValidator); // myAstroSampleList.setListSubType(ListSubType.Default); // userListBean.addList(myAstroSampleList); // // List<String> ftestList = new ArrayList<String>(); // ftestList = Arrays.asList( StringUtils.split(ftest, ",") ); // // listValidator = new EAGLEListValidator(ListType.PatientDID, ListSubType.Default, ftestList); // UserList ftestSampleList = listManager.createList(ListType.PatientDID,"ftest",ftestList,listValidator); // ftestSampleList.setListSubType(ListSubType.Default); // userListBean.addList(ftestSampleList); return userListBean; }
From source file:com.cyclopsgroup.tornado.portal.taglib.SecureControlTag.java
/** * Overwrite or implement method processTag() * * @see com.cyclopsgroup.waterview.utils.TagSupportBase#processTag(org.apache.commons.jelly.XMLOutput) *///from w ww . j av a2 s . c om protected void processTag(XMLOutput output) throws Exception { HtmlControlAsset asset = new HtmlControlAsset(getName()); RuntimeData data = getRuntimeData(); RuntimeUser user = RuntimeUser.getInstance(data); if (StringUtils.isNotEmpty(getName()) && !user.isAuthorized(asset)) { return; } if (StringUtils.isNotEmpty(getRole())) { String[] roles = StringUtils.split(getRole(), '|'); for (int i = 0; i < roles.length; i++) { String role = roles[i]; if (!user.hasRole(role)) { return; } } } invokeBody(output); }
From source file:com.exxeta.iss.sonar.msgflow.MessageFlowLanguage.java
/** * The method returns a list of file suffixes for the defined language. * /*from w w w .ja va 2s . com*/ * @return a list of file suffixes for the defined language */ @Override public String[] getFileSuffixes() { String[] suffixes = settings.getStringArray(MessageFlowPlugin.FILE_SUFFIXES_KEY); if (suffixes == null || suffixes.length == 0) { suffixes = StringUtils.split(MessageFlowPlugin.FILE_SUFFIXES_DEFAULTVALUE, ","); } LOG.debug(suffixes.toString()); return suffixes; }
From source file:com.qualogy.qafe.web.ContextLoaderHelper.java
public static Boolean loadOnStartup(String windowId, ApplicationContext context, SessionContainer sessionContainer) { boolean loadOnStartup = false; if (context != null && windowId != null) { // default behavior from the context if (ApplicationCluster.getInstance().getConfigurationItem(Configuration.LOAD_ON_STARTUP) != null) { String absoluteWindowId = context.getId() + "." + windowId; if (absoluteWindowId != null) { String[] loadOnStartupWindows = StringUtils.split( ApplicationCluster.getInstance().getConfigurationItem(Configuration.LOAD_ON_STARTUP), ","); if (loadOnStartupWindows != null) { for (int i = 0; i < loadOnStartupWindows.length && !loadOnStartup; i++) { if (absoluteWindowId.equals(loadOnStartupWindows[i])) { loadOnStartup = true; }//w ww. j a v a 2s . c o m } } } } // behavior from the paramater Map<String, String> parameters = sessionContainer.getParameters(); if (parameters != null) { if (parameters.containsKey(Configuration.LOAD_ON_STARTUP)) { String absoluteWindowId = context.getId() + "." + windowId; String window = parameters.get(Configuration.LOAD_ON_STARTUP); String[] loadOnStartupWindows = StringUtils.split(window, ","); if (window != null && window.length() > 0) { if (window.contains(".")) { for (int i = 0; i < loadOnStartupWindows.length && !loadOnStartup; i++) { if (absoluteWindowId.equals(loadOnStartupWindows[i])) { loadOnStartup = true; } } } else { if (context.getId().toString().equals(window)) { if (context.getApplicationMapping() != null && context.getApplicationMapping().getPresentationTier() != null && context.getApplicationMapping().getPresentationTier().getView() != null && context.getApplicationMapping().getPresentationTier().getView() .getWindows() != null) { List<Window> windows = context.getApplicationMapping().getPresentationTier() .getView().getWindows(); // The first window is always the authentication window, // so the size must be greater than 1 if (windows.size() > 1) { Window w = windows.get(1); if (w.getId().equals(windowId)) { loadOnStartup = true; } } } } } } } } } return loadOnStartup; }
From source file:com.shigengyu.hyperion.config.HyperionProperties.java
@PostConstruct private void parse() { workflowContextScanPackages = ImmutableList .copyOf(StringUtils.split(workflowContextScanPackageValue, SEPARATOR_CHARACTER)); workflowDefinitionScanPackages = ImmutableList .copyOf(StringUtils.split(workflowDefinitionScanPackageValue, SEPARATOR_CHARACTER)); workflowStateScanPackages = ImmutableList .copyOf(StringUtils.split(workflowStateScanPackageValue, SEPARATOR_CHARACTER)); printProperties();// w ww .jav a2s . c o m }