private String getTransactionManagerName(URI uri) { try { final Map<String, Object> parseParameters = URISupport.parseParameters(uri); String name = (String) parseParameters.get("transactionManager"); if (name != null) { name = name.replace("#", ""); } return name; } catch (URISyntaxException e) { throw new SwitchYardException(e); } }
private String determineIdProperty(final Exchange exchange) throws URISyntaxException { final String uri = exchange.getProperty(Exchange.TO_ENDPOINT, String.class); final Map<String, Object> endpointParameters = URISupport.parseParameters(URI.create(uri)); return (String) endpointParameters.getOrDefault(SalesforceEndpointConfig.SOBJECT_EXT_ID_NAME, "Id"); }
private String determineIdProperty(final Exchange exchange) throws URISyntaxException { final String uri = exchange.getProperty(Exchange.TO_ENDPOINT, String.class); final Map<String, Object> endpointParameters = URISupport.parseParameters(URI.create(uri)); return (String) endpointParameters.getOrDefault(SalesforceEndpointConfig.SOBJECT_EXT_ID_NAME, "Id"); }
private String getTransactionManagerName(URI uri) { try { final Map<String, Object> parseParameters = URISupport.parseParameters(uri); String name = (String) parseParameters.get("transactionManager"); if (name != null) { name = name.replace("#", ""); } return name; } catch (URISyntaxException e) { throw new SwitchYardException(e); } }
public SyncMockDefinitionBuilder restMock(String endpointUri) { try { if (!URISupport.parseParameters(new URI(endpointUri)).containsKey("matchOnUriPrefix")) { Map<String, Object> params = new HashMap<>(); params.put("matchOnUriPrefix", "true"); endpointUri = URISupport.appendParametersToURI(endpointUri, params); } } catch (URISyntaxException | UnsupportedEncodingException e) { throw new RuntimeException(e); } return syncMock(endpointUri); }
private void findSchedulerUriComponent(String uri, Set<String> components) { // the input may use a scheduler which can be quartz or spring if (uri != null) { try { URI u = new URI(uri); Map<String, Object> parameters = URISupport.parseParameters(u); Object value = parameters.get("scheduler"); if (value == null) { value = parameters.get("consumer.scheduler"); } if (value != null) { // the scheduler can be quartz2 or spring based, so add reference to camel component // from these components os blueprint knows about the requirement String name = value.toString(); if ("quartz2".equals(name)) { components.add("quartz2"); } else if ("spring".equals(name)) { components.add("spring-event"); } } } catch (URISyntaxException e) { // ignore as uri should be already validated at findUriComponent method } } }
/** * Constructs a {@link URL} from an <code>uri</code> and an optional * <code>query</code> string. The encoding strategy follow those of the * Camel HTTP component. * * @param uri * must be encoded with * {@link UnsafeUriCharactersEncoder#encode(String)}. * @param query * decoded query string. Replaces the query part of * <code>uri</code> if not <code>null</code>. */ static URL getEndpointUrl(String uri, String query) throws Exception { Map<String, Object> parameters = null; URI uriObj = new URI(uri); if (query == null) { parameters = URISupport.parseParameters(uriObj); } else { parameters = URISupport.parseQuery(query, false, true); } if (uriObj.getScheme().equals(GHTTPS_SCHEME)) { uriObj = new URI(HTTPS_SCHEME + ":" + uriObj.getRawSchemeSpecificPart()); } else { // ghttp or anything else uriObj = new URI(HTTP_SCHEME + ":" + uriObj.getRawSchemeSpecificPart()); } return URISupport.createRemainingURI(uriObj, parameters).toURL(); }
path = path.substring(0, idx); Map<String, Object> params = URISupport.parseParameters(new URI(child)); String consumer = params != null ? (String) params.remove("consumer") : null; if (consumer != null) {
Map parameters = URISupport.parseParameters(u); parameters.put(EcaEndpoint.PATTERN_NAME, getEvaluation()); parameters.put(EcaEndpoint.WINDOW_NAME, getEventWindow());
Map<String, Object> parameters = URISupport.parseParameters(u); String user = (String)parameters.get("username"); String nick = (String)parameters.get("nickname");
path = path.substring(0, idx); Map<String, Object> params = URISupport.parseParameters(new URI(child)); String consumer = params != null ? (String) params.remove("consumer") : null; if (consumer != null) {
Map<String, Object> settings = URISupport.parseParameters(uri);
public void parseURI(URI uri) throws URISyntaxException { String protocol = uri.getScheme(); if (!protocol.equalsIgnoreCase("hdfs2")) { throw new IllegalArgumentException("Unrecognized protocol: " + protocol + " for uri: " + uri); } hostName = uri.getHost(); if (hostName == null) { hostName = "localhost"; } port = uri.getPort() == -1 ? HdfsConstants.DEFAULT_PORT : uri.getPort(); path = uri.getPath(); Map<String, Object> hdfsSettings = URISupport.parseParameters(uri); overwrite = getBoolean(hdfsSettings, "overwrite", overwrite); append = getBoolean(hdfsSettings, "append", append); wantAppend = append; bufferSize = getInteger(hdfsSettings, "bufferSize", bufferSize); replication = getShort(hdfsSettings, "replication", replication); blockSize = getLong(hdfsSettings, "blockSize", blockSize); compressionType = getCompressionType(hdfsSettings, "compressionType", compressionType); compressionCodec = getCompressionCodec(hdfsSettings, "compressionCodec", compressionCodec); fileType = getFileType(hdfsSettings, "fileType", fileType); fileSystemType = getFileSystemType(hdfsSettings, "fileSystemType", fileSystemType); keyType = getWritableType(hdfsSettings, "keyType", keyType); valueType = getWritableType(hdfsSettings, "valueType", valueType); openedSuffix = getString(hdfsSettings, "openedSuffix", openedSuffix); readSuffix = getString(hdfsSettings, "readSuffix", readSuffix); pattern = getString(hdfsSettings, "pattern", pattern); chunkSize = getInteger(hdfsSettings, "chunkSize", chunkSize); splitStrategies = getSplitStrategies(hdfsSettings); }