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 2009/02/27 13:31:55 UTC
svn commit: r748495 - in
/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc:
JdbcConstants.java JdbcProducer.java
Author: davsclaus
Date: Fri Feb 27 12:31:54 2009
New Revision: 748495
URL: http://svn.apache.org/viewvc?rev=748495&view=rev
Log:
CAMEL-1373: CamelCase
Added:
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcConstants.java (with props)
Modified:
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
Added: camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcConstants.java?rev=748495&view=auto
==============================================================================
--- camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcConstants.java (added)
+++ camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcConstants.java Fri Feb 27 12:31:54 2009
@@ -0,0 +1,31 @@
+/**
+ * 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;
+
+/**
+ * JDBC Constants
+ */
+public final class JdbcConstants {
+
+ public static final String JDBC_UPDATE_COUNT = "CamelJdbcUpdateCount";
+
+ public static final String JDBC_ROW_COUNT = "CamelJdbcRowCount";
+
+ private JdbcConstants() {
+ // Utility class
+ }
+}
Propchange: camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcConstants.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java?rev=748495&r1=748494&r2=748495&view=diff
==============================================================================
--- camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java (original)
+++ camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java Fri Feb 27 12:31:54 2009
@@ -24,12 +24,14 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.sql.DataSource;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultProducer;
import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -66,7 +68,7 @@
setResultSet(exchange, rs);
} else {
int updateCount = stmt.getUpdateCount();
- exchange.getOut().setHeader("jdbc.updateCount", updateCount);
+ exchange.getOut().setHeader(JdbcConstants.JDBC_UPDATE_COUNT, updateCount);
}
} finally {
try {
@@ -91,15 +93,11 @@
protected void setResultSet(Exchange exchange, ResultSet rs) throws SQLException {
ResultSetMetaData meta = rs.getMetaData();
- HashMap<String, Object> props = new HashMap<String, Object>();
- IntrospectionSupport.getProperties(meta, props, "jdbc.");
- exchange.getOut().setHeaders(props);
-
int count = meta.getColumnCount();
- List<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>();
+ List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
int rowNumber = 0;
while (rs.next() && (readSize == 0 || rowNumber < readSize)) {
- HashMap<String, Object> row = new HashMap<String, Object>();
+ Map<String, Object> row = new HashMap<String, Object>();
for (int i = 0; i < count; i++) {
int columnNumber = i + 1;
String columnName = meta.getColumnName(columnNumber);
@@ -108,7 +106,7 @@
data.add(row);
rowNumber++;
}
-
+ exchange.getOut().setHeader(JdbcConstants.JDBC_ROW_COUNT, rowNumber);
exchange.getOut().setBody(data);
}