You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/02 23:16:17 UTC

[1/4] camel git commit: Fixed apt plugin to define char as string type in component schema docs

Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 4e4e9e59d -> 5e1300002
  refs/heads/master 622ccbb69 -> 7c52e786d


Fixed apt plugin to define char as string type in component schema docs


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

Branch: refs/heads/master
Commit: 409cc997711c964293d7967c53ff72d9410e4076
Parents: 622ccbb
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Jan 2 23:00:22 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jan 2 23:00:22 2016 +0100

----------------------------------------------------------------------
 .../tools/apt/helper/JsonSchemaHelper.java      | 31 ++++++--------------
 1 file changed, 9 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/409cc997/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
index c3fa7c7..686f8d6 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
@@ -162,36 +162,23 @@ public final class JsonSchemaHelper {
             return "array";
         } else if ("java.lang.String[]".equals(name) || "String[]".equals(name)) {
             return "array";
-            // and these is common as well
+        } else if ("java.lang.Character".equals(name) || "Character".equals(name) || "char".equals(name)) {
+            return "string";
         } else if ("java.lang.String".equals(name) || "String".equals(name)) {
             return "string";
-        } else if ("java.lang.Boolean".equals(name) || "Boolean".equals(name)) {
-            return "boolean";
-        } else if ("boolean".equals(name)) {
+        } else if ("java.lang.Boolean".equals(name) || "Boolean".equals(name) || "boolean".equals(name)) {
             return "boolean";
-        } else if ("java.lang.Integer".equals(name) || "Integer".equals(name)) {
-            return "integer";
-        } else if ("int".equals(name)) {
-            return "integer";
-        } else if ("java.lang.Long".equals(name) || "Long".equals(name)) {
+        } else if ("java.lang.Integer".equals(name) || "Integer".equals(name) || "int".equals(name)) {
             return "integer";
-        } else if ("long".equals(name)) {
+        } else if ("java.lang.Long".equals(name) || "Long".equals(name) || "long".equals(name)) {
             return "integer";
-        } else if ("java.lang.Short".equals(name) || "Short".equals(name)) {
+        } else if ("java.lang.Short".equals(name) || "Short".equals(name) || "short".equals(name)) {
             return "integer";
-        } else if ("short".equals(name)) {
+        } else if ("java.lang.Byte".equals(name) || "Byte".equals(name) || "byte".equals(name)) {
             return "integer";
-        } else if ("java.lang.Byte".equals(name) || "Byte".equals(name)) {
-            return "integer";
-        } else if ("byte".equals(name)) {
-            return "integer";
-        } else if ("java.lang.Float".equals(name) || "Float".equals(name)) {
-            return "number";
-        } else if ("float".equals(name)) {
-            return "number";
-        } else if ("java.lang.Double".equals(name) || "Double".equals(name)) {
+        } else if ("java.lang.Float".equals(name) || "Float".equals(name) || "float".equals(name)) {
             return "number";
-        } else if ("double".equals(name)) {
+        } else if ("java.lang.Double".equals(name) || "Double".equals(name) || "double".equals(name)) {
             return "number";
         }
 


[3/4] camel git commit: Fixed apt plugin to define char as string type in component schema docs

Posted by da...@apache.org.
Fixed apt plugin to define char as string type in component schema docs


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

Branch: refs/heads/camel-2.16.x
Commit: fbb31adc47b40284d76696c4c622881fb37cea65
Parents: 4e4e9e5
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Jan 2 23:00:22 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jan 2 23:15:59 2016 +0100

----------------------------------------------------------------------
 .../tools/apt/helper/JsonSchemaHelper.java      | 31 ++++++--------------
 1 file changed, 9 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fbb31adc/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
