use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class BaseMinaTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
context.addComponent("properties", new PropertiesComponent("ref:prop"));
return context;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class AbstractCamelRunner method setupPropertiesComponent.
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()));
pc.setInitialProperties(initialProps);
}
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class GroovyPropertyComponentTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setLocation("org/apache/camel/builder/script/myproperties.properties");
from("direct:start").choice().when().groovy("request.headers.get('foo') == context.resolvePropertyPlaceholders('{{foo}}')").to("mock:result").otherwise().to("mock:unmatched");
}
};
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class CamelAutoConfiguration method properties.
@Bean(initMethod = "", destroyMethod = "")
// Camel handles the lifecycle of this bean
PropertiesComponent properties(CamelContext camelContext, PropertiesParser parser) {
if (camelContext.hasComponent("properties") != null) {
return camelContext.getComponent("properties", PropertiesComponent.class);
} else {
PropertiesComponent pc = new PropertiesComponent();
pc.setPropertiesParser(parser);
return pc;
}
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class BaseUrlRewriteTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
context.addComponent("properties", new PropertiesComponent("ref:prop"));
return context;
}
Aggregations