當前位置: 首頁>>代碼示例>>Java>>正文


Java CamelContext.getComponent方法代碼示例

本文整理匯總了Java中org.apache.camel.CamelContext.getComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java CamelContext.getComponent方法的具體用法?Java CamelContext.getComponent怎麽用?Java CamelContext.getComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.camel.CamelContext的用法示例。


在下文中一共展示了CamelContext.getComponent方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getComponentVerifierExtension

import org.apache.camel.CamelContext; //導入方法依賴的package包/類
private ComponentVerifierExtension getComponentVerifierExtension(CamelContext context, String scheme) {
    if (verifierExtension == null) {
        synchronized (this) {
            if (verifierExtension == null) {
                Component component = context.getComponent(scheme, true, false);
                if (component == null) {
                    log.error("Component {} does not exist", scheme);
                } else {
                    verifierExtension = component.getExtension(verifierExtensionClass).orElse(null);
                    if (verifierExtension == null) {
                        log.warn("Component {} does not support verifier extension", scheme);
                    }

                }
            }
        }
    }

    return verifierExtension;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:21,代碼來源:ComponentVerifier.java

示例2: ping

import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
    // need to create Camel
    CamelContext camel = new DefaultCamelContext();

    // get the connector to use
    Component mention = camel.getComponent("salesforce-upsert-contact-connector");
    Optional<ComponentVerifierExtension> ext = mention.getExtension(ComponentVerifierExtension.class);

    // the connector must support ping check if its verifiable
    if (ext.isPresent()) {
        ComponentVerifierExtension verifier = ext.get();

        Map<String, Object> parameters = loadParameters();
        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);

        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Ping check result: " + result.getStatus());
        System.out.println("");
        System.out.println("=============================================");

    } else {
        System.out.println("Component does not support ping check");
    }
}
 
開發者ID:syndesisio,項目名稱:connectors,代碼行數:26,代碼來源:SalesforcePingCheck.java

示例3: ping

import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
    // need to create Camel
    CamelContext camel = new DefaultCamelContext();

    // get the connector to use
    Component mention = camel.getComponent("twitter-mention-connector");
    Optional<ComponentVerifierExtension> ext = mention.getExtension(ComponentVerifierExtension.class);

    // the connector must support ping check if its verifiable
    if (ext.isPresent()) {
        ComponentVerifierExtension verifier = ext.get();
        Map<String, Object> parameters = loadParameters();
        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);

        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Ping check result: " + result.getStatus());
        System.out.println("");
        System.out.println("=============================================");

    } else {
        System.out.println("Component does not support ping check");
    }
}
 
開發者ID:syndesisio,項目名稱:connectors,代碼行數:25,代碼來源:TwitterPingCheck.java

示例4: ping

import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
    // need to create Camel
    CamelContext camel = new DefaultCamelContext();

    // get the connector to use
    Component get = camel.getComponent("http-get-connector");
    Optional<ComponentVerifierExtension> ext = get.getExtension(ComponentVerifierExtension.class);

    // the connector must support ping check if its verifiable
    if (ext.isPresent()) {
        ComponentVerifierExtension verifier = ext.get();

        Map<String, Object> parameters = loadParameters();
        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);

        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Ping check result: " + result.getStatus());
        System.out.println("");
        System.out.println("=============================================");

    } else {
        System.out.println("Component does not support ping check");
    }
}
 
開發者ID:syndesisio,項目名稱:connectors,代碼行數:26,代碼來源:HttpPingCheck.java

示例5: initProperties

import org.apache.camel.CamelContext; //導入方法依賴的package包/類
private static void initProperties(CamelContext context,
                                  IPropertiesAware applicationPropertiesAware,
                                  IPropertiesAware servicePropertiesAware) {

    try {
        PropertiesComponent propertiesComponent = context.getComponent(
                "properties", PropertiesComponent.class);
        propertiesComponent.setIgnoreMissingLocation(true);

        String applicationPrefix = applicationPropertiesAware.getpropertiesPrefix();
        String servicePrefix = null;
        if(servicePropertiesAware != null) {
            servicePrefix = applicationPrefix + "." + servicePropertiesAware.getpropertiesPrefix();
        }

        Properties applicationProperties =
                loadProperties(applicationPrefix, applicationPropertiesAware);
        Properties serviceProperties =
                loadProperties(servicePrefix, servicePropertiesAware);

        Properties initialServiceProperties = new Properties();
        if(servicePropertiesAware != null){
            initialServiceProperties = MapUtils.prefixProperties(servicePrefix, servicePropertiesAware.getInitialProperties());
        }

        Properties initialApplicationProperties = new Properties();
        if(servicePropertiesAware != null){
            initialApplicationProperties = MapUtils.prefixProperties(applicationPrefix, applicationPropertiesAware.getInitialProperties());
        }

        Properties mergedProps = MapUtils.mergeProperties(
                applicationProperties,
                serviceProperties);
        mergedProps = MapUtils.mergeProperties(
                initialApplicationProperties,
                mergedProps);
        mergedProps =MapUtils.mergeProperties(
                initialServiceProperties,
                mergedProps);
        propertiesComponent.setInitialProperties(mergedProps);
    } catch (Exception ex) {
        throw new RuntimeException("could not initialize application properties", ex);
    }
}
 
開發者ID:drinkwater-io,項目名稱:drinkwater-java,代碼行數:45,代碼來源:CamelContextFactory.java

示例6: ping

import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
    // need to create Camel
    CamelContext camel = new DefaultCamelContext();
    camel.start();

    // get the connector to use
    Component sqlstored = camel.getComponent("sql-stored-connector");

    // the connector must support ping check if its verifiable
    Optional<SqlStoredConnectorVerifierExtension> vce = sqlstored.getExtension(SqlStoredConnectorVerifierExtension.class);
    if (vce.isPresent()) {
        ComponentVerifierExtension verifier = vce.get();

        Map<String, Object> parameters = loadParameters();
        
        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters);
        
        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Parameters check result: " + result.getStatus());
        if (result.getStatus().equals(Result.Status.ERROR)) {
            System.out.println(result.getErrors());
        }
        System.out.println("");
        System.out.println("=============================================");
        
        ComponentVerifierExtension.Result result2 = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);

        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Ping check result: " + result2.getStatus());
        if (result2.getStatus().equals(Result.Status.ERROR)) {
            System.out.println(result2.getErrors());
        }
        System.out.println("");
        System.out.println("=============================================");

    } else {
        System.out.println("Component does not support ping check");
    }

    camel.stop();
}
 
開發者ID:syndesisio,項目名稱:connectors,代碼行數:44,代碼來源:SqlStoredPingCheck.java


注:本文中的org.apache.camel.CamelContext.getComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。