Java 类org.apache.camel.CamelContext 实例源码

项目:syndesis    文件:ChoiceHandler.java   
@Override
public Optional<ProcessorDefinition> handle(Choice step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    final CamelContext context = routeBuilder.getContext();
    final ChoiceDefinition choice = route.choice();

    List<Filter> filters = ObjectHelper.supplyIfEmpty(step.getFilters(), Collections::<Filter>emptyList);
    for (Filter filter : filters) {
        Predicate predicate = JsonSimpleHelpers.getMandatorySimplePredicate(context, filter, filter.getExpression());
        ChoiceDefinition when = choice.when(predicate);

        routeBuilder.addSteps(when, filter.getSteps());
    }

    Otherwise otherwiseStep = step.getOtherwise();
    if (otherwiseStep != null) {
        List<Step> otherwiseSteps = ObjectHelper.supplyIfEmpty(otherwiseStep.getSteps(), Collections::<Step>emptyList);
        if (!otherwiseSteps.isEmpty()) {
            routeBuilder.addSteps(choice.otherwise(), otherwiseSteps);
        }
    }

    return Optional.empty();
}
项目:ipf-flow-manager    文件:FlowBeginProcessorDefinition.java   
private static FlowBeginProcessor createFlowBeginProcessor(RouteContext routeContext) {
    CamelContext camelContext = routeContext.getCamelContext();

    // Try to obtain a FlowBeginProcessor bean (its definition is optional)
    FlowBeginProcessor processor = ContextUtils.beanOrNull(FlowBeginProcessor.class, camelContext);

    if (processor != null) {
        return processor;
    }

    // No FlowBeginProcessor bean found so let's create one. We need a
    // - reference to a ReplayStrategyRegistry
    // - reference to a FlowManager
    processor = new FlowBeginProcessor();
    processor.setCamelContext(camelContext);
    processor.setFlowManager(ContextUtils.bean(FlowManager.class, camelContext));
    processor.setRegistry(ContextUtils.bean(ReplayStrategyRegistry.class, camelContext));
    return processor;
}
项目:syndesis    文件:ActionDefinitionEndpointTest.java   
@Test
public void shouldMetadata() throws Exception {
    final CamelContext context = new DefaultCamelContext();
    context.addComponent("petstore", new PetstoreComponent(PAYLOAD));

    try {
        context.start();

        final PetstoreAdapter adapter = new PetstoreAdapter(PAYLOAD, PROPERTIES, INPUT, OUTPUT);
        final ActionDefinitionEndpoint endpoint = new ActionDefinitionEndpoint(context, "petstore", adapter);
        final SyndesisMetadata<?> metadata = endpoint.definition("dog-food", Collections.emptyMap());

        assertThat(metadata.properties).isSameAs(PROPERTIES);
        assertThat(metadata.inputSchema).isSameAs(INPUT);
        assertThat(metadata.outputSchema).isSameAs(OUTPUT);
    } finally {
        context.stop();
    }
}
项目:fluid    文件:CamelSinkTest.java   
@Test
public void shouldWrapIntegersIntoCamelBodies(TestContext context) throws Exception {
    Async async = context.async();
    CamelSink<Integer> sink = new CamelSink<>(
            new JsonObject().put("endpoint", "direct:test")
    );
    CamelContext camelContext = sink.camelContext();
    camelContext.addRoutes(new RouteBuilder() {

        @Override public void configure() throws Exception {
            from("direct:test").process(event -> {
                if (event.getIn().getBody(Integer.class) == 10) {
                    context.assertEquals(event.getIn().getBody(Integer.class), 10);
                    async.complete();
                }
            });
        }
    });

    Source.from(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).to(sink);
}
项目:syndesis    文件:SqlStoredStartConnectorComponentTest.java   
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    // set up the component so the data source is built using
    // test properties
    SqlStoredStartConnectorComponent component = new SqlStoredStartConnectorComponent();
    component.addOption("user", properties.getProperty("sql-connector.user"));
    component.addOption("password", properties.getProperty("sql-connector.password"));
    component.addOption("url", properties.getProperty("sql-connector.url"));

    // bind the component to the camel context
    context.addComponent("sql-stored-start-connector", component);

    return context;
}
项目:connectors    文件:SalesforcePingCheck.java   
public void ping() throws Exception {
    // need to create Camel
    CamelContext camel = new DefaultCamelContext();

    // get the connector to use
    Component mention = camel.getComponent("salesforce-upsert-contact-connector");
    Optional<ComponentVerifierExtension> ext = mention.getExtension(ComponentVerifierExtension.class);

    // the connector must support ping check if its verifiable
    if (ext.isPresent()) {
        ComponentVerifierExtension verifier = ext.get();

        Map<String, Object> parameters = loadParameters();
        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);

        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Ping check result: " + result.getStatus());
        System.out.println("");
        System.out.println("=============================================");

    } else {
        System.out.println("Component does not support ping check");
    }
}
项目:connectors    文件:TwitterPingCheck.java   
public void ping() throws Exception {
    // need to create Camel
    CamelContext camel = new DefaultCamelContext();

    // get the connector to use
    Component mention = camel.getComponent("twitter-mention-connector");
    Optional<ComponentVerifierExtension> ext = mention.getExtension(ComponentVerifierExtension.class);

    // the connector must support ping check if its verifiable
    if (ext.isPresent()) {
        ComponentVerifierExtension verifier = ext.get();
        Map<String, Object> parameters = loadParameters();
        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);

        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Ping check result: " + result.getStatus());
        System.out.println("");
        System.out.println("=============================================");

    } else {
        System.out.println("Component does not support ping check");
    }
}
项目:connectors    文件:HttpPingCheck.java   
public void ping() throws Exception {
    // need to create Camel
    CamelContext camel = new DefaultCamelContext();

    // get the connector to use
    Component get = camel.getComponent("http-get-connector");
    Optional<ComponentVerifierExtension> ext = get.getExtension(ComponentVerifierExtension.class);

    // the connector must support ping check if its verifiable
    if (ext.isPresent()) {
        ComponentVerifierExtension verifier = ext.get();

        Map<String, Object> parameters = loadParameters();
        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);

        System.out.println("=============================================");
        System.out.println("");
        System.out.println("Ping check result: " + result.getStatus());
        System.out.println("");
        System.out.println("=============================================");

    } else {
        System.out.println("Component does not support ping check");
    }
}
项目:drinkwater-java    文件:TraceRouteBuilder.java   
public static void addClientSentTracing(CamelContext ctx,
                                        IDrinkWaterService service,
                                        Method method,
                                        Object body) {
    if (service.getConfiguration().getIsTraceEnabled()) {
        ctx.createProducerTemplate()
                .sendBodyAndHeader(ROUTE_clientSentEvent, body,
                        BeanOperationName, Operation.of(method));
    }
}
项目:connectors    文件:SalesforceGetSObjectConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "salesforce-get-sobject-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SalesforceGetSObjectComponent configureSalesforceGetSObjectComponent()
        throws Exception {
    SalesforceGetSObjectComponent connector = new SalesforceGetSObjectComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SalesforceGetSObjectComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-get-sobject.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-get-sobject.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:ipf-flow-manager    文件:FlowEndProcessorDefinition.java   
private static FlowEndProcessor createFlowEndProcessor(RouteContext routeContext) {
    CamelContext camelContext = routeContext.getCamelContext();
    FlowEndProcessor processor = beanOrNull(FlowEndProcessor.class, camelContext);

    if (processor != null) {
        return processor;
    }

    processor = new FlowEndProcessor();
    processor.setCamelContext(camelContext);
    processor.setFlowManager(ContextUtils.bean(FlowManager.class, camelContext));
    return processor;
}
项目:syndesis    文件:Application.java   
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@Bean(name = "verifier-context", initMethod = "start", destroyMethod = "stop")
public static CamelContext verifierContext() {
    CamelContext context = new DefaultCamelContext();
    context.setNameStrategy(new ExplicitCamelContextNameStrategy("verifier-context"));
    context.disableJMX();

    return context;
}
项目:syndesis    文件:FilterHandler.java   
@Override
public Optional<ProcessorDefinition> handle(Filter step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    CamelContext context = routeBuilder.getContext();
    Predicate predicate = JsonSimpleHelpers.getMandatorySimplePredicate(context, step, step.getExpression());
    FilterDefinition filter = route.filter(predicate);

    routeBuilder.addSteps(filter, step.getSteps());

    return Optional.empty();
}
项目:syndesis    文件:SplitHandler.java   
@Override
public Optional<ProcessorDefinition> handle(Split step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    CamelContext context = routeBuilder.getContext();
    Expression expression = JsonSimpleHelpers.getMandatoryExpression(context, step, step.getExpression());
    ProcessorDefinition split = route.split(expression).marshal().json(JsonLibrary.Jackson);

    routeBuilder.addSteps(split, step.getSteps());

    return Optional.empty();
}
项目:syndesis    文件:FunctionHandler.java   
@Override
public Optional<ProcessorDefinition> handle(Function step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    final CamelContext context = routeBuilder.getContext();
    final TypeConverter converter = context.getTypeConverter();

    String method = null;
    String function = step.getName();
    String options = null;

    if (ObjectHelper.isEmpty(function)) {
        return Optional.empty();
    }

    int idx = function.indexOf("::");
    if (idx > 0 && !function.endsWith("::")) {
        method = function.substring(idx + 2);
        function = function.substring(0, idx);
    }

    Map<String, Object> headers = step.getProperties();
    if (ObjectHelper.isNotEmpty(headers)) {
        options = headers.entrySet().stream()
            .filter(entry -> Objects.nonNull(entry.getValue()))
            .map(entry -> asBeanParameter(converter, entry))
            .collect(Collectors.joining("&"));
    }

    String uri = "class:" + function;
    if (method != null) {
        uri += "?method=" + method;

        if (options != null){
            uri += "&" + options;
        }
    } else if (options != null){
        uri += "?" + options;
    }

    return Optional.of(route.to(uri));
}
项目:syndesis-integration-runtime    文件:ExtensionTest.java   
@Override
public ProcessorDefinition configure(CamelContext context, ProcessorDefinition definition, Map<String, Object> parameters) {
    return definition.process(new Processor() {
        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setBody(
                String.join("-",
                    exchange.getIn().getBody(String.class),
                    exchange.getIn().getHeader("ExtensionHeader", String.class),
                    message)
            );
        }
    });
}
项目:bitbreeds-webrtc    文件:SimpleSignalingExample.java   
/**
 * Application entry point
 * @param args application arguments
 * @throws Exception
 */
