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


Java PropertiesComponent.setInitialProperties方法代码示例

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


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

示例1: propertiesComponent

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent propertiesComponent() {
    Properties configuration = new Properties();
    configuration.put("property", "value");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(configuration);
    component.setLocation("classpath:camel1.properties,classpath:camel2.properties");
    return component;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:PropertiesConfigurationTest.java

示例2: setupPropertiesComponent

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
public static void setupPropertiesComponent(final CamelContext context, final Map<String, String> props, Logger log) {
    // Set up PropertiesComponent
    PropertiesComponent pc = new PropertiesComponent();
    if (context.getComponentNames().contains("properties")) {
        pc = context.getComponent("properties", PropertiesComponent.class);
    } else {
        context.addComponent("properties", pc);
    }

    // Set property prefix
    if (System.getProperty(PROPERTY_PREFIX) != null) {
        pc.setPropertyPrefix(System.getProperty(PROPERTY_PREFIX) + ".");
    }

    if (props != null) {
        Properties initialProps = new Properties();
        initialProps.putAll(props);
        log.debug(String.format("Added %d initial properties", props.size()));
        try {
            pc.setInitialProperties(initialProps);
        } catch (NoSuchMethodError e) {
            // For Camel versions without setInitialProperties
            pc.setOverrideProperties(initialProps);
            pc.setLocation("default.properties");
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:28,代码来源:AbstractCamelRunner.java

示例3: configuration

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("property", "value");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(properties);
    return component;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:PropertyInjectTest.java

示例4: configuration

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("from", "inbound");
    // Do not add the looked up property for test purpose
    //properties.put("to", "mock:outbound");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(properties);
    return component;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:UndefinedPropertyTest.java

示例5: configuration

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("from", "inbound");
    properties.put("to", "mock:outbound");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(properties);
    return component;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:PropertyEndpointTest.java

示例6: configuration

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("from", "inbound");
    properties.put("to", "direct:outbound");
    properties.put("header.message", "n/a");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(properties);
    return component;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:AdvisedRouteTest.java

示例7: configuration

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("property", "default");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(properties);
    return component;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:MultiContextPropertyInjectTest.java

示例8: configuration

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("property1", "value 1");
    properties.put("property2", "value 2");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(properties);
    return component;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:InjectedTypeConverterTest.java

示例9: initProperties

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的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


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