org.apache.camel.spi.PropertiesComponent Java Examples

The following examples show how to use org.apache.camel.spi.PropertiesComponent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: camel-k-runtime   Author: apache   File: PropertiesSupport.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static boolean bindProperties(CamelContext context, Object target, String prefix) {
    final PropertiesComponent component = context.getPropertiesComponent();
    final Properties properties = component.loadProperties(k -> k.startsWith(prefix));

    return PropertyBindingSupport.build()
        .withCamelContext(context)
        .withTarget(target)
        .withProperties((Map)properties)
        .withRemoveParameters(false)
        .withOptionPrefix(prefix)
        .bind();
}
 
Example #2
Source Project: wildfly-camel   Author: wildfly-extras   File: DigitalOceanIntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #3
Source Project: syndesis   Author: syndesisio   File: RestSwaggerConnectorIntegrationTest.java    License: Apache License 2.0 4 votes vote down vote up
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();
        }
    };
}