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.spqr.pipeline.component.operator.DirectResponseOperatorRuntimeEnvironment.java
/** * Initializes the operator runtime environment using the provided input * @param processingNodeId//from www .ja v a 2 s . co m * @param pipelineId * @param directResponseOperator * @param queueConsumer * @param queueProducer */ public DirectResponseOperatorRuntimeEnvironment(final String processingNodeId, final String pipelineId, final DirectResponseOperator directResponseOperator, final StreamingMessageQueueConsumer queueConsumer, final StreamingMessageQueueProducer queueProducer) 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 (directResponseOperator == null) throw new RequiredInputMissingException("Missing required direct response operator"); 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(directResponseOperator.getId())); this.directResponseOperator = directResponseOperator; this.queueConsumer = queueConsumer; this.queueProducer = queueProducer; this.running = true; this.consumerQueueWaitStrategy = queueConsumer.getWaitStrategy(); this.destinationQueueWaitStrategy = queueProducer.getWaitStrategy(); if (logger.isDebugEnabled()) logger.debug("direct response operator init [node=" + this.processingNodeId + ", pipeline=" + this.pipelineId + ", operator=" + this.operatorId + "]"); }
From source file:com.sonicle.webtop.core.app.auth.WebTopDirectory.java
@Override public String sanitizeUsername(DirectoryOptions opts, String username) { WebTopConfigBuilder builder = getConfigBuilder(); return builder.getIsCaseSensitive(opts) ? username : StringUtils.lowerCase(username); }
From source file:io.wcm.handler.richtext.impl.RichTextRewriteContentHandlerImpl.java
/** * Checks if the given element has to be rewritten. * Is called for every child single element of the parent given to rewriteContent method. * @param element Element to check//ww w .j a v a 2 s . co m * @return null if nothing is to do with this element. * Return empty list to remove this element. * Return list with other content to replace element with new content. */ @Override public List<Content> rewriteElement(Element element) { // rewrite anchor elements if (StringUtils.equalsIgnoreCase(element.getName(), "a")) { return rewriteAnchor(element); } // rewrite image elements else if (StringUtils.equalsIgnoreCase(element.getName(), "img")) { return rewriteImage(element); } // detect BR elements and turn those into "self-closing" elements // since the otherwise generated <br> </br> structures are illegal and // are not handled correctly by Internet Explorers else if (StringUtils.equalsIgnoreCase(element.getName(), "br")) { if (element.getContent().size() > 0) { element.removeContent(); } return null; } // detect empty elements and insert at least an empty string to avoid "self-closing" elements // that are not handled correctly by most browsers else if (NONSELFCLOSING_TAGS.contains(StringUtils.lowerCase(element.getName()))) { if (element.getContent().isEmpty()) { element.setText(""); } return null; } return null; }
From source file:com.ottogroup.bi.asap.resman.pipeline.PipelineManager.java
/** * Updates or instantiates the provided pipeline on a set of processing nodes * @param pipelineConfiguration// www . j a v a 2 s. c om * @return * @throws RequiredInputMissingException * @throws RemoteClientConnectionFailedException * @throws IOException */ public PipelineDeploymentProfile updatesOrInstantiatePipeline( final MicroPipelineConfiguration pipelineConfiguration) throws RequiredInputMissingException, PipelineAlreadyRegisteredException { /////////////////////////////////////////////////////////// // validate input if (pipelineConfiguration == null) throw new RequiredInputMissingException("Missing required pipeline configuration"); // TODO validate pipeline configuration // /////////////////////////////////////////////////////////// String pid = StringUtils.lowerCase(StringUtils.trim(pipelineConfiguration.getId())); PipelineDeploymentProfile profile = this.pipelineDeployments.get(pid); if (profile != null) { profile.getProcessingNodes().clear(); profile.setConfiguration(pipelineConfiguration); } else { profile = new PipelineDeploymentProfile(pipelineConfiguration.getId(), pipelineConfiguration); } profile = processingNodeManager.updateOrInstantiatePipeline( new PipelineDeploymentProfile(pipelineConfiguration.getId(), pipelineConfiguration)); this.pipelineDeployments.put(StringUtils.lowerCase(StringUtils.trim(pipelineConfiguration.getId())), profile); return profile; }
From source file:com.ottogroup.bi.asap.operator.json.aggregator.JsonContentAggregatorResult.java
/** * Increment aggregated value by provided <i>inc</i> value * @param field//from w w w . j ava2 s .c o m * @param fieldValue * @param inc * @throws RequiredInputMissingException */ public void incAggregatedValue(final String field, final String fieldValue, final long inc) 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) : 0); aggregationValue = aggregationValue + inc; fieldAggregationValues.put(fieldValueKey, aggregationValue); this.aggregatedValues.put(fieldKey, fieldAggregationValues); }
From source file:com.ottogroup.bi.asap.component.source.executor.SourceExecutor.java
/** * Adds the provided {@link Mailbox} as receiver of all {@link StreamingDataMessage} items received by the * underlying {@link Source}. The given identifier references the linked mailbox. * @param adaptorId/*from w w w . j a v a 2 s . co m*/ * @param messageSubscriber */ public void subscribe(final String subscriberId, final Mailbox subscriberMailbox) throws RequiredInputMissingException { /////////////////////////////////////////////////////////////////////////// // validate input if (StringUtils.isBlank(subscriberId)) throw new RequiredInputMissingException("Missing required subscriber identifier"); if (subscriberMailbox == null) throw new RequiredInputMissingException("Missing required subscriber mailbox"); // /////////////////////////////////////////////////////////////////////////// this.subscriberMailboxes.put(StringUtils.trim(StringUtils.lowerCase(subscriberId)), subscriberMailbox); if (logger.isDebugEnabled()) logger.debug("subscribe[publisher=" + source.getId() + ", subscriber=" + subscriberId + ", mailbox=" + subscriberMailbox + "]"); }
From source file:com.sonicle.webtop.core.sdk.ServiceManifest.java
public ServiceManifest(HierarchicalConfiguration svcEl) throws Exception { String pkg = svcEl.getString("package"); if (StringUtils.isEmpty(pkg)) throw new Exception("Invalid value for property [package]"); javaPackage = StringUtils.lowerCase(pkg); id = javaPackage;//from w ww. ja v a2 s .c om String jspkg = svcEl.getString("jsPackage"); if (StringUtils.isEmpty(jspkg)) throw new Exception("Invalid value for property [jsPackage]"); jsPackage = jspkg; // Lowercase allowed! String sname = svcEl.getString("shortName"); if (StringUtils.isEmpty(sname)) throw new Exception("Invalid value for property [shortName]"); xid = sname; ServiceVersion ver = new ServiceVersion(svcEl.getString("version")); if (ver.isUndefined()) throw new Exception("Invalid value for property [version]"); version = ver; buildDate = StringUtils.defaultIfBlank(svcEl.getString("buildDate"), null); buildType = StringUtils.defaultIfBlank(svcEl.getString("buildType"), BUILD_TYPE_DEV); company = StringUtils.defaultIfBlank(svcEl.getString("company"), null); companyEmail = StringUtils.defaultIfBlank(svcEl.getString("companyEmail"), null); companyWebSite = StringUtils.defaultIfBlank(svcEl.getString("companyWebSite"), null); supportEmail = StringUtils.defaultIfBlank(svcEl.getString("supportEmail"), null); List<HierarchicalConfiguration> hconf = null; hconf = svcEl.configurationsAt("controller"); if (!hconf.isEmpty()) { //if (hconf.size() != 1) throw new Exception(invalidCardinalityEx("controller", "1")); if (hconf.size() > 1) throw new Exception(invalidCardinalityEx("controller", "*1")); final String cn = hconf.get(0).getString("[@className]"); if (StringUtils.isBlank(cn)) throw new Exception(invalidAttributeValueEx("controller", "className")); controllerClassName = buildJavaClassName(javaPackage, cn); } else { // Old-style configuration if (svcEl.containsKey("controllerClassName")) { controllerClassName = LangUtils.buildClassName(javaPackage, StringUtils.defaultIfEmpty(svcEl.getString("controllerClassName"), "Controller")); } } hconf = svcEl.configurationsAt("manager"); if (!hconf.isEmpty()) { if (!hconf.isEmpty()) { if (hconf.size() > 1) throw new Exception(invalidCardinalityEx("manager", "*1")); final String cn = hconf.get(0).getString("[@className]"); if (StringUtils.isBlank(cn)) throw new Exception(invalidAttributeValueEx("manager", "className")); managerClassName = buildJavaClassName(javaPackage, cn); } } else { // Old-style configuration if (svcEl.containsKey("managerClassName")) { managerClassName = LangUtils.buildClassName(javaPackage, StringUtils.defaultIfEmpty(svcEl.getString("managerClassName"), "Manager")); } } /* hconf = svcEl.configurationsAt("privateService"); if (!hconf.isEmpty()) { if (!hconf.isEmpty()) { if (hconf.size() > 1) throw new Exception(invalidCardinalityEx("manager", "*1")); final String cn = hconf.get(0).getString("[@className]"); if (StringUtils.isBlank(cn)) throw new Exception(invalidAttributeValueEx("privateService", "className")); final String jcn = hconf.get(0).getString("[@jsClassName]"); if (StringUtils.isBlank(jcn)) throw new Exception(invalidAttributeValueEx("privateService", "jsClassName")); privateServiceClassName = LangUtils.buildClassName(javaPackage, cn); privateServiceJsClassName = jcn; privateServiceVarsModelJsClassName = hconf.get(0).getString("[@jsClassName]"); } } else { // Old-style configuration if (svcEl.containsKey("serviceClassName")) { String cn = StringUtils.defaultIfEmpty(svcEl.getString("serviceClassName"), "Service"); privateServiceClassName = LangUtils.buildClassName(javaPackage, cn); privateServiceJsClassName = StringUtils.defaultIfEmpty(svcEl.getString("serviceJsClassName"), cn); privateServiceVarsModelJsClassName = StringUtils.defaultIfEmpty(svcEl.getString("serviceVarsModelJsClassName"), "model.ServiceVars"); } } */ if (svcEl.containsKey("serviceClassName")) { String cn = StringUtils.defaultIfEmpty(svcEl.getString("serviceClassName"), "Service"); privateServiceClassName = LangUtils.buildClassName(javaPackage, cn); privateServiceJsClassName = StringUtils.defaultIfEmpty(svcEl.getString("serviceJsClassName"), cn); privateServiceVarsModelJsClassName = StringUtils .defaultIfEmpty(svcEl.getString("serviceVarsModelJsClassName"), "model.ServiceVars"); } if (svcEl.containsKey("publicServiceClassName")) { String cn = StringUtils.defaultIfEmpty(svcEl.getString("publicServiceClassName"), "PublicService"); publicServiceClassName = LangUtils.buildClassName(javaPackage, StringUtils.defaultIfEmpty(svcEl.getString("publicServiceClassName"), "PublicService")); publicServiceJsClassName = StringUtils.defaultIfEmpty(svcEl.getString("publicServiceJsClassName"), cn); publicServiceVarsModelJsClassName = StringUtils.defaultIfEmpty( svcEl.getString("publicServiceVarsModelJsClassName"), "model.PublicServiceVars"); } hconf = svcEl.configurationsAt("jobService"); if (!hconf.isEmpty()) { if (hconf.size() > 1) throw new Exception(invalidCardinalityEx("jobService", "*1")); final String cn = hconf.get(0).getString("[@className]"); if (StringUtils.isBlank(cn)) throw new Exception(invalidAttributeValueEx("jobService", "className")); jobServiceClassName = LangUtils.buildClassName(javaPackage, cn); } else { // Old-style configuration if (svcEl.containsKey("jobServiceClassName")) { jobServiceClassName = LangUtils.buildClassName(javaPackage, StringUtils.defaultIfEmpty(svcEl.getString("jobServiceClassName"), "JobService")); } } if (!svcEl.configurationsAt("userOptions").isEmpty()) { userOptionsServiceClassName = LangUtils.buildClassName(javaPackage, StringUtils .defaultIfEmpty(svcEl.getString("userOptions.serviceClassName"), "UserOptionsService")); userOptionsViewJsClassName = StringUtils.defaultIfEmpty(svcEl.getString("userOptions.viewJsClassName"), "view.UserOptions"); userOptionsModelJsClassName = StringUtils .defaultIfEmpty(svcEl.getString("userOptions.modelJsClassName"), "model.UserOptions"); } hidden = svcEl.getBoolean("hidden", false); hconf = svcEl.configurationsAt("restApiEndpoint"); if (!hconf.isEmpty()) { for (HierarchicalConfiguration el : hconf) { final String name = el.getString("[@name]"); if (StringUtils.isBlank(name)) throw new Exception(invalidAttributeValueEx("restApiEndpoint", "name")); final String path = el.getString("[@path]", ""); if (restApiEndpoints.containsKey(path)) throw new Exception(invalidAttributeValueEx("restApiEndpoint", "path")); restApiEndpoints.put(path, new RestApiEndpoint(buildJavaClassName(javaPackage, name), path)); } } if (!svcEl.configurationsAt("restApis").isEmpty()) { List<HierarchicalConfiguration> restApiEls = svcEl.configurationsAt("restApis.restApi"); for (HierarchicalConfiguration el : restApiEls) { final String oasFile = el.getString("[@oasFile]"); if (StringUtils.isBlank(oasFile)) throw new Exception(invalidAttributeValueEx("restApis.restApi", "oasFile")); final String context = oasFileToContext(oasFile); final String implPackage = el.getString("[@package]", "." + JAVAPKG_REST + "." + context); if (restApis.containsKey(oasFile)) throw new Exception(invalidAttributeValueEx("restApis.restApi", "oasFile")); //String oasFilePath = LangUtils.packageToPath(buildJavaPackage(javaPackage, "." + JAVAPKG_REST)) + "/" + oasFile; String oasFilePath = LangUtils.packageToPath(javaPackage) + "/" + oasFile; restApis.put(oasFile, new RestApi(oasFilePath, context, buildJavaPackage(javaPackage, implPackage))); } } if (!svcEl.configurationsAt("permissions").isEmpty()) { List<HierarchicalConfiguration> elPerms = svcEl.configurationsAt("permissions.permission"); for (HierarchicalConfiguration elPerm : elPerms) { if (elPerm.containsKey("[@group]")) { String groupName = elPerm.getString("[@group]"); if (StringUtils.isEmpty(groupName)) throw new Exception("Permission must have a valid uppercase group name"); if (elPerm.containsKey("[@actions]")) { String[] actions = StringUtils.split(elPerm.getString("[@actions]"), ","); if (actions.length == 0) throw new Exception("Resource must declare at least 1 action"); permissions.add(new ServicePermission(groupName, actions)); } else { throw new Exception("Permission must declare actions supported on group"); } } } List<HierarchicalConfiguration> elShPerms = svcEl.configurationsAt("permissions.sharePermission"); for (HierarchicalConfiguration elShPerm : elShPerms) { if (elShPerm.containsKey("[@group]")) { String groupName = elShPerm.getString("[@group]"); if (StringUtils.isEmpty(groupName)) throw new Exception("Permission must have a valid uppercase group name"); permissions.add(new ServiceSharePermission(groupName)); } } } if (!svcEl.configurationsAt("portlets").isEmpty()) { List<HierarchicalConfiguration> elPortlets = svcEl.configurationsAt("portlets.portlet"); for (HierarchicalConfiguration el : elPortlets) { if (el.containsKey("[@jsClassName]")) { final String jsClassName = el.getString("[@jsClassName]"); if (StringUtils.isBlank(jsClassName)) throw new Exception("Invalid value for attribute [portlet->jsClassName]"); portlets.add(new Portlet(LangUtils.buildClassName(jsPackage, jsClassName))); } } } }
From source file:com.ottogroup.bi.spqr.pipeline.MicroPipelineManager.java
/** * Initializes the micro pipeline manager - <b>used for testing purpose only</b> * @param processingNodeId identifier of node this manager lives on * @param factory/* w w w . ja v a2 s . com*/ * @param executorService * @throws RequiredInputMissingException */ protected MicroPipelineManager(final String processingNodeId, final MicroPipelineFactory factory, final ExecutorService executorService) throws RequiredInputMissingException { ////////////////////////////////////////////////////////////////////////////// // validate provided input if (factory == null) throw new RequiredInputMissingException("Missing required component repository"); if (executorService == null) throw new RequiredInputMissingException("Missing required executor service"); if (StringUtils.isBlank(processingNodeId)) throw new RequiredInputMissingException("Missing required processing node identifier"); // ////////////////////////////////////////////////////////////////////////////// this.processingNodeId = StringUtils.lowerCase(StringUtils.trim(processingNodeId)); this.microPipelineFactory = factory; this.executorService = executorService; }
From source file:com.ottogroup.bi.asap.component.operator.executor.OperatorExecutor.java
/** * Subscribes the referenced component//from w ww . j av a 2s. c om * @param subscriberId * @param subscriberMailbox */ public void subscribe(final String subscriberId, final Mailbox subscriberMailbox) throws RequiredInputMissingException { /////////////////////////////////////////////////////////////////////////// // validate input if (StringUtils.isBlank(subscriberId)) throw new RequiredInputMissingException("Missing required subscriber identifier"); if (subscriberMailbox == null) throw new RequiredInputMissingException("Missing required subscriber mailbox"); // /////////////////////////////////////////////////////////////////////////// this.subscriberMailboxes.put(StringUtils.trim(StringUtils.lowerCase(subscriberId)), subscriberMailbox); if (logger.isDebugEnabled()) logger.debug("subscribe[publisher=" + operator.getId() + ", subscriber=" + subscriberId + ", mailbox=" + subscriberMailbox + "]"); }
From source file:com.ottogroup.bi.asap.pipeline.MicroPipelineManager.java
/** * Creates and registers a {@link Pipeline} for the given {@link PipelineConfiguration} * @param pipelineConfiguration//from w w w. j a v a2s .co m * @throws PipelineAlreadyRegisteredException * @throws RequiredInputMissingException * @throws ComponentInstantiationFailedException * @throws UnknownComponentException * @throws IllegalComponentSubscriptionException * @throws ComponentAlreadySubmittedException */ public String instantiatePipeline(final MicroPipelineConfiguration pipelineConfiguration) throws PipelineAlreadyRegisteredException, RequiredInputMissingException, UnknownComponentException, ComponentInstantiationFailedException, ComponentAlreadySubmittedException, IllegalComponentSubscriptionException { ////////////////////////////////////////////////////////////// // validate input if (pipelineConfiguration == null) throw new RequiredInputMissingException("Missing required pipeline configuration"); if (StringUtils.isBlank(pipelineConfiguration.getId())) throw new RequiredInputMissingException("Missing required pipeline identifier"); String pipelineId = StringUtils.lowerCase(StringUtils.trim(pipelineConfiguration.getId())); if (this.microPipelines.containsKey(pipelineId)) throw new PipelineAlreadyRegisteredException("A pipeline already exists for that identifer"); // ////////////////////////////////////////////////////////////// MicroPipeline pipeline = factory.instantiate(pipelineConfiguration, pipelineThreadPool); this.microPipelines.put(pipelineId, pipeline); if (logger.isDebugEnabled()) logger.debug("Pipeline '" + pipelineId + "' successfully instantiated and submitted to thread pool"); return pipelineConfiguration.getId(); }