camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-9472: Add multi value to component docs
Date Tue, 05 Jan 2016 14:43:58 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x c769389b5 -> aea0bef84
  refs/heads/master f80881c01 -> 7e73e303a


CAMEL-9472: Add multi value to component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7e73e303
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7e73e303
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7e73e303

Branch: refs/heads/master
Commit: 7e73e303a713f4b763243b63726f950555a0755c
Parents: f80881c
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Jan 5 15:43:11 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Jan 5 15:43:11 2016 +0100

----------------------------------------------------------------------
 .../camel/component/sql/DefaultSqlEndpoint.java       | 14 ++++++++++++++
 .../org/apache/camel/component/sql/SqlComponent.java  |  4 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7e73e303/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java
b/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java
index 67e8f23..17fcb68 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/DefaultSqlEndpoint.java
@@ -110,6 +110,9 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint
{
     @UriParam(label = "advanced", defaultValue = "#", description = "Specifies a character
that will be replaced to ? in SQL query."
             + " Notice, that it is simple String.replaceAll() operation and no SQL parsing
is involved (quoted strings will also change).")
     private String placeholder = "#";
+    @UriParam(label = "advanced", prefix = "template.", multiValue = true,
+            description = "Configures the Spring JdbcTemplate with the key/values from the
Map")
+    private Map<String, Object> templateOptions;
 
     public DefaultSqlEndpoint() {
     }
@@ -415,6 +418,17 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint
{
         this.placeholder = placeholder;
     }
 
+    public Map<String, Object> getTemplateOptions() {
+        return templateOptions;
+    }
+
+    /**
+     * Configures the Spring JdbcTemplate with the key/values from the Map
+     */
+    public void setTemplateOptions(Map<String, Object> templateOptions) {
+        this.templateOptions = templateOptions;
+    }
+
     @SuppressWarnings("unchecked")
     public List<?> queryForList(ResultSet rs, boolean allowMapToClass) throws SQLException
{
         if (allowMapToClass && outputClass != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/7e73e303/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
b/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
index 0446520..460b4f3 100755
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
@@ -77,7 +77,8 @@ public class SqlComponent extends UriEndpointComponent {
         String parameterPlaceholderSubstitute = getAndRemoveParameter(parameters, "placeholder",
String.class, "#");
 
         JdbcTemplate jdbcTemplate = new JdbcTemplate(target);
-        IntrospectionSupport.setProperties(jdbcTemplate, parameters, "template.");
+        Map<String, Object> templateOptions = IntrospectionSupport.extractProperties(parameters,
"template.");
+        IntrospectionSupport.setProperties(jdbcTemplate, templateOptions);
 
         String query = remaining.replaceAll(parameterPlaceholderSubstitute, "?");
 
@@ -110,6 +111,7 @@ public class SqlComponent extends UriEndpointComponent {
         endpoint.setOnConsumeBatchComplete(onConsumeBatchComplete);
         endpoint.setDataSource(ds);
         endpoint.setDataSourceRef(dataSourceRef);
+        endpoint.setTemplateOptions(templateOptions);
         return endpoint;
     }
 


Mime
View raw message