List of usage examples for org.springframework.util StringUtils tokenizeToStringArray
public static String[] tokenizeToStringArray(@Nullable String str, String delimiters)
From source file:com.comstar.mars.env.EnvMapperScannerConfigurer.java
/** * {@inheritDoc}/*from w w w . ja va 2 s . c om*/ * * @since 1.0.2 */ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { if (this.processPropertyPlaceHolders) { processPropertyPlaceHolders(); } EnvClassPathMapperScanner scanner = new EnvClassPathMapperScanner(registry); scanner.setAnnotationClass(this.annotationClass); scanner.setMarkerInterface(this.markerInterface); scanner.setSqlSessionFactory(this.sqlSessionFactory); scanner.setSqlSessionTemplate(this.sqlSessionTemplate); scanner.setSqlSessionFactoryBeanName(this.sqlSessionFactoryBeanName); scanner.setSqlSessionTemplateBeanName(this.sqlSessionTemplateBeanName); scanner.setResourceLoader(this.applicationContext); scanner.setBeanNameGenerator(this.nameGenerator); scanner.registerFilters(); scanner.scan(StringUtils.tokenizeToStringArray(this.basePackage, ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS)); }
From source file:org.mybatis.spring.mapper.MapperScannerConfigurer.java
/** * {@inheritDoc}/*from w w w . ja v a2 s .com*/ * * @since 1.0.2 */ @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { if (this.processPropertyPlaceHolders) { processPropertyPlaceHolders(); } ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); scanner.setAddToConfig(this.addToConfig); scanner.setAnnotationClass(this.annotationClass); scanner.setMarkerInterface(this.markerInterface); scanner.setSqlSessionFactory(this.sqlSessionFactory); scanner.setSqlSessionTemplate(this.sqlSessionTemplate); scanner.setSqlSessionFactoryBeanName(this.sqlSessionFactoryBeanName); scanner.setSqlSessionTemplateBeanName(this.sqlSessionTemplateBeanName); scanner.setResourceLoader(this.applicationContext); scanner.setBeanNameGenerator(this.nameGenerator); scanner.registerFilters(); scanner.scan(StringUtils.tokenizeToStringArray(this.basePackage, ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS)); }
From source file:iplatform.admin.ui.server.auth.ad.ActiveDirectoryLdapAuthenticationProvider.java
private String rootDnFromDomain(String domain) { String[] tokens = StringUtils.tokenizeToStringArray(domain, "."); StringBuilder root = new StringBuilder(); for (String token : tokens) { if (root.length() > 0) { root.append(','); }//from w w w . j a v a 2 s.c o m root.append("dc=").append(token); } return root.toString(); }
From source file:org.zenoss.zep.index.impl.lucene.LuceneQueryBuilder.java
private void buildIpAddressSubstringFilters(List<Filter> filters, String fieldName, Set<String> values) throws ZepException { if (values == null || values.isEmpty()) return;//from w ww.j ava 2s .com for (String val : values) { if (val.indexOf('.') >= 0) { BooleanFilter bq = new BooleanFilter(); bq.add(filterCache.get(TERMS, new Term(fieldName + IndexConstants.IP_ADDRESS_TYPE_SUFFIX, IndexConstants.IP_ADDRESS_TYPE_4)), BooleanClause.Occur.MUST); String[] tokens = StringUtils.tokenizeToStringArray(val, "."); if (tokens.length > 0) { bq.add(new QueryWrapperFilter(createIpAddressMultiPhraseQuery(fieldName, reader, tokens)), BooleanClause.Occur.MUST); } else { bq.add(filterCache.get(TERMS, new Term(fieldName, val)), BooleanClause.Occur.MUST); } filters.add(bq); } else if (val.indexOf(':') >= 0) { BooleanFilter bq = new BooleanFilter(); bq.add(filterCache.get(TERMS, new Term(fieldName + IndexConstants.IP_ADDRESS_TYPE_SUFFIX, IndexConstants.IP_ADDRESS_TYPE_6)), BooleanClause.Occur.MUST); String[] tokens = StringUtils.tokenizeToStringArray(val, ":"); if (tokens.length > 0) { bq.add(new QueryWrapperFilter(createIpAddressMultiPhraseQuery(fieldName, reader, tokens)), BooleanClause.Occur.MUST); } else { bq.add(filterCache.get(TERMS, new Term(fieldName, val)), BooleanClause.Occur.MUST); } filters.add(bq); } else { filters.add( new QueryWrapperFilter(new WildcardQuery(new Term(fieldName, removeLeadingZeros(val))))); } } }
From source file:org.jasig.springframework.web.portlet.context.PortletContextLoader.java
/** * Return the {@link ApplicationContextInitializer} implementation classes to use * if any have been specified by {@link #CONTEXT_INITIALIZER_CLASSES_PARAM}. * @param portletContext current portlet context * @see #CONTEXT_INITIALIZER_CLASSES_PARAM *//*from w ww .j a v a 2s .c om*/ @SuppressWarnings("unchecked") protected List<Class<ApplicationContextInitializer<ConfigurableApplicationContext>>> determineContextInitializerClasses( PortletContext portletContext) { String classNames = portletContext.getInitParameter(CONTEXT_INITIALIZER_CLASSES_PARAM); List<Class<ApplicationContextInitializer<ConfigurableApplicationContext>>> classes = new ArrayList<Class<ApplicationContextInitializer<ConfigurableApplicationContext>>>(); if (classNames != null) { for (String className : StringUtils.tokenizeToStringArray(classNames, ",")) { try { Class<?> clazz = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader()); Assert.isAssignable(ApplicationContextInitializer.class, clazz, "class [" + className + "] must implement ApplicationContextInitializer"); classes.add((Class<ApplicationContextInitializer<ConfigurableApplicationContext>>) clazz); } catch (ClassNotFoundException ex) { throw new ApplicationContextException( "Failed to load context initializer class [" + className + "]", ex); } } } return classes; }
From source file:jails.http.MediaType.java
/** * Parse the given String into a single {@link MediaType}. * @param mediaType the string to parse/* w w w. j av a2 s . com*/ * @return the media type * @throws IllegalArgumentException if the string cannot be parsed */ public static MediaType parseMediaType(String mediaType) { Assert.hasLength(mediaType, "'mediaType' must not be empty"); String[] parts = StringUtils.tokenizeToStringArray(mediaType, ";"); String fullType = parts[0].trim(); // java.net.HttpURLConnection returns a *; q=.2 Accept header if (WILDCARD_TYPE.equals(fullType)) { fullType = "*/*"; } int subIndex = fullType.indexOf('/'); if (subIndex == -1) { throw new IllegalArgumentException("\"" + mediaType + "\" does not contain '/'"); } if (subIndex == fullType.length() - 1) { throw new IllegalArgumentException("\"" + mediaType + "\" does not contain subtype after '/'"); } String type = fullType.substring(0, subIndex); String subtype = fullType.substring(subIndex + 1, fullType.length()); Map<String, String> parameters = null; if (parts.length > 1) { parameters = new LinkedHashMap<String, String>(parts.length - 1); for (int i = 1; i < parts.length; i++) { String parameter = parts[i]; int eqIndex = parameter.indexOf('='); if (eqIndex != -1) { String attribute = parameter.substring(0, eqIndex); String value = parameter.substring(eqIndex + 1, parameter.length()); parameters.put(attribute, value); } } } return new MediaType(type, subtype, parameters); }
From source file:com.dhcc.framework.web.context.DhccContextLoader.java
/** * Return the {@link ApplicationContextInitializer} implementation classes to use * if any have been specified by {@link #CONTEXT_INITIALIZER_CLASSES_PARAM}. * @param servletContext current servlet context * @see #CONTEXT_INITIALIZER_CLASSES_PARAM *//*from ww w .j av a2 s. c om*/ @SuppressWarnings("unchecked") protected List<Class<ApplicationContextInitializer<ConfigurableApplicationContext>>> determineContextInitializerClasses( ServletContext servletContext) { String classNames = servletContext.getInitParameter(CONTEXT_INITIALIZER_CLASSES_PARAM); List<Class<ApplicationContextInitializer<ConfigurableApplicationContext>>> classes = new ArrayList<Class<ApplicationContextInitializer<ConfigurableApplicationContext>>>(); if (classNames != null) { for (String className : StringUtils.tokenizeToStringArray(classNames, ",")) { try { Class<?> clazz = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader()); Assert.isAssignable(ApplicationContextInitializer.class, clazz, "class [" + className + "] must implement ApplicationContextInitializer"); classes.add((Class<ApplicationContextInitializer<ConfigurableApplicationContext>>) clazz); } catch (ClassNotFoundException ex) { throw new ApplicationContextException( "Failed to load context initializer class [" + className + "]", ex); } } } return classes; }
From source file:org.broadleafcommerce.common.extensibility.jpa.convert.inheritance.SingleTableInheritanceClassTransformer.java
@Override public void compileJPAProperties(Properties props, Object key) throws Exception { if (((String) key).equals(SINGLE_TABLE_ENTITIES)) { String[] classes = StringUtils.tokenizeToStringArray(props.getProperty((String) key), ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS); for (String clazz : classes) { String keyName;//from ww w .j av a 2 s . c om int pos = clazz.lastIndexOf("."); if (pos >= 0) { keyName = clazz.substring(pos + 1, clazz.length()); } else { keyName = clazz; } SingleTableInheritanceInfo info = new SingleTableInheritanceInfo(); info.setClassName(clazz); String discriminatorName = props.getProperty("broadleaf.ejb." + keyName + ".discriminator.name"); if (discriminatorName != null) { info.setDiscriminatorName(discriminatorName); String type = props.getProperty("broadleaf.ejb." + keyName + ".discriminator.type"); if (type != null) { info.setDiscriminatorType(DiscriminatorType.valueOf(type)); } String length = props.getProperty("broadleaf.ejb." + keyName + ".discriminator.length"); if (length != null) { info.setDiscriminatorLength(Integer.parseInt(length)); } } infos.remove(info); infos.add(info); } } }