本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}