use of org.apache.camel.spi.PropertiesComponent in project wildfly-camel by wildfly-extras.
the class DigitalOceanIntegrationTest method createCamelContext.
private CamelContext createCamelContext(String oauthToken) {
CamelContext camelctx = new DefaultCamelContext();
PropertiesComponent pc = camelctx.getPropertiesComponent();
Properties properties = new Properties();
properties.setProperty("oAuthToken", oauthToken);
pc.setOverrideProperties(properties);
return camelctx;
}
use of org.apache.camel.spi.PropertiesComponent in project camel-quarkus by apache.
the class FastCamelContext method createPropertiesComponent.
@Override
protected PropertiesComponent createPropertiesComponent() {
org.apache.camel.component.properties.PropertiesComponent pc = new org.apache.camel.component.properties.PropertiesComponent();
pc.setAutoDiscoverPropertiesSources(false);
pc.addPropertiesSource(new CamelMicroProfilePropertiesSource());
return pc;
}
use of org.apache.camel.spi.PropertiesComponent in project camel-spring-boot by apache.
the class JsonPathTransformONielPlaceholderTest method contextConfiguration.
@Bean
CamelContextConfiguration contextConfiguration() {
return new CamelContextConfiguration() {
@Override
public void beforeApplicationStart(CamelContext context) {
PropertiesComponent pc = context.getPropertiesComponent();
Properties props = new Properties();
props.put("who", "John O'Niel");
props.put("search", "Sword's of Honour");
pc.setInitialProperties(props);
}
@Override
public void afterApplicationStart(CamelContext camelContext) {
// do nothing here
}
};
}
use of org.apache.camel.spi.PropertiesComponent in project camel-k-runtime by apache.
the class PropertiesSupport method bindProperties.
public static <T> T bindProperties(CamelContext context, T target, Predicate<String> filter, String prefix, boolean stripPrefix) {
final PropertiesComponent component = context.getPropertiesComponent();
final Properties propertiesWithPrefix = component.loadProperties(filter);
final Map<String, Object> properties = new HashMap<>();
propertiesWithPrefix.stringPropertyNames().forEach(name -> properties.put(stripPrefix ? name.substring(prefix.length()) : name, propertiesWithPrefix.getProperty(name)));
PropertyConfigurer configurer = null;
if (target instanceof Component) {
// the component needs to be initialized to have the configurer ready
ServiceHelper.initService(target);
configurer = ((Component) target).getComponentPropertyConfigurer();
}
if (configurer == null) {
String name = target.getClass().getName();
if (target instanceof ExtendedCamelContext) {
// special for camel context itself as we have an extended configurer
name = ExtendedCamelContext.class.getName();
}
// see if there is a configurer for it
configurer = context.adapt(ExtendedCamelContext.class).getConfigurerResolver().resolvePropertyConfigurer(name, context);
}
PropertyBindingSupport.build().withIgnoreCase(true).withCamelContext(context).withTarget(target).withProperties(properties).withRemoveParameters(true).withOptionPrefix(stripPrefix ? null : prefix).withConfigurer(configurer).bind();
return target;
}
use of org.apache.camel.spi.PropertiesComponent in project syndesis by syndesisio.
the class RestSwaggerConnectorIntegrationTest method createRouteBuilder.
private RouteBuilder createRouteBuilder() {
return new IntegrationRouteBuilder("", Resources.loadServices(IntegrationStepHandler.class)) {
{
setContext(createContext());
}
@Override
public void configure() throws Exception {
errorHandler(defaultErrorHandler().maximumRedeliveries(1));
super.configure();
}
private ModelCamelContext createContext() {
final Properties properties = new Properties();
properties.put("flow-3.rest-openapi-1.password", "supersecret");
properties.put("flow-4.rest-openapi-1.accessToken", "access-token");
properties.put("flow-6.rest-openapi-1.clientSecret", "client-secret");
properties.put("flow-6.rest-openapi-1.accessToken", "access-token");
properties.put("flow-6.rest-openapi-1.refreshToken", "refresh-token");
properties.put("flow-7.rest-openapi-1.clientSecret", "client-secret");
properties.put("flow-7.rest-openapi-1.accessToken", "access-token");
properties.put("flow-7.rest-openapi-1.refreshToken", "refresh-token");
properties.put("flow-8.rest-openapi-1.authenticationParameterValue", "supersecret");
properties.put("flow-9.rest-openapi-1.authenticationParameterValue", "supersecret");
properties.put("flow-10.rest-openapi-1.authenticationParameterValue", "supersecret");
final ModelCamelContext leanContext = new DefaultCamelContext();
final PropertiesComponent propertiesComponent = leanContext.getPropertiesComponent();
propertiesComponent.setInitialProperties(properties);
leanContext.disableJMX();
return leanContext;
}
@Override
protected Integration loadIntegration() {
return createIntegration();
}
};
}
Aggregations