List of usage examples for org.apache.commons.lang3 StringUtils lowerCase
public static String lowerCase(final String str)
Converts a String to lower case as per String#toLowerCase() .
A null input String returns null .
StringUtils.lowerCase(null) = null StringUtils.lowerCase("") = "" StringUtils.lowerCase("aBc") = "abc"
Note: As described in the documentation for String#toLowerCase() , the result of this method is affected by the current locale.
From source file:com.ottogroup.bi.asap.component.operator.executor.OperatorExecutor.java
/** * Unsubscribes the referenced subscriber from operator * @param subscriberId// w w w . j av a2 s . c o m * @throws RequiredInputMissingException */ public void unsubscribe(final String subscriberId) throws RequiredInputMissingException { /////////////////////////////////////////////////////////////////////////// // validate input if (StringUtils.isBlank(subscriberId)) throw new RequiredInputMissingException("Missing required subscriber identifier"); // /////////////////////////////////////////////////////////////////////////// this.subscriberMailboxes.remove(StringUtils.trim(StringUtils.lowerCase(subscriberId))); }
From source file:com.ottogroup.bi.asap.resman.pipeline.PipelineManager.java
/** * Shuts down the pipeline on all processing node it has been deployed to * @param pipelineId// ww w.ja v a 2s . c o m * @return * @throws RequiredInputMissingException * @throws UnknownPipelineException */ public PipelineDeploymentProfile shutdownPipeline(final String pipelineId) throws RequiredInputMissingException, UnknownPipelineException { /////////////////////////////////////////////////////////// // validate input if (StringUtils.isBlank(pipelineId)) throw new RequiredInputMissingException("Missing required pipeline identifier"); String pid = StringUtils.lowerCase(StringUtils.trim(pipelineId)); if (!this.pipelineDeployments.containsKey(pid)) throw new UnknownPipelineException("Unknown pipeline '" + pipelineId + "'"); // /////////////////////////////////////////////////////////// final PipelineDeploymentProfile profile = this.pipelineDeployments.remove(pid); return this.processingNodeManager.shutdownPipeline(profile); }
From source file:com.ottogroup.bi.spqr.pipeline.MicroPipelineManager.java
/** * Instantiates and executes the {@link MicroPipeline} described by the given {@link MicroPipelineConfiguration} * @param configuration/*from w ww . ja v a2 s .c om*/ * @throws RequiredInputMissingException * @throws QueueInitializationFailedException * @throws ComponentInitializationFailedException * @throws PipelineInstantiationFailedException */ public String executePipeline(final MicroPipelineConfiguration configuration) throws RequiredInputMissingException, QueueInitializationFailedException, ComponentInitializationFailedException, PipelineInstantiationFailedException, NonUniqueIdentifierException { /////////////////////////////////////////////////////////// // validate input if (configuration == null) throw new RequiredInputMissingException("Missing required pipeline configuration"); // /////////////////////////////////////////////////////////// String id = StringUtils.lowerCase(StringUtils.trim(configuration.getId())); if (this.pipelines.containsKey(id)) throw new NonUniqueIdentifierException("A pipeline already exists for id '" + id + "'"); MicroPipeline pipeline = this.microPipelineFactory.instantiatePipeline(configuration, this.executorService); if (pipeline != null) this.pipelines.put(id, pipeline); else throw new PipelineInstantiationFailedException("Failed to instantiate pipeline '" + configuration.getId() + "'. Reason: null returned by pipeline factory"); if (logger.isDebugEnabled()) logger.debug("pipeline registered[id=" + configuration.getId() + "]"); return id; }
From source file:ke.co.tawi.babblesms.server.servlet.upload.UploadUtil.java
protected void saveContacts(File contactFile, Account account, ContactDAO contactDAO, PhoneDAO phoneDAO, List<String> groupUuids, ContactGroupDAO contactGroupDAO) { LineIterator lineIterator = null;//from w w w .j av a 2 s . c om Contact contact; Phone phone; List<Group> groupList = new LinkedList<>(); Group grp; for (String uuid : groupUuids) { grp = new Group(); grp.setUuid(uuid); groupList.add(grp); } try { lineIterator = FileUtils.lineIterator(contactFile, "UTF-8"); String line; String[] rowTokens, phoneTokens, networkTokens; while (lineIterator.hasNext()) { line = lineIterator.nextLine(); rowTokens = StringUtils.split(line, ','); // Extract the Contact and save contact = new Contact(); contact.setAccountUuid(account.getUuid()); contact.setName(rowTokens[0]); contact.setStatusUuid(Status.ACTIVE); contactDAO.putContact(contact); // Extract the phones and save phoneTokens = StringUtils.split(rowTokens[1], ';'); networkTokens = StringUtils.split(rowTokens[2], ';'); String network; for (int j = 0; j < phoneTokens.length; j++) { phone = new Phone(); phone.setPhonenumber(StringUtils.trimToEmpty(phoneTokens[j])); phone.setPhonenumber(StringUtils.remove(phone.getPhonenumber(), ' ')); phone.setContactUuid(contact.getUuid()); phone.setStatusuuid(Status.ACTIVE); network = StringUtils.lowerCase(StringUtils.trimToEmpty(networkTokens[j])); phone.setNetworkuuid(networkUuidArray[networkList.indexOf(network)]); phoneDAO.putPhone(phone); } // Associate the Contact to the Groups for (Group group : groupList) { contactGroupDAO.putContact(contact, group); } } // end 'while (lineIterator.hasNext())' } catch (IOException e) { logger.error("IOException when storing: " + contactFile); logger.error(e); } finally { if (lineIterator != null) { lineIterator.close(); } } }
From source file:com.xpn.xwiki.plugin.lucene.AttachmentData.java
private String getContentAsText(XWikiDocument doc, XWikiContext context) { String contentText = null;//w w w. j a v a 2 s . c om try { XWikiAttachment att = doc.getAttachment(this.filename); LOGGER.debug("Start parsing attachement [{}] in document [{}]", this.filename, doc.getDocumentReference()); Tika tika = new Tika(); Metadata metadata = new Metadata(); metadata.set(Metadata.RESOURCE_NAME_KEY, this.filename); contentText = StringUtils.lowerCase(tika.parseToString(att.getContentInputStream(context), metadata)); } catch (Throwable ex) { LOGGER.warn("error getting content of attachment [{}] for document [{}]", new Object[] { this.filename, doc.getDocumentReference(), ex }); } return contentText; }
From source file:com.threewks.thundr.http.service.gae.HttpResponseImpl.java
private Map<String, List<String>> buildHeadersLowerMap(Map<String, List<String>> headers) { Map<String, List<String>> lowercase = new LinkedHashMap<String, List<String>>(); for (Map.Entry<String, List<String>> entry : headers.entrySet()) { lowercase.put(StringUtils.lowerCase(entry.getKey()), new ArrayList<>(entry.getValue())); }/*from w ww . j a v a 2s . co m*/ return lowercase; }
From source file:com.ottogroup.bi.spqr.metrics.MetricsHandler.java
/** * {@link JmxReporter#stop() Stops} the referenced {@link JmxReporter} and removes it from map * of managed jmx reporters//w w w . j ava 2 s. co m * @param id */ public void removeJmxReporter(final String id) { String key = StringUtils.lowerCase(StringUtils.trim(id)); JmxReporter jmxReporter = this.jmxReporters.get(key); if (jmxReporter != null) { jmxReporter.stop(); this.jmxReporters.remove(key); } }
From source file:com.ottogroup.bi.asap.operator.json.aggregator.JsonContentAggregatorResult.java
/** * Evaluates the referenced aggregated value against the provided value and saves the smaller one * @param field//from w w w .ja va 2 s .c om * @param fieldValue * @param value * @throws RequiredInputMissingException */ public void evalMinAggregatedValue(final String field, final String fieldValue, final long value) throws RequiredInputMissingException { /////////////////////////////////////////////////////////////////////////////////////////// // validate provided input if (StringUtils.isBlank(field)) throw new RequiredInputMissingException("Missing required input for parameter 'field'"); if (StringUtils.isBlank(fieldValue)) throw new RequiredInputMissingException("Missing required input for parameter 'fieldValue'"); // /////////////////////////////////////////////////////////////////////////////////////////// String fieldKey = StringUtils.lowerCase(StringUtils.trim(field)); String fieldValueKey = StringUtils.lowerCase(StringUtils.trim(fieldValue)); Map<String, Long> fieldAggregationValues = this.aggregatedValues.get(fieldKey); if (fieldAggregationValues == null) fieldAggregationValues = new HashMap<>(); long aggregationValue = (fieldAggregationValues.containsKey(fieldValueKey) ? fieldAggregationValues.get(fieldValueKey) : Integer.MAX_VALUE); if (value < aggregationValue) { fieldAggregationValues.put(fieldValueKey, value); this.aggregatedValues.put(fieldKey, fieldAggregationValues); } }
From source file:com.ottogroup.bi.spqr.pipeline.component.operator.DelayedResponseOperatorRuntimeEnvironment.java
/** * Initializes the runtime environment using the provided input * @param processingNodeId// w w w. ja v a2 s . c om * @param pipelineId * @param delayedResponseOperator * @param responseWaitStrategy * @param queueConsumer * @param queueProducer * @param executorService * @throws RequiredInputMissingException */ public DelayedResponseOperatorRuntimeEnvironment(final String processingNodeId, final String pipelineId, final DelayedResponseOperator delayedResponseOperator, final DelayedResponseOperatorWaitStrategy responseWaitStrategy, final StreamingMessageQueueConsumer queueConsumer, final StreamingMessageQueueProducer queueProducer, final ExecutorService executorService) throws RequiredInputMissingException { ///////////////////////////////////////////////////////////// // input validation if (StringUtils.isBlank(processingNodeId)) throw new RequiredInputMissingException("Missing required processing node identifier"); if (StringUtils.isBlank(pipelineId)) throw new RequiredInputMissingException("Missing required pipeline identifier"); if (delayedResponseOperator == null) throw new RequiredInputMissingException("Missing required direct delayed operator"); if (responseWaitStrategy == null) throw new RequiredInputMissingException("Missing required response wait strategy"); if (queueConsumer == null) throw new RequiredInputMissingException("Missing required queue consumer"); if (queueProducer == null) throw new RequiredInputMissingException("Missing required queue producer"); // ///////////////////////////////////////////////////////////// this.processingNodeId = StringUtils.lowerCase(StringUtils.trim(processingNodeId)); this.pipelineId = StringUtils.lowerCase(StringUtils.trim(pipelineId)); this.operatorId = StringUtils.lowerCase(StringUtils.trim(delayedResponseOperator.getId())); this.delayedResponseOperator = delayedResponseOperator; this.responseWaitStrategy = responseWaitStrategy; this.responseWaitStrategy.setDelayedResponseCollector(this); this.delayedResponseOperator.setWaitStrategy(this.responseWaitStrategy); this.queueConsumer = queueConsumer; this.queueProducer = queueProducer; this.executorService = executorService; this.executorService.submit(this.responseWaitStrategy); this.running = true; this.consumerQueueWaitStrategy = queueConsumer.getWaitStrategy(); this.destinationQueueWaitStrategy = queueProducer.getWaitStrategy(); if (logger.isDebugEnabled()) logger.debug("delayed response operator init [node=" + this.processingNodeId + ", pipeline=" + this.pipelineId + ", operator=" + this.operatorId + "]"); }
From source file:com.ottogroup.bi.spqr.resman.node.SPQRNodeManager.java
/** * Returns true in case the reference node is registered with this manager instance * @param nodeId//from w ww .ja va2 s . co m * @return */ public boolean hasNode(final String nodeId) { return this.processingNodes.containsKey(StringUtils.lowerCase(StringUtils.trim(nodeId))); }