List of usage examples for org.springframework.util StringUtils tokenizeToStringArray
public static String[] tokenizeToStringArray(@Nullable String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens)
From source file:io.dyn.net.protocol.LineProtocol.java
@Override public <V extends Evented<? super V>> LineProtocol decode(Buffer buffer, V evented) { String line = charsetEncoding.decode(buffer.byteBuffer()).toString(); if (null != remainder) { line = remainder + line;/* w ww . j a v a2 s. co m*/ remainder = null; } boolean endsWithLF = line.endsWith(newline); String[] parts = StringUtils.tokenizeToStringArray(line, newline, false, false); int len = parts.length; for (int i = 0; i < len; i++) { if (i == len - 1 && !endsWithLF) { remainder = parts[i]; } else { evented.event(eventName, parts[i].trim()); } } return this; }
From source file:com.seajas.search.bridge.jms.integration.GroupIdJmsHeaderMapper.java
/** * Set the exclusions.// www . ja v a 2s . c om * * @param exclusions */ @Value("${bridged.project.retrieval.excluded.hosts}") public void setExclusions(final String exclusions) { this.exclusions = Arrays.asList(StringUtils.tokenizeToStringArray(exclusions, ",", true, true)); }
From source file:com.seajas.search.contender.service.modifier.AbstractModifierService.java
/** * Default constructor./* w ww . ja va 2s .c om*/ * * @param maximumContentLength * @param preferredEnclosures */ public AbstractModifierService(final Long maximumContentLength, final String preferredEnclosures) { this.maximumContentLength = maximumContentLength; this.preferredEnclosures = Arrays .asList(StringUtils.tokenizeToStringArray(preferredEnclosures, ",", true, true)); }
From source file:com.seajas.search.contender.service.cache.CacheService.java
/** * Default constructor./*from www .ja va 2s . c o m*/ * * @param compositeKey */ @Autowired public CacheService(@Value("${contender.project.cache.unique.key.composition}") final String compositeKey) { this.compositeKey = Arrays.asList(StringUtils.tokenizeToStringArray(compositeKey, ",", true, true)); }
From source file:com.seajas.search.profiler.authentication.strategy.codex.CodexAuthenticationStrategy.java
/** * Default constructor./*from w w w.j a v a 2 s .c om*/ * * @param urlToProviderMappings */ @Autowired public CodexAuthenticationStrategy( @Value("${profiler.project.authentication.strategy.codex.url.to.provider.mapping}") final String urlToProviderMappings) { for (String urlToProviderMapping : StringUtils.tokenizeToStringArray(urlToProviderMappings, ",", true, true)) { String[] keyValue = urlToProviderMapping.split(":"); if (keyValue.length != 2 || !StringUtils.hasText(keyValue[0]) || !StringUtils.hasText(keyValue[1])) throw new IllegalArgumentException("Invalid URL-to-provider mapping '" + urlToProviderMapping + "' - should be of type <provider>:<pattern>"); this.urlToProviderMappings.put(keyValue[0].trim(), keyValue[1].trim()); } }
From source file:com.seajas.search.contender.http.ExclusiveConnectionManager.java
/** * Set the exclusions./*from w ww . j a v a 2s . com*/ * * @param exclusions */ public void setRouteExclusions(final String exclusions) { for (String exclusion : StringUtils.tokenizeToStringArray(exclusions, ",", true, true)) { setMaxPerRoute(new HttpRoute(new HttpHost(exclusion), null, false), getMaxTotal()); setMaxPerRoute(new HttpRoute(new HttpHost(exclusion), null, true), getMaxTotal()); } }
From source file:com.seajas.search.contender.service.ContenderService.java
/** * Default constructor.//from ww w . j a va2s . c om * * @param excludedHosts */ @Autowired public ContenderService(@Value("${bridged.project.retrieval.excluded.hosts}") final String excludedHosts) { this.excludedHosts = Arrays.asList(StringUtils.tokenizeToStringArray(excludedHosts, ",", true, true)); }
From source file:com.seajas.search.attender.service.search.SolrSearchService.java
/** * Default constructor.//w w w. ja v a2 s .c om * * @param url * @param shards * @param searchLanguages */ @Autowired public SolrSearchService(@Value("${attender.project.search.service.solr.url}") final String url, @Value("${attender.project.search.service.solr.shards}") final String shards, @Value("${attender.project.search.service.languages}") final String searchLanguages) { this.solrServer = new HttpSolrServer(url); ((HttpSolrServer) solrServer).setFollowRedirects(true); ((HttpSolrServer) solrServer).setAllowCompression(true); this.shards = Arrays.asList(StringUtils.tokenizeToStringArray(shards, ",", true, true)); this.searchLanguages = Arrays.asList(StringUtils.tokenizeToStringArray(searchLanguages, ",", true, true)); }
From source file:com.ryantenney.metrics.spring.reporter.LibratoReporterFactoryBean.java
@Override protected LibratoReporter createInstance() { final String username = getProperty(USERNAME); final String token = getProperty(TOKEN); final String source = getProperty(SOURCE); final LibratoReporter.Builder reporter = LibratoReporter.builder(getMetricRegistry(), username, token, source);/*from w ww .ja v a 2 s. co m*/ if (hasProperty(TIMEOUT)) { reporter.setTimeout(convertDurationString(getProperty(TIMEOUT)), TimeUnit.NANOSECONDS); } if (hasProperty(NAME)) { reporter.setName(getProperty(NAME)); } if (hasProperty(SANITIZER_REF)) { reporter.setSanitizer(getPropertyRef(SANITIZER_REF, Sanitizer.class)); } if (hasProperty(EXPANSION_CONFIG)) { String configString = getProperty(EXPANSION_CONFIG).trim().toUpperCase(Locale.ENGLISH); final MetricExpansionConfig config; if ("ALL".equals(configString)) { config = MetricExpansionConfig.ALL; } else { Set<ExpandedMetric> set = new HashSet<ExpandedMetric>(); String[] expandedMetricStrs = StringUtils.tokenizeToStringArray(configString, ",", true, true); for (String expandedMetricStr : expandedMetricStrs) { set.add(ExpandedMetric.valueOf(expandedMetricStr)); } config = new MetricExpansionConfig(set); } reporter.setExpansionConfig(config); } else if (hasProperty(EXPANSION_CONFIG_REF)) { reporter.setExpansionConfig(getProperty(EXPANSION_CONFIG, MetricExpansionConfig.class)); } if (hasProperty(HTTP_POSTER_REF)) { reporter.setHttpPoster(getPropertyRef(HTTP_POSTER_REF, HttpPoster.class)); } if (hasProperty(PREFIX)) { reporter.setPrefix(getProperty(PREFIX)); } if (hasProperty(PREFIX_DELIMITER)) { reporter.setPrefixDelimiter(getProperty(PREFIX_DELIMITER)); } if (hasProperty(DURATION_UNIT)) { reporter.setDurationUnit(getProperty(DURATION_UNIT, TimeUnit.class)); } if (hasProperty(RATE_UNIT)) { reporter.setRateUnit(getProperty(RATE_UNIT, TimeUnit.class)); } if (hasProperty(CLOCK_REF)) { reporter.setClock(getPropertyRef(CLOCK_REF, Clock.class)); } reporter.setFilter(getMetricFilter()); return reporter.build(); }
From source file:com.seajas.search.profiler.service.task.TaskService.java
/** * Default constructor.//w w w. j a va 2 s. c om */ @Autowired public TaskService(@Value("${profiler.project.feed.injection.triggers}") final String feedInjectionTriggers, @Value("${profiler.project.feed.injection.triggers.distributed}") final String feedInjectionTriggersDistributed, @Value("${profiler.project.archive.injection.triggers}") final String archiveInjectionTriggers, @Value("${profiler.project.archive.injection.triggers.distributed}") final String archiveInjectionTriggersDistributed, final Scheduler taskScheduler) { // Feed injection triggers injectTriggers(GROUP_FEED, feedInjectionTriggers, Arrays.asList(StringUtils.tokenizeToStringArray(feedInjectionTriggersDistributed, ",", true, true)), taskScheduler); // Archive injection triggers injectTriggers(GROUP_ARCHIVE, archiveInjectionTriggers, Arrays.asList( StringUtils.tokenizeToStringArray(archiveInjectionTriggersDistributed, ",", true, true)), taskScheduler); }