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


Java PropertiesComponent.setLocations方法代码示例

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


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

示例1: createCamelContext

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();

    final Properties properties = new Properties();
    properties.put("foo", "bar");
    PropertiesComponent pc = camelContext.getComponent("properties", PropertiesComponent.class);
    pc.setLocations(new String[0]);
    pc.setPropertiesResolver(new PropertiesResolver() {
        @Override
        public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) {
            return properties;
        }
    });

    return camelContext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:PropertiesAvailableEverywhereTest.java

示例2: readProperties

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
public static void readProperties(
		final CamelContext context,
		final String... propertiesLocations)
{
	if (context.hasComponent("properties") == null)
	{
		final StringBuilder msg = new StringBuilder("Going to add a PropertiesComponent with propertiesLocation(s)=");
		for (final String loc : propertiesLocations)
		{
			msg.append(loc + " ");
		}
		LOGGER.info(msg.toString());

		final PropertiesComponent pc = new PropertiesComponent();
		pc.setLocations(propertiesLocations);
		context.addComponent("properties", pc);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:19,代码来源:Util.java

示例3: readProperties

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
public static void readProperties(
		final CamelContext context,
		final String... propertiesLocations)
{
	if (context.hasComponent("properties") == null)
	{
		final StringBuilder msg = new StringBuilder("Going to add a PropertiesComponent with propertiesLocation(s)=");
		for (final String loc : propertiesLocations)
		{
			msg.append(loc + " ");
		}
		Util.LOGGER.info(msg.toString());

		final PropertiesComponent pc = new PropertiesComponent();
		pc.setLocations(propertiesLocations);
		context.addComponent("properties", pc);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:19,代码来源:Util.java

示例4: createCamelContext

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    props = new Properties();
    props.put("somewhere", "mock:changed");
    props.put("theBar", "mock:bar");

    CamelContext context = super.createCamelContext();

    PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
    pc.setLocations(new String[0]);
    pc.setOverrideProperties(props);

    return context;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:ManagedCamelContextUpdateRoutesWithPropertyPlaceholdersFromXmlPTest.java

示例5: createCamelContext

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocations(new String[]{"org/apache/camel/component/properties/bar.properties"});
    context.addComponent("properties", pc);

    return context;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:SimplePropertiesNestedTest.java

示例6: createCamelContext

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocations(new String[]{"camel.properties"});
    context.addComponent("properties", pc);

    return context;
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:11,代码来源:SimplePropertiesTest.java

示例7: setupPropertiesComponent

import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
private void setupPropertiesComponent(CamelContext camelContext) {
    PropertiesComponent pc = new PropertiesComponent();
    if (camelContext.getComponentNames().contains("properties")) {
        pc = camelContext.getComponent("properties", PropertiesComponent.class);
    } else {
        camelContext.addComponent("properties", pc);
    }

    if (!propertyPrefix.isEmpty()) {
        pc.setPropertyPrefix(propertyPrefix);
    }

    // Overlay properties (classpath -> file -> command line)
    List<String> locations = new ArrayList<>();
    if (propertiesFiles.isEmpty()) {
        locations.add("defaultRoute.properties");
    } else {
        for (String pf : propertiesFiles) {
            if (null != camelContext.getClassResolver().loadResourceAsURL(pf)) {
                log.info("Adding properties file " + pf + " from classpath");
                locations.add(pf);
            } else if ((new File(pf)).exists()) {
                log.info("Adding properties file " + pf);
                locations.add("file:" + pf);
            } else {
                log.warn("Properties file not found (" + pf + ")");
            }
        }
    }

    pc.setLocations(locations.toArray(new String[locations.size()]));
    pc.setOverrideProperties(properties);
}
 
开发者ID:yuruki,项目名称:camel-runner,代码行数:34,代码来源:CamelRunnerMain.java


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