Refine search
/** * Creates an aggregation repository using the provided {@link LevelDBFile}. * * @param repositoryName the repository name * @param levelDBFile the leveldb file to use as persistent store */ public LevelDBAggregationRepository(String repositoryName, LevelDBFile levelDBFile) { StringHelper.notEmpty(repositoryName, "repositoryName"); ObjectHelper.notNull(levelDBFile, "levelDBFile"); this.levelDBFile = levelDBFile; this.repositoryName = repositoryName; }
public void setPassword(String password) { // lookup password as either environment or JVM system property if (password.startsWith("sysenv:")) { password = System.getenv(StringHelper.after(password, "sysenv:")); } if (ObjectHelper.isNotEmpty(password) && password.startsWith("sys:")) { password = System.getProperty(StringHelper.after(password, "sys:")); } this.password = password; } }
public RestSwaggerEndpoint(final String uri, final String remaining, final RestSwaggerComponent component, final Map<String, Object> parameters) { super(notEmpty(uri, "uri"), notNull(component, "component")); this.parameters = parameters; assignedComponentName = before(uri, ":"); final URI componentSpecificationUri = component.getSpecificationUri(); specificationUri = before(remaining, "#", StringHelper::trimToNull).map(URI::create) .orElse(ofNullable(componentSpecificationUri).orElse(RestSwaggerComponent.DEFAULT_SPECIFICATION_URI)); operationId = ofNullable(after(remaining, "#")).orElse(remaining); setExchangePattern(ExchangePattern.InOut); }
private static String endpointPathSummaryError(CamelEndpointDetails detail) { String uri = detail.getEndpointUri(); String p = uri.contains("?") ? StringHelper.before(uri, "?") : uri; String path = StringHelper.after(p, ":"); return path + "\t" + "Sending to non existing " + detail.getEndpointComponentName() + " queue name"; }
private TriggerKey createTriggerKey(String uri, String remaining, QuartzEndpoint endpoint) throws Exception { // Parse uri for trigger name and group URI u = new URI(uri); String path = StringHelper.after(u.getPath(), "/"); String host = u.getHost(); // host can be null if the uri did contain invalid host characters such as an underscore if (host == null) { host = StringHelper.before(remaining, "/"); if (host == null) { host = remaining; } } // Trigger group can be optional, if so set it to this context's unique name String name; String group; if (ObjectHelper.isNotEmpty(path) && ObjectHelper.isNotEmpty(host)) { group = host; name = path; } else { String camelContextName = QuartzHelper.getQuartzContextName(getCamelContext()); group = camelContextName == null ? "Camel" : "Camel_" + camelContextName; name = host; } if (prefixJobNameWithEndpointId) { name = endpoint.getId() + "_" + name; } return new TriggerKey(name, group); }
relativeUrl = StringHelper.before(relativeUrl, "?"); if (ObjectHelper.isEmpty(relativeUrl)) { relativeUrl = null; + "HttpServletRequest instance, but was: " + ObjectHelper.className(exchange.getIn().getBody())); if (ObjectHelper.isNotEmpty(newUrl) && !newUrl.equals(url)) {
s = StringHelper.before(s, "?"); Iterator<?> it = ObjectHelper.createIterator(values); while (it.hasNext()) { Object extracted = it.next(); String query = StringHelper.after(request.getUri(), "?"); Map<String, Object> uriParameters = URISupport.parseQuery(query, false, true); String name = entry.getKey(); Object values = entry.getValue(); Iterator<?> it = ObjectHelper.createIterator(values); while (it.hasNext()) { Object extracted = it.next(); if (ObjectHelper.isNotEmpty(body)) { for (String param : body.split("&")) { String[] pair = param.split("=", 2);
@Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { final String serviceName = StringHelper.before(remaining, ":"); final String delegateUri = StringHelper.after(remaining, ":"); ObjectHelper.notNull(serviceName, "Service Name"); ObjectHelper.notNull(delegateUri, "Delegate URI");
@Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> params) throws Exception { // we are registering a regular endpoint String namespace = StringHelper.before(remaining, ":"); String delegateUri = StringHelper.after(remaining, ":"); if (ObjectHelper.isEmpty(namespace) || ObjectHelper.isEmpty(delegateUri)) { throw new IllegalArgumentException("Wrong uri syntax : master:namespace:uri, got " + remaining); } // we need to apply the params here if (params != null && params.size() > 0) { delegateUri = delegateUri + "?" + uri.substring(uri.indexOf('?') + 1); } return new MasterEndpoint( uri, this, getClusterService(), namespace, delegateUri ); }
@Override protected void doStart() throws Exception { super.doStart(); if (getEndpoint().getMessageChannel() == null) { String outputChannelName = getEndpoint().getDefaultChannel(); if (ObjectHelper.isEmpty(outputChannelName)) { outputChannelName = getEndpoint().getInputChannel(); } StringHelper.notEmpty(outputChannelName, "OutputChannelName", getEndpoint()); outputChannel = destinationResolver.resolveDestination(outputChannelName); } else { outputChannel = getEndpoint().getMessageChannel(); } if (outputChannel == null) { throw new IllegalArgumentException("Cannot resolve OutputChannel on " + getEndpoint()); } // if we do in-out we need to setup the input channel as well if (getEndpoint().isInOut()) { // we need to setup right inputChannel for further processing StringHelper.notEmpty(getEndpoint().getInputChannel(), "InputChannel", getEndpoint()); inputChannel = (DirectChannel)destinationResolver.resolveDestination(getEndpoint().getInputChannel()); if (inputChannel == null) { throw new IllegalArgumentException("Cannot resolve InputChannel on " + getEndpoint()); } } }
/** * The name of a file, created by the executable, that should be considered as its output. * If no outFile is set, the standard output (stdout) of the executable will be used instead. */ public void setOutFile(String outFile) { StringHelper.notEmpty(outFile, "outFile"); this.outFile = outFile; }
@Override public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition<?> definition, Processor target, Processor nextTarget) throws Exception { if (this.tracker == null) { return target; } if (definition instanceof PipelineDefinition) { final String id = definition.getId(); if (ObjectHelper.isEmpty(id)) { return target; } final String stepId = StringHelper.after(id, "step:"); if (ObjectHelper.isEmpty(stepId)) { return target; } return new EventProcessor(target); } return target; }
String getMetricsName(String remaining) { String name = StringHelper.after(remaining, ":"); return name == null ? remaining : name; }
} catch (Exception e) { UnsupportedEncodingException uee = ObjectHelper.getException(UnsupportedEncodingException.class, e); if (uee != null) { LOG.debug("Unsupported encoding detected: {}", uee.getMessage()); try { String contentType = message.getContentType(); String type = StringHelper.before(contentType, "charset="); if (type != null) {
private StringBuilder newFileName() { StringBuilder actualPath = new StringBuilder(hdfsPath); actualPath.append(StringHelper.sanitize(getEndpoint().getCamelContext().getUuidGenerator().generateUuid())); return actualPath; }
protected void appendStats(StringBuilder sb, ProcessorDefinition<?> definition) { Stats stats = statistics.get(definition); if (stats != null) { sb.append("<processor"); if (definition.getId() != null) { sb.append(" id=\"").append(definition.getId()).append("\""); } sb.append(" definition=\"").append(StringHelper.xmlEncode(definition.toString())).append("\""); if (definition.getLabel() != null) { sb.append(" label=\"").append(definition.getLabel()).append("\""); } sb.append(" count=\"").append(stats.getCount()).append("\""); sb.append(" self=\"").append(stats.getSelf()).append("\""); sb.append(" total=\"").append(stats.getTotal()).append("\""); sb.append(">"); for (ProcessorDefinition<?> child : statistics.keySet()) { if (child.getParent() == definition) { appendStats(sb, child); } } sb.append("</processor>"); } }
private CamelCloudServiceFilter createServiceFilter(CamelCloudConfigurationProperties.ServiceFilterConfiguration configuration) { BlacklistServiceFilter blacklist = new BlacklistServiceFilter(); Map<String, List<String>> services = configuration.getBlacklist(); for (Map.Entry<String, List<String>> entry : services.entrySet()) { for (String part : entry.getValue()) { String host = StringHelper.before(part, ":"); String port = StringHelper.after(part, ":"); if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) { blacklist.addServer( DefaultServiceDefinition.builder() .withName(entry.getKey()) .withHost(host) .withPort(Integer.parseInt(port)) .build() ); } } } return new CamelCloudServiceFilter(Arrays.asList(new HealthyServiceFilter(), blacklist)); } }
/** * Gets the destination name which was configured from the endpoint uri. * * @return the destination name resolved from the endpoint uri */ public String getEndpointConfiguredDestinationName() { String remainder = StringHelper.after(getEndpointKey(), "//"); if (remainder != null && remainder.contains("?")) { // remove parameters remainder = StringHelper.before(remainder, "?"); } return JmsMessageHelper.normalizeDestinationName(remainder); }
protected void doStart() throws Exception { super.doStart(); if (getEndpoint().getMessageChannel() == null) { String inputChannelName = getEndpoint().getDefaultChannel(); if (ObjectHelper.isEmpty(inputChannelName)) { inputChannelName = getEndpoint().getInputChannel(); } StringHelper.notEmpty(inputChannelName, "inputChannelName", getEndpoint()); inputChannel = (SubscribableChannel) destinationResolver.resolveDestination(inputChannelName); } else { inputChannel = (SubscribableChannel) getEndpoint().getMessageChannel(); } if (inputChannel == null) { throw new IllegalArgumentException("Cannot resolve InputChannel on " + getEndpoint()); } // if we do in-out we need to setup the input channel as well if (getEndpoint().isInOut()) { // we need to setup right outputChannel for further processing StringHelper.notEmpty(getEndpoint().getOutputChannel(), "OutputChannel", getEndpoint()); outputChannel = destinationResolver.resolveDestination(getEndpoint().getOutputChannel()); if (outputChannel == null) { throw new IllegalArgumentException("Cannot resolve OutputChannel on " + getEndpoint()); } } inputChannel.subscribe(this); }