index c3fa7c7..686f8d6 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
@@ -162,36 +162,23 @@ public final class JsonSchemaHelper {
             return "array";
         } else if ("java.lang.String[]".equals(name) || "String[]".equals(name)) {
             return "array";
-            // and these is common as well
+        } else if ("java.lang.Character".equals(name) || "Character".equals(name) || "char".equals(name)) {
+            return "string";
         } else if ("java.lang.String".equals(name) || "String".equals(name)) {
             return "string";
-        } else if ("java.lang.Boolean".equals(name) || "Boolean".equals(name)) {
-            return "boolean";
-        } else if ("boolean".equals(name)) {
+        } else if ("java.lang.Boolean".equals(name) || "Boolean".equals(name) || "boolean".equals(name)) {
             return "boolean";
-        } else if ("java.lang.Integer".equals(name) || "Integer".equals(name)) {
-            return "integer";
-        } else if ("int".equals(name)) {
-            return "integer";
-        } else if ("java.lang.Long".equals(name) || "Long".equals(name)) {
+        } else if ("java.lang.Integer".equals(name) || "Integer".equals(name) || "int".equals(name)) {
             return "integer";
-        } else if ("long".equals(name)) {
+        } else if ("java.lang.Long".equals(name) || "Long".equals(name) || "long".equals(name)) {
             return "integer";
-        } else if ("java.lang.Short".equals(name) || "Short".equals(name)) {
+        } else if ("java.lang.Short".equals(name) || "Short".equals(name) || "short".equals(name)) {
             return "integer";
-        } else if ("short".equals(name)) {
+        } else if ("java.lang.Byte".equals(name) || "Byte".equals(name) || "byte".equals(name)) {
             return "integer";
-        } else if ("java.lang.Byte".equals(name) || "Byte".equals(name)) {
-            return "integer";
-        } else if ("byte".equals(name)) {
-            return "integer";
-        } else if ("java.lang.Float".equals(name) || "Float".equals(name)) {
-            return "number";
-        } else if ("float".equals(name)) {
-            return "number";
-        } else if ("java.lang.Double".equals(name) || "Double".equals(name)) {
+        } else if ("java.lang.Float".equals(name) || "Float".equals(name) || "float".equals(name)) {
             return "number";
-        } else if ("double".equals(name)) {
+        } else if ("java.lang.Double".equals(name) || "Double".equals(name) || "double".equals(name)) {
             return "number";
         }
 


[2/4] camel git commit: Component docs - fixed issue with sql not including all of them

Posted by da...@apache.org.
Component docs - fixed issue with sql not including all of them


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

Branch: refs/heads/master
Commit: 7c52e786d75fc322dfc0dfad20f28e56ceb4bebb
Parents: 409cc99
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Jan 2 23:12:49 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jan 2 23:14:36 2016 +0100

----------------------------------------------------------------------
 .../camel/component/sql/DefaultSqlEndpoint.java  | 19 +++++++++++++++++--
 .../apache/camel/component/sql/SqlComponent.java |  3 ++-
 .../camel/component/sql/SqlDataSourceTest.java   |  2 +-
 3 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7c52e786/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 0f7d4ce..67e8f23 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
@@ -85,7 +85,7 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
     private boolean alwaysPopulateStatement;
     @UriParam(defaultValue = ",",
             description = "The separator to use when parameter values is taken from message body (if the body is a String type), to be inserted at # placeholders."
-            + "Notice if you use named parameters, then a Map type is used instead. The default value is ,")
+            + "Notice if you use named parameters, then a Map type is used instead. The default value is comma")
     private char separator = ',';
     @UriParam(defaultValue = "SelectList", description = "Make the output of consumer or producer to SelectList as List of Map, or SelectOne as single Java object in the following way:"
             + "a) If the query has only single column, then that JDBC Column object is returned. (such as SELECT COUNT( * ) FROM PROJECT will return a Long object."
@@ -107,6 +107,9 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
     private String outputHeader;
     @UriParam(label = "producer", description = "Whether to use the message body as the SQL and then headers for parameters. If this option is enabled then the SQL in the uri is not used.")
     private boolean useMessageBodyForSql;
+    @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 = "#";
 
     public DefaultSqlEndpoint() {
     }
@@ -249,7 +252,7 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
      * The separator to use when parameter values is taken from message body (if the body is a String type), to be inserted at # placeholders.
      * Notice if you use named parameters, then a Map type is used instead.
      * <p/>
-     * The default value is ,
+     * The default value is comma.
      */
     public void setSeparator(char separator) {
         this.separator = separator;
@@ -400,6 +403,18 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
         this.breakBatchOnConsumeFail = breakBatchOnConsumeFail;
     }
 
+    public String getPlaceholder() {
+        return placeholder;
+    }
+
+    /**
+     * 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).
+     */
+    public void setPlaceholder(String placeholder) {
+        this.placeholder = placeholder;
+    }
+
     @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/7c52e786/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 7236392..0446520 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
@@ -75,7 +75,7 @@ public class SqlComponent extends UriEndpointComponent {
         }
 
         String parameterPlaceholderSubstitute = getAndRemoveParameter(parameters, "placeholder", String.class, "#");
-        
+
         JdbcTemplate jdbcTemplate = new JdbcTemplate(target);
         IntrospectionSupport.setProperties(jdbcTemplate, parameters, "template.");
 
@@ -104,6 +104,7 @@ public class SqlComponent extends UriEndpointComponent {
         }
 
         SqlEndpoint endpoint = new SqlEndpoint(uri, this, jdbcTemplate, query);
+        endpoint.setPlaceholder(parameterPlaceholderSubstitute);
         endpoint.setOnConsume(onConsume);
         endpoint.setOnConsumeFailed(onConsumeFailed);
         endpoint.setOnConsumeBatchComplete(onConsumeBatchComplete);

http://git-wip-us.apache.org/repos/asf/camel/blob/7c52e786/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
index 4ca67c1..6a08c24 100644
--- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
+++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
@@ -78,7 +78,7 @@ public class SqlDataSourceTest extends CamelTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:simple")
-                    .to("sql:select * from projects where license = # order by id?dataSource=dataSource")
+                    .to("sql:select * from projects where license = # order by id?dataSource=#dataSource")
                     .to("mock:result");
             }
         };