public static void main(String... args) throws Exception {

    JndiRegistry reg = new JndiRegistry(new JndiContext());

    reg.bind("sslContextParameters",sslParameters());

    CamelContext ctx = new DefaultCamelContext(reg);
    ctx.addRoutes(new WebsocketRouteNoSSL());
    ctx.setUseMDCLogging(true);
    ctx.setTracing(true);
    ctx.start();
}
项目:syndesis    文件:TradeInsightSellConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "trade-insight-sell-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public TradeInsightSellComponent configureTradeInsightSellComponent()
        throws Exception {
    TradeInsightSellComponent connector = new TradeInsightSellComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<TradeInsightSellComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.trade-insight-sell.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.trade-insight-sell.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:TradeInsightBuyConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "trade-insight-buy-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public TradeInsightBuyComponent configureTradeInsightBuyComponent()
        throws Exception {
    TradeInsightBuyComponent connector = new TradeInsightBuyComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<TradeInsightBuyComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.trade-insight-buy.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.trade-insight-buy.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:ipf-flow-manager    文件:ContextUtils.java   
public static <T> T beanOrNull(Class<T> type, CamelContext camelContext) {
    Set<T> beans = camelContext.getRegistry().findByType(type);
    int count = beans.size();
    if (count == 1) {
        return beans.iterator().next();
    } else if (count == 0) {
        return null;
    } else {
        throw new IllegalArgumentException(
                "Too many beans in the application context of type: "
                        + type + ". Found: " + count);
    }
}
项目:syndesis    文件:DayTradeGetConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "day-trade-get-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public DayTradeGetComponent configureDayTradeGetComponent()
        throws Exception {
    DayTradeGetComponent connector = new DayTradeGetComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<DayTradeGetComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-get.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-get.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:sponge    文件:SimpleCamelNoSpringTest.java   
@Test
public void testCamelProducer() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    Engine engine = DefaultEngine.builder().knowledgeBase("camelkb", "examples/camel/camel_producer.py").build();
    registry.put("spongeEngine", engine);
    CamelContext camel = new DefaultCamelContext(registry);

    camel.addRoutes(new RouteBuilder() {

        @Override
        public void configure() {
            // @formatter:off
            from("direct:start").routeId("spongeProducer")
                .to("sponge:spongeEngine");
            // @formatter:on
        }
    });

    camel.start();

    try {
        ProducerTemplate producerTemplate = camel.createProducerTemplate();
        producerTemplate.sendBody("direct:start", "Send me to the Sponge");

        await().atMost(10, TimeUnit.SECONDS)
                .until(() -> engine.getOperations().getVariable(AtomicBoolean.class, "sentCamelMessage").get());
    } finally {
        camel.stop();
    }
}
项目:syndesis    文件:ActiveMQRequestConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "activemq-request-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ActiveMQRequestComponent configureActiveMQRequestComponent()
        throws Exception {
    ActiveMQRequestComponent connector = new ActiveMQRequestComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ActiveMQRequestComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-request.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-request.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:ActiveMQRespondConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "activemq-respond-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ActiveMQRespondComponent configureActiveMQRespondComponent()
        throws Exception {
    ActiveMQRespondComponent connector = new ActiveMQRespondComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ActiveMQRespondComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-respond.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-respond.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:ActiveMQPublishConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "activemq-publish-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ActiveMQPublishComponent configureActiveMQPublishComponent()
        throws Exception {
    ActiveMQPublishComponent connector = new ActiveMQPublishComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ActiveMQPublishComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-publish.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-publish.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis-integration-runtime    文件:SplitHandler.java   
@Override
public ProcessorDefinition handle(Split step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    CamelContext context = routeBuilder.getContext();
    Expression expression = JsonSimpleHelpers.getMandatoryExpression(context, step, step.getExpression());
    ProcessorDefinition split = route.split(expression).marshal().json(JsonLibrary.Jackson);
    return routeBuilder.addSteps(split, step.getSteps());
}
项目:syndesis    文件:SqlStartConnectorConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "sql-start-connector-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SqlStartConnectorComponent configureSqlStartConnectorComponent()
        throws Exception {
    SqlStartConnectorComponent connector = new SqlStartConnectorComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SqlStartConnectorComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.sql-start-connector.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.sql-start-connector.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:SqlConnectorConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "sql-connector-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SqlConnectorComponent configureSqlConnectorComponent()
        throws Exception {
    SqlConnectorComponent connector = new SqlConnectorComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SqlConnectorComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.sql-connector.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.sql-connector.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:SqlStoredConnectorConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "sql-stored-connector-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SqlStoredConnectorComponent configureSqlStoredConnectorComponent()
        throws Exception {
    SqlStoredConnectorComponent connector = new SqlStoredConnectorComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SqlStoredConnectorComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.sql-stored-connector.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.sql-stored-connector.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:SqlStoredStartConnectorConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "sql-stored-start-connector-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SqlStoredStartConnectorComponent configureSqlStoredStartConnectorComponent()
        throws Exception {
    SqlStoredStartConnectorComponent connector = new SqlStoredStartConnectorComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SqlStoredStartConnectorComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.sql-stored-start-connector.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.sql-stored-start-connector.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:ODataDeleteEntityConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "odata-delete-entity-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ODataDeleteEntityComponent configureODataDeleteEntityComponent()
        throws Exception {
    ODataDeleteEntityComponent connector = new ODataDeleteEntityComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ODataDeleteEntityComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-delete-entity.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-delete-entity.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:ODataRetrieveEntityConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "odata-retrieve-entity-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ODataRetrieveEntityComponent configureODataRetrieveEntityComponent()
        throws Exception {
    ODataRetrieveEntityComponent connector = new ODataRetrieveEntityComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ODataRetrieveEntityComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-retrieve-entity.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-retrieve-entity.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:ODataReplaceEntityConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "odata-replace-entity-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ODataReplaceEntityComponent configureODataReplaceEntityComponent()
        throws Exception {
    ODataReplaceEntityComponent connector = new ODataReplaceEntityComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ODataReplaceEntityComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-replace-entity.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-replace-entity.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:ODataCreateEntityConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "odata-create-entity-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ODataCreateEntityComponent configureODataCreateEntityComponent()
        throws Exception {
    ODataCreateEntityComponent connector = new ODataCreateEntityComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ODataCreateEntityComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-create-entity.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-create-entity.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:ODataUpdateEntityConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "odata-update-entity-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ODataUpdateEntityComponent configureODataUpdateEntityComponent()
        throws Exception {
    ODataUpdateEntityComponent connector = new ODataUpdateEntityComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ODataUpdateEntityComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-update-entity.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.odata-update-entity.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:ipf-flow-manager    文件:DedupeDefinition.java   
private static Dedupe createDedupe(RouteContext routeContext) {
    CamelContext camelContext = routeContext.getCamelContext();
    Dedupe dedupe = beanOrNull(Dedupe.class, camelContext);

    if (dedupe != null) {
        return dedupe;
    }

    dedupe = new Dedupe();
    dedupe.setFlowManager(ContextUtils.bean(FlowManager.class, camelContext));
    return dedupe;
}
项目:syndesis    文件:SalesforceOnUpdateConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "salesforce-on-update-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SalesforceOnUpdateComponent configureSalesforceOnUpdateComponent()
        throws Exception {
    SalesforceOnUpdateComponent connector = new SalesforceOnUpdateComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SalesforceOnUpdateComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-on-update.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-on-update.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:SalesforceGetSObjectWithIdConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "salesforce-get-sobject-with-id-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SalesforceGetSObjectWithIdComponent configureSalesforceGetSObjectWithIdComponent()
        throws Exception {
    SalesforceGetSObjectWithIdComponent connector = new SalesforceGetSObjectWithIdComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SalesforceGetSObjectWithIdComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-get-sobject-with-id.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-get-sobject-with-id.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:connectors    文件:SalesforceOnDeleteConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "salesforce-on-delete-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SalesforceOnDeleteComponent configureSalesforceOnDeleteComponent()
        throws Exception {
    SalesforceOnDeleteComponent connector = new SalesforceOnDeleteComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SalesforceOnDeleteComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-on-delete.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-on-delete.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
项目:syndesis    文件:SalesforceGetSObjectConnectorAutoConfiguration.java   
@Lazy
@Bean(name = "salesforce-get-sobject-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SalesforceGetSObjectComponent configureSalesforceGetSObjectComponent()
        throws Exception {
    SalesforceGetSObjectComponent connector = new SalesforceGetSObjectComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<SalesforceGetSObjectComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-get-sobject.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-get-sobject.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}