当前位置: 首页>>代码示例>>Java>>正文


Java URISupport.parseParameters方法代码示例

本文整理汇总了Java中org.apache.camel.util.URISupport.parseParameters方法的典型用法代码示例。如果您正苦于以下问题:Java URISupport.parseParameters方法的具体用法?Java URISupport.parseParameters怎么用?Java URISupport.parseParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.util.URISupport的用法示例。


在下文中一共展示了URISupport.parseParameters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populateFromURI

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
public static void populateFromURI(CamelContext camelContext, EndpointConfiguration config, ParameterSetter setter) {
    URI uri = config.getURI();
    
    setter.set(camelContext, config, EndpointConfiguration.URI_SCHEME, uri.getScheme());
    setter.set(camelContext, config, EndpointConfiguration.URI_SCHEME_SPECIFIC_PART, uri.getSchemeSpecificPart());
    setter.set(camelContext, config, EndpointConfiguration.URI_AUTHORITY, uri.getAuthority());
    setter.set(camelContext, config, EndpointConfiguration.URI_USER_INFO, uri.getUserInfo());
    setter.set(camelContext, config, EndpointConfiguration.URI_HOST, uri.getHost());
    setter.set(camelContext, config, EndpointConfiguration.URI_PORT, Integer.toString(uri.getPort()));
    setter.set(camelContext, config, EndpointConfiguration.URI_PATH, uri.getPath());
    setter.set(camelContext, config, EndpointConfiguration.URI_QUERY, uri.getQuery());
    setter.set(camelContext, config, EndpointConfiguration.URI_FRAGMENT, uri.getFragment());
    
    // now parse query and set custom parameters
    Map<String, Object> parameters;
    try {
        parameters = URISupport.parseParameters(uri);
        for (Map.Entry<String, Object> pair : parameters.entrySet()) {
            setter.set(camelContext, config, pair.getKey(), pair.getValue());
        }
    } catch (URISyntaxException e) {
        throw new RuntimeCamelException(e);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:ConfigurationHelper.java

示例2: findSchedulerUriComponent

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
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
                }
            }
        }
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:CamelNamespaceHandler.java

示例3: parseURI

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
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);
    initialDelay = getLong(hdfsSettings, "initialDelay", initialDelay);
    delay = getLong(hdfsSettings, "delay", delay);
    pattern = getString(hdfsSettings, "pattern", pattern);
    chunkSize = getInteger(hdfsSettings, "chunkSize", chunkSize);
    splitStrategies = getSplitStrategies(hdfsSettings);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:34,代码来源:HdfsConfiguration.java

示例4: parseURI

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
public void parseURI(URI uri) throws URISyntaxException {
    String protocol = uri.getScheme();
    if (!protocol.equalsIgnoreCase("hdfs")) {
        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);
    initialDelay = getLong(hdfsSettings, "initialDelay", initialDelay);
    delay = getLong(hdfsSettings, "delay", delay);
    pattern = getString(hdfsSettings, "pattern", pattern);
    chunkSize = getInteger(hdfsSettings, "chunkSize", chunkSize);
    splitStrategies = getSplitStrategies(hdfsSettings);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:34,代码来源:HdfsConfiguration.java

示例5: createEndpoint

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
public Endpoint createEndpoint(String uri) throws Exception {
    ObjectHelper.notNull(getCamelContext(), "camelContext");
    // check URI string to the unsafe URI characters
    String encodedUri = preProcessUri(uri);
    URI u = new URI(encodedUri);
    String path = URISupport.extractRemainderPath(u, useRawUri());

    Map<String, Object> parameters;
    if (useRawUri()) {
        // when using raw uri then the query is taking from the uri as is
        String query;
        int idx = uri.indexOf('?');
        if (idx > -1) {
            query = uri.substring(idx + 1);
        } else {
            query = u.getRawQuery();
        }
        // and use method parseQuery
        parameters = URISupport.parseQuery(query, true);
    } else {
        // however when using the encoded (default mode) uri then the query,
        // is taken from the URI (ensures values is URI encoded)
        // and use method parseParameters
        parameters = URISupport.parseParameters(u);
    }
    // parameters using raw syntax: RAW(value)
    // should have the token removed, so its only the value we have in parameters, as we are about to create
    // an endpoint and want to have the parameter values without the RAW tokens
    URISupport.resolveRawParameterValues(parameters);

    // use encoded or raw uri?
    uri = useRawUri() ? uri : encodedUri;

    validateURI(uri, path, parameters);
    if (LOG.isTraceEnabled()) {
        // at trace level its okay to have parameters logged, that may contain passwords
        LOG.trace("Creating endpoint uri=[{}], path=[{}], parameters=[{}]", URISupport.sanitizeUri(uri), URISupport.sanitizePath(path), parameters);
    } else if (LOG.isDebugEnabled()) {
        // but at debug level only output sanitized uris
        LOG.debug("Creating endpoint uri=[{}], path=[{}]", new Object[]{URISupport.sanitizeUri(uri), URISupport.sanitizePath(path)});
    }
    Endpoint endpoint = createEndpoint(uri, path, parameters);
    if (endpoint == null) {
        return null;
    }

    if (!parameters.isEmpty()) {
        endpoint.configureProperties(parameters);
        if (useIntrospectionOnEndpoint()) {
            setProperties(endpoint, parameters);
        }

        // if endpoint is strict (not lenient) and we have unknown parameters configured then
        // fail if there are parameters that could not be set, then they are probably misspell or not supported at all
        if (!endpoint.isLenientProperties()) {
            validateParameters(uri, parameters, null);
        }
    }

    afterConfiguration(uri, path, endpoint, parameters);
    return endpoint;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:63,代码来源:DefaultComponent.java

示例6: parseURI

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
public void parseURI(URI uri) throws Exception {
    String protocol = uri.getScheme();

    if (!protocol.equalsIgnoreCase("lpr")) {
        throw new IllegalArgumentException("Unrecognized Print protocol: " + protocol + " for uri: " + uri);
    }

    setUri(uri);
    setHostname(uri.getHost());
    setPort(uri.getPort());

    // use path as printer name, but without any leading slashes
    String path = uri.getPath();
    path = ObjectHelper.removeStartingCharacters(path, '/');
    path = ObjectHelper.removeStartingCharacters(path, '\\');
    setPrintername(path);

    Map<String, Object> printSettings = URISupport.parseParameters(uri);
    setFlavor((String) printSettings.get("flavor"));
    setMimeType((String) printSettings.get("mimeType"));
    setDocFlavor(assignDocFlavor(flavor, mimeType));

    setPrinterPrefix((String) printSettings.get("printerPrefix"));

    if (printSettings.containsKey("copies")) {
        setCopies(Integer.valueOf((String) printSettings.get("copies")));
    }
    setMediaSize((String) printSettings.get("mediaSize"));
    setSides((String) printSettings.get("sides"));
    setOrientation((String) printSettings.get("orientation"));
    setMediaSizeName(assignMediaSize(mediaSize));
    setInternalSides(assignSides(sides));
    setInternalOrientation(assignOrientation(orientation));
    if (printSettings.containsKey("sendToPrinter")) {
        if (!(Boolean.valueOf((String) printSettings.get("sendToPrinter")))) {
            setSendToPrinter(false);
        }
    }

    if (printSettings.containsKey("mediaTray")) {
        setMediaTray((String) printSettings.get("mediaTray"));
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:44,代码来源:PrinterConfiguration.java

示例7: determineIdProperty

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
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");
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:8,代码来源:AdaptObjectForUpdateProcessor.java


注:本文中的org.apache.camel.util.URISupport.parseParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。