@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(); }
@Override public ObjectListing listObjects(ListObjectsRequest listObjectsRequest) throws AmazonClientException, AmazonServiceException { if ("nonExistingBucket".equals(listObjectsRequest.getBucketName()) && !nonExistingBucketCreated) { AmazonServiceException ex = new AmazonServiceException("Unknown bucket"); ex.setStatusCode(404); throw ex; } int capacity; ObjectListing objectListing = new ObjectListing(); if (!ObjectHelper.isEmpty(listObjectsRequest.getMaxKeys()) && listObjectsRequest.getMaxKeys() != null) { capacity = listObjectsRequest.getMaxKeys(); } else { capacity = maxCapacity; } for (int index = 0; index < objects.size() && index < capacity; index++) { S3ObjectSummary s3ObjectSummary = new S3ObjectSummary(); s3ObjectSummary.setBucketName(objects.get(index).getBucketName()); s3ObjectSummary.setKey(objects.get(index).getKey()); objectListing.getObjectSummaries().add(s3ObjectSummary); } return objectListing; }
@Override public 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::emptyList); for (Filter filter : filters) { Predicate predicate = JsonSimpleHelpers.getMandatorySimplePredicate(context, filter, filter.getExpression()); ChoiceDefinition when = choice.when(predicate); route = routeBuilder.addSteps(when, filter.getSteps()); } Otherwise otherwiseStep = step.getOtherwise(); if (otherwiseStep != null) { List<Step> otherwiseSteps = ObjectHelper.supplyIfEmpty(otherwiseStep.getSteps(), Collections::emptyList); if (!otherwiseSteps.isEmpty()) { route = routeBuilder.addSteps(choice.otherwise(), otherwiseSteps); } } return route; }
private static String buildUri(Endpoint step) { String uri = step.getUri(); Map<String, Object> properties = step.getProperties(); if (!Strings.isEmpty(uri)) { if (ObjectHelper.isNotEmpty(properties)) { try { uri = URISupport.appendParametersToURI(uri, properties); } catch (UnsupportedEncodingException|URISyntaxException e) { throw ObjectHelper.wrapRuntimeCamelException(e); } } } return uri; }
@Override public String createEndpointUri(String scheme, Map<String, String> options) throws URISyntaxException { // FIXME: SpringBootAutoConfigurationMojo MUST not ignore connectorOptions brokerUrl = options.remove("brokerUrl"); username = options.remove("username"); password = options.remove("password"); // validate url if (ObjectHelper.isEmpty(this.brokerUrl)) { throw new IllegalArgumentException("Missing required property brokerUrl"); } // create ActiveMQ Connection Factory ActiveMQConnectionFactory connectionFactory = ObjectHelper.isEmpty(username) ? new ActiveMQConnectionFactory(this.brokerUrl) : new ActiveMQConnectionFactory(username, password, this.brokerUrl); Sjms2Component delegate = getCamelContext().getComponent(getComponentName() + "-component", Sjms2Component.class); delegate.setConnectionFactory(connectionFactory); return super.createEndpointUri(scheme, options); }
@Lazy @Bean(name = "salesforce-delete-sobject-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public SalesforceDeleteSObjectComponent configureSalesforceDeleteSObjectComponent() throws Exception { SalesforceDeleteSObjectComponent connector = new SalesforceDeleteSObjectComponent(); 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<SalesforceDeleteSObjectComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator .evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-delete-sobject.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator .evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-delete-sobject.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@Lazy @Bean(name = "salesforce-upsert-sobject-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public SalesforceUpsertSObjectComponent configureSalesforceUpsertSObjectComponent() throws Exception { SalesforceUpsertSObjectComponent connector = new SalesforceUpsertSObjectComponent(); 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<SalesforceUpsertSObjectComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator .evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-upsert-sobject.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator .evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-upsert-sobject.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@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; }
@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; }
@Lazy @Bean(name = "day-trade-place-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public DayTradePlaceComponent configureDayTradePlaceComponent() throws Exception { DayTradePlaceComponent connector = new DayTradePlaceComponent(); 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<DayTradePlaceComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.day-trade-place.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.day-trade-place.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@Lazy @Bean(name = "trade-insight-top-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public TradeInsightTopComponent configureTradeInsightTopComponent() throws Exception { TradeInsightTopComponent connector = new TradeInsightTopComponent(); 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<TradeInsightTopComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.trade-insight-top.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.trade-insight-top.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@Lazy @Bean(name = "http-post-connector-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public HttpPostComponent configureHttpPostComponent() throws Exception { HttpPostComponent connector = new HttpPostComponent(); 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<HttpPostComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator .evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.http-post-connector.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator .evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.http-post-connector.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@Lazy @Bean(name = "swagger-operation-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public SwaggerConnectorComponent configureSwaggerConnectorComponent() throws Exception { SwaggerConnectorComponent connector = new SwaggerConnectorComponent(); 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<SwaggerConnectorComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.swagger-operation.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.swagger-operation.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@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; }
@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; }
@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; }
@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; }
@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; }
@Override public String createEndpointUri(String scheme, Map<String, String> options) throws URISyntaxException { // validate url if (ObjectHelper.isEmpty(this.brokerUrl)) { throw new IllegalArgumentException("Missing required property brokerUrl"); } // create ActiveMQ Connection Factory final ActiveMQConnectionFactory connectionFactory = ActiveMQUtil.createActiveMQConnectionFactory(this.brokerUrl, username, this.password, this.brokerCertificate, clientCertificate, skipCertificateCheck); SjmsComponent delegate = getCamelContext().getComponent(scheme, SjmsComponent.class); delegate.setConnectionFactory(connectionFactory); return super.createEndpointUri(scheme, options); }
@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; }
@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; }
@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; }
@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; }
@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; }
@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; }
@Lazy @Bean(name = "salesforce-create-sobject-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public SalesforceCreateSObjectComponent configureSalesforceCreateSObjectComponent() throws Exception { SalesforceCreateSObjectComponent connector = new SalesforceCreateSObjectComponent(); 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<SalesforceCreateSObjectComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator .evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-create-sobject.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator .evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-create-sobject.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@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; }
@Lazy @Bean(name = "twitter-mention-connector-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public TwitterMentionComponent configureTwitterMentionComponent() throws Exception { TwitterMentionComponent connector = new TwitterMentionComponent(); 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<TwitterMentionComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator .evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.twitter-mention-connector.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator .evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.twitter-mention-connector.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@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; }
@Lazy @Bean(name = "salesforce-delete-sobject-with-id-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public SalesforceDeleteSObjectWithIdComponent configureSalesforceDeleteSObjectWithIdComponent() throws Exception { SalesforceDeleteSObjectWithIdComponent connector = new SalesforceDeleteSObjectWithIdComponent(); 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<SalesforceDeleteSObjectWithIdComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator .evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-delete-sobject-with-id.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator .evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-delete-sobject-with-id.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }
@Override public 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 route; } 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() .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 route.to(uri); }
@Lazy @Bean(name = "salesforce-on-create-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean public SalesforceOnCreateComponent configureSalesforceOnCreateComponent() throws Exception { SalesforceOnCreateComponent connector = new SalesforceOnCreateComponent(); 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<SalesforceOnCreateComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator .evaluate( applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-on-create.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator .evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.salesforce-on-create.customizer"); if (useCustomizer) { LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer); customizer.customize(connector); } } } return connector; }