Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"properties": {
"driver": { "kind": "path", "displayName": "Driver", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "PLC4X connection string for the connection to the target" },
"autoReconnect": { "kind": "parameter", "displayName": "Auto Reconnect", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to reconnect when no connection is present upon doing a request" },
"tags": { "kind": "parameter", "displayName": "Tags", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The tags to read as Map containing the tag name associated to its query" },
"period": { "kind": "parameter", "displayName": "Period", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Interval on which the Trigger should be checked" },
"tags": { "kind": "parameter", "displayName": "Tags", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "prefix": "tag.", "multiValue": true, "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Tags as key\/values from the Map to use in query" },
"trigger": { "kind": "parameter", "displayName": "Trigger", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Query to a trigger. On a rising edge of the trigger, the tags will be read once" },
"bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." },
"autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." },
"rowMapperFactory": { "kind": "property", "displayName": "Row Mapper Factory", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.sql.RowMapperFactory", "deprecated": false, "autowired": true, "secret": false, "description": "Factory for creating RowMapper" },
"usePlaceholder": { "kind": "property", "displayName": "Use Placeholder", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use placeholder and replace all placeholder characters with sign in the SQL queries. This option is default true" }
},
"headers": {
Expand Down
6 changes: 6 additions & 0 deletions components-starter/camel-sql-starter/src/main/docs/sql.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
"sourceType": "org.apache.camel.component.sql.springboot.SqlComponentConfiguration",
"defaultValue": false
},
{
"name": "camel.component.sql.row-mapper-factory",
"type": "org.apache.camel.component.sql.RowMapperFactory",
"description": "Factory for creating RowMapper. The option is a org.apache.camel.component.sql.RowMapperFactory type.",
"sourceType": "org.apache.camel.component.sql.springboot.SqlComponentConfiguration"
},
{
"name": "camel.component.sql.use-placeholder",
"type": "java.lang.Boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.camel.component.sql.springboot;

import javax.sql.DataSource;
import org.apache.camel.component.sql.RowMapperFactory;
import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
import org.springframework.boot.context.properties.ConfigurationProperties;

Expand Down Expand Up @@ -69,6 +70,11 @@ public class SqlComponentConfiguration
* etc.
*/
private Boolean autowiredEnabled = true;
/**
* Factory for creating RowMapper. The option is a
* org.apache.camel.component.sql.RowMapperFactory type.
*/
private RowMapperFactory rowMapperFactory;
/**
* Sets whether to use placeholder and replace all placeholder characters
* with sign in the SQL queries. This option is default true
Expand Down Expand Up @@ -107,6 +113,14 @@ public void setAutowiredEnabled(Boolean autowiredEnabled) {
this.autowiredEnabled = autowiredEnabled;
}

public RowMapperFactory getRowMapperFactory() {
return rowMapperFactory;
}

public void setRowMapperFactory(RowMapperFactory rowMapperFactory) {
this.rowMapperFactory = rowMapperFactory;
}

public Boolean getUsePlaceholder() {
return usePlaceholder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class SqlComponentConverter implements GenericConverter {
public Set<ConvertiblePair> getConvertibleTypes() {
Set<ConvertiblePair> answer = new LinkedHashSet<>();
answer.add(new ConvertiblePair(String.class, javax.sql.DataSource.class));
answer.add(new ConvertiblePair(String.class, org.apache.camel.component.sql.RowMapperFactory.class));
return answer;
}

Expand All @@ -57,6 +58,7 @@ public Object convert(
ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1);
switch (targetType.getName()) {
case "javax.sql.DataSource": return applicationContext.getBean(ref, javax.sql.DataSource.class);
case "org.apache.camel.component.sql.RowMapperFactory": return applicationContext.getBean(ref, org.apache.camel.component.sql.RowMapperFactory.class);
}
return null;
}
Expand Down