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:com.griddynamics.jagger.agent.impl.SigarSystemInfoCollector.java
public void setInterfaceNames(String commaSeparatedInterfaceNames) { this.interfaceNames = new HashSet<String>( Arrays.asList(StringUtils.split(commaSeparatedInterfaceNames, ", "))); }
From source file:com.pop.swagger.ExSpringSwaggerConfig.java
private Class<?>[] getFilterClasses() throws IOException, ClassNotFoundException { Properties prop = new Properties(); prop.load(this.getClass().getClassLoader().getResourceAsStream(SWAGGER_FILTER_CLASS_NAMES)); String cls = prop.getProperty("swagger.filter.classes"); String[] classNames = StringUtils.split(cls, "\\;"); if (classNames == null || classNames.length == 0) { return null; }// w w w . java 2 s . com List<Class<?>> classes = new ArrayList<Class<?>>(classNames.length); int len = 0; for (String clazz : classNames) { if (ClassUtils.isPresent(clazz, ExSpringSwaggerConfig.class.getClassLoader())) { classes.add(Class.forName(clazz)); len++; } } Class<?>[] clzs = new Class<?>[len]; for (int i = 0; i < len; i++) { clzs[i] = classes.get(i); } return clzs; }
From source file:info.magnolia.voting.voters.ExtensionVoter.java
public void setDeny(String deny) { this.deny = StringUtils.split(deny, ','); }
From source file:iddb.core.model.dao.DAOFactory.java
/** * @param key/*from w w w.ja va 2 s . co m*/ * @param value * @return * @throws Exception * @throws ClassNotFoundException * @throws IllegalAccessException * @throws InstantiationException */ @SuppressWarnings({ "rawtypes", "unchecked" }) private Object createCachedInstance(String iface, Object impl) throws Exception { String[] ifacePart = StringUtils.split(iface, "."); String ifaceName = ifacePart[ifacePart.length - 1]; log.debug("Getting cached instance for {} - {}", iface, ifaceName); ClassLoader loader = this.getClass().getClassLoader(); try { Class clz = loader.loadClass("iddb.core.model.dao.cached." + ifaceName + "Cached"); Constructor cons = clz.getConstructor(new Class[] { Class.forName(iface) }); return cons.newInstance(impl); } catch (SecurityException e) { log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage()); throw new Exception(e); } catch (IllegalArgumentException e) { log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage()); throw new Exception(e); } catch (ClassNotFoundException e) { log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage()); throw new Exception(e); } catch (NoSuchMethodException e) { log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage()); throw new Exception(e); } catch (InstantiationException e) { log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage()); throw new Exception(e); } catch (IllegalAccessException e) { log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage()); throw new Exception(e); } catch (InvocationTargetException e) { e.printStackTrace(); log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage()); throw new Exception(e); } }
From source file:com.hangum.tadpole.summary.report.DailySummaryReportJOB.java
@Override public void execute(JobExecutionContext arg0) throws JobExecutionException { logger.info("daily summary report"); try {//from ww w. j a v a 2 s . co m // db . List<UserDBDAO> listUserDB = TadpoleSystem_UserDBQuery.getDailySummaryReportDB(); // ? . for (UserDBDAO userDBDAO : listUserDB) { StringBuffer strMailContent = new StringBuffer(); // (14.06.02) mysql ? ? ?. if (PublicTadpoleDefine.YES_NO.YES.name().equals(userDBDAO.getIs_summary_report())) { if (userDBDAO.getDBDefine() == DBDefine.MYSQL_DEFAULT || userDBDAO.getDBDefine() == DBDefine.MARIADB_DEFAULT) { String strSummarySQl = MySQLSummaryReport.getSQL(userDBDAO.getDb()); String[] arrySQLS = StringUtils.split(strSummarySQl, ";"); for (String strSQL : arrySQLS) { String strTitle = StringUtils.split(StringUtils.trim(strSQL), PublicTadpoleDefine.LINE_SEPARATOR)[0]; String strResult = executSQL(userDBDAO, strTitle, strSQL); strMailContent.append(strResult); } DailySummaryReport report = new DailySummaryReport(); String mailContent = report.makeFullSummaryReport(userDBDAO.getDisplay_name(), strMailContent.toString()); // . Utils.sendEmail(userDBDAO.getUser_seq(), userDBDAO.getDisplay_name(), mailContent); if (logger.isDebugEnabled()) logger.debug(mailContent); } // end mysql db } // if yes } // for (UserDBDAO userDBDAO } catch (Exception e) { logger.error("daily summary report", e); } }
From source file:com.adobe.acs.commons.forms.impl.FormsRouterImpl.java
/** * Gets the Form Selector for the form POST request. * * @param slingRequest//from w w w . j a va2 s .c om * @return */ @Override public final String getFormSelector(final SlingHttpServletRequest slingRequest) { final String requestSuffix = slingRequest.getRequestPathInfo().getSuffix(); if (StringUtils.equals(requestSuffix, this.getSuffix()) || !StringUtils.startsWith(requestSuffix, this.getSuffix() + "/")) { return null; } final int segments = StringUtils.split(this.getSuffix(), '/').length; if (segments < 1) { return null; } final String formSelector = PathInfoUtil.getSuffixSegment(slingRequest, segments); return StringUtils.stripToNull(formSelector); }
From source file:com.dianping.lion.api.http.GetConfigServlet.java
protected void checkAccessibility(HttpServletRequest req) { String userIP = IPUtils.getUserIP(req); String whiteList = systemSettingService.getSetting(ServiceConstants.SETTING_GETCONFIG_WHITELIST); if (StringUtils.isBlank(whiteList)) { return;//from w w w . j a v a 2 s .c o m } if (whiteList.contains(userIP) || whiteList.contains("*.*.*.*")) { return; } String[] ipSegments = StringUtils.split(userIP, '.'); if (ipSegments.length == 4) { for (int i = 3; i >= 1; i--) { String left = StringUtils.join(ipSegments, '.', 0, i); String pattern = left + StringUtils.repeat(".*", 4 - i); if (whiteList.contains(pattern)) { return; } } } throw new RuntimeBusinessException("You have no privilege."); }
From source file:com.proper.uip.common.utils.Page.java
/** * ???./* w w w.j av a 2s .co m*/ * * @param order ?descasc,?','. */ public void setOrder(final String order) { String lowcaseOrder = StringUtils.lowerCase(order); //order? String[] orders = StringUtils.split(lowcaseOrder, ','); for (String orderStr : orders) { if (!StringUtils.equals(PageConfig.DESC, orderStr) && !StringUtils.equals(PageConfig.ASC, orderStr)) { throw new IllegalArgumentException("??" + orderStr + "??"); } } this.order = lowcaseOrder; }
From source file:com.alexholmes.hadooputils.sort.SortRecordReader.java
/** * Extract the key from the sort line, using the spupplied options. * * @param value the sort line// w ww .java 2 s. com * @param startKey the start key, or null if there isn't one * @param endKey the end key, or null if there isn't one * @param fieldSeparator the field separator, used if a start (and optionally end) key are set * @param ignoreCase whether the result should be lower-cased to ensure case is ignored * @return the key * @throws IOException if something goes wrong */ protected static Text extractKey(final Text value, final Integer startKey, final Integer endKey, final String fieldSeparator, final boolean ignoreCase) throws IOException { Text result = new Text(); if (startKey == null) { result.set(value); } else { // startKey is 1-based in the Linux sort, so decrement them to be 0-based // int startIdx = startKey - 1; String[] parts = StringUtils.split(value.toString(), fieldSeparator); if (startIdx >= parts.length) { throw new IOException("Start index is greater than parts in line"); } int endIdx = parts.length; if (endKey != null) { // endKey is also 1-based in the Linux sort, but the StringUtils.join // end index is exclusive, so no need to decrement // endIdx = endKey; if (endIdx > parts.length) { throw new IOException("End index is greater than parts in line"); } } result.set(StringUtils.join(parts, fieldSeparator, startIdx, endIdx)); } if (ignoreCase) { result.set(result.toString().toLowerCase()); } return result; }
From source file:dk.dma.ais.track.TargetFilter.java
public static Area getGeometry(String geometry) { String[] elems = StringUtils.split(geometry, ','); double[] numbers = new double[elems.length - 1]; for (int i = 1; i < elems.length; i++) { numbers[i - 1] = Double.parseDouble(elems[i]); }/* w ww . ja v a 2 s. c om*/ if (elems[0].equalsIgnoreCase("circle")) { return new Circle(numbers[0], numbers[1], numbers[2], CoordinateSystem.GEODETIC); } if (elems[0].equalsIgnoreCase("bb")) { Position pos1 = Position.create(numbers[0], numbers[1]); Position pos2 = Position.create(numbers[2], numbers[3]); return BoundingBox.create(pos1, pos2, CoordinateSystem.GEODETIC); } return null; }