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 2014/06/11 10:23:39 UTC
[1/2] git commit: Fix for CAMEL-7493,
Expose the component options for Camel JDBC
Repository: camel
Updated Branches:
refs/heads/master 29f61cab4 -> 686ff1f3d
Fix for CAMEL-7493, Expose the component options for Camel JDBC
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c2c90120
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c2c90120
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c2c90120
Branch: refs/heads/master
Commit: c2c90120b71e1a34ffe832d1e9e29f655247d30b
Parents: aa9e4ce
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Wed Jun 11 10:05:00 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Wed Jun 11 10:06:04 2014 +0200
----------------------------------------------------------------------
.../camel/component/jdbc/JdbcComponent.java | 7 +--
.../camel/component/jdbc/JdbcEndpoint.java | 11 ++++
...ponentConfigurationAndDocumentationTest.java | 56 ++++++++++++++++++++
3 files changed, 71 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c2c90120/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcComponent.java b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcComponent.java
index 211362d..663836b 100755
--- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcComponent.java
+++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcComponent.java
@@ -21,21 +21,22 @@ import javax.sql.DataSource;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.UriEndpointComponent;
import org.apache.camel.util.CamelContextHelper;
import org.apache.camel.util.IntrospectionSupport;
/**
* @version
*/
-public class JdbcComponent extends DefaultComponent {
+public class JdbcComponent extends UriEndpointComponent {
private DataSource ds;
public JdbcComponent() {
+ super(JdbcEndpoint.class);
}
public JdbcComponent(CamelContext context) {
- super(context);
+ super(context, JdbcEndpoint.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/c2c90120/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java
index f743928..5eeb987 100755
--- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java
+++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java
@@ -25,21 +25,32 @@ import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
/**
* @version
*/
+@UriEndpoint(scheme = "jdbc")
public class JdbcEndpoint extends DefaultEndpoint {
+ @UriParam
private int readSize;
+ @UriParam
private boolean transacted;
+ @UriParam
private boolean resetAutoCommit = true;
private DataSource dataSource;
private Map<String, Object> parameters;
+ @UriParam
private boolean useJDBC4ColumnNameAndLabelSemantics = true;
private JdbcPrepareStatementStrategy prepareStatementStrategy = new DefaultJdbcPrepareStatementStrategy();
+ @UriParam
private boolean allowNamedParameters = true;
+ @UriParam
private boolean useHeadersAsParameters;
+ @UriParam
private JdbcOutputType outputType = JdbcOutputType.SelectList;
+ @UriParam
private String outputClass;
private BeanRowMapper beanRowMapper = new DefaultBeanRowMapper();
http://git-wip-us.apache.org/repos/asf/camel/blob/c2c90120/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcComponentConfigurationAndDocumentationTest.java b/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..8033209
--- /dev/null
+++ b/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jdbc;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class JdbcComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testComponentConfiguration() throws Exception {
+ JdbcComponent comp = context.getComponent("jdbc", JdbcComponent.class);
+ EndpointConfiguration conf = comp.createConfiguration("jdbc:myDataSource?useHeadersAsParameters=true&readSize=100");
+
+ assertEquals("true", conf.getParameter("useHeadersAsParameters"));
+ assertEquals("100", conf.getParameter("readSize"));
+
+ ComponentConfiguration compConf = comp.createComponentConfiguration();
+ String json = compConf.createParameterJsonSchema();
+ assertNotNull(json);
+
+ assertTrue(json.contains("\"outputClass\": { \"type\": \"java.lang.String\" }"));
+ assertTrue(json.contains("\"allowNamedParameters\": { \"type\": \"boolean\" }"));
+ }
+
+ @Test
+ public void testComponentDocumentation() throws Exception {
+ CamelContext context = new DefaultCamelContext();
+ String html = context.getComponentDocumentation("jdbc");
+ assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+ }
+
+}
[2/2] git commit: Merge branch 'CAMEL-7493' of
https://github.com/kevinearls/camel
Posted by da...@apache.org.
Merge branch 'CAMEL-7493' of https://github.com/kevinearls/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/686ff1f3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/686ff1f3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/686ff1f3
Branch: refs/heads/master
Commit: 686ff1f3d069f02de23871556319d924e1479caf
Parents: 29f61ca c2c9012
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jun 11 10:23:28 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 11 10:23:28 2014 +0200
----------------------------------------------------------------------
.../camel/component/jdbc/JdbcComponent.java | 7 +--
.../camel/component/jdbc/JdbcEndpoint.java | 11 ++++
...ponentConfigurationAndDocumentationTest.java | 56 ++++++++++++++++++++
3 files changed, 71 insertions(+), 3 deletions(-)
----------------------------------------------------------------------