[4/4] camel git commit: Component docs - fixed issue with sql not including all of them

Posted by da...@apache.org.
Component docs - fixed issue with sql not including all of them


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

Branch: refs/heads/camel-2.16.x
Commit: 5e13000029d57913510e72d8f515d4e4eddc77ae
Parents: fbb31ad
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Jan 2 23:12:49 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jan 2 23:16:05 2016 +0100

----------------------------------------------------------------------
 .../camel/component/sql/DefaultSqlEndpoint.java  | 19 +++++++++++++++++--
 .../apache/camel/component/sql/SqlComponent.java |  3 ++-
 .../camel/component/sql/SqlDataSourceTest.java   |  2 +-
 3 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5e130000/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 0f7d4ce..67e8f23 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
@@ -85,7 +85,7 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
     private boolean alwaysPopulateStatement;
     @UriParam(defaultValue = ",",
             description = "The separator to use when parameter values is taken from message body (if the body is a String type), to be inserted at # placeholders."
-            + "Notice if you use named parameters, then a Map type is used instead. The default value is ,")
+            + "Notice if you use named parameters, then a Map type is used instead. The default value is comma")
     private char separator = ',';
     @UriParam(defaultValue = "SelectList", description = "Make the output of consumer or producer to SelectList as List of Map, or SelectOne as single Java object in the following way:"
             + "a) If the query has only single column, then that JDBC Column object is returned. (such as SELECT COUNT( * ) FROM PROJECT will return a Long object."
@@ -107,6 +107,9 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
     private String outputHeader;
     @UriParam(label = "producer", description = "Whether to use the message body as the SQL and then headers for parameters. If this option is enabled then the SQL in the uri is not used.")
     private boolean useMessageBodyForSql;
+    @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 = "#";
 
     public DefaultSqlEndpoint() {
     }
@@ -249,7 +252,7 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
      * The separator to use when parameter values is taken from message body (if the body is a String type), to be inserted at # placeholders.
      * Notice if you use named parameters, then a Map type is used instead.
      * <p/>
-     * The default value is ,
+     * The default value is comma.
      */
     public void setSeparator(char separator) {
         this.separator = separator;
@@ -400,6 +403,18 @@ public abstract class DefaultSqlEndpoint extends DefaultPollingEndpoint {
         this.breakBatchOnConsumeFail = breakBatchOnConsumeFail;
     }
 
+    public String getPlaceholder() {
+        return placeholder;
+    }
+
+    /**
+     * 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).
+     */
+    public void setPlaceholder(String placeholder) {
+        this.placeholder = placeholder;
+    }
+
     @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/5e130000/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 7236392..0446520 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
@@ -75,7 +75,7 @@ public class SqlComponent extends UriEndpointComponent {
         }
 
         String parameterPlaceholderSubstitute = getAndRemoveParameter(parameters, "placeholder", String.class, "#");
-        
+
         JdbcTemplate jdbcTemplate = new JdbcTemplate(target);
         IntrospectionSupport.setProperties(jdbcTemplate, parameters, "template.");
 
@@ -104,6 +104,7 @@ public class SqlComponent extends UriEndpointComponent {
         }
 
         SqlEndpoint endpoint = new SqlEndpoint(uri, this, jdbcTemplate, query);
+        endpoint.setPlaceholder(parameterPlaceholderSubstitute);
         endpoint.setOnConsume(onConsume);
         endpoint.setOnConsumeFailed(onConsumeFailed);
         endpoint.setOnConsumeBatchComplete(onConsumeBatchComplete);

http://git-wip-us.apache.org/repos/asf/camel/blob/5e130000/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
index 4ca67c1..6a08c24 100644
--- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
+++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlDataSourceTest.java
@@ -78,7 +78,7 @@ public class SqlDataSourceTest extends CamelTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:simple")
-                    .to("sql:select * from projects where license = # order by id?dataSource=dataSource")
+                    .to("sql:select * from projects where license = # order by id?dataSource=#dataSource")
                     .to("mock:result");
             }
         };