Author: wspeirs
Date: Tue Feb 26 20:12:32 2013
New Revision: 1450388

URL: http://svn.apache.org/r1450388
Log:
Removed AbstractQueryRunner as it's no longer needed
- Added license to the tops of some files it was missing from

Removed:
    
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
Modified:
    
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/BatchExecutor.java
    
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/QueryRunner.java
    
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/UpdateExecutor.java

Modified: 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/BatchExecutor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/BatchExecutor.java?rev=1450388&r1=1450387&r2=1450388&view=diff
==============================================================================
--- 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/BatchExecutor.java
 (original)
+++ 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/BatchExecutor.java
 Tue Feb 26 20:12:32 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.commons.dbutils;
 
 import java.sql.Connection;

Modified: 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/QueryRunner.java
URL: 
http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/QueryRunner.java?rev=1450388&r1=1450387&r2=1450388&view=diff
==============================================================================
--- 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/QueryRunner.java
 (original)
+++ 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/QueryRunner.java
 Tue Feb 26 20:12:32 2013
@@ -26,13 +26,17 @@ import javax.sql.DataSource;
  *
  * @see ResultSetHandler
  */
-public class QueryRunner extends AbstractQueryRunner {
+public class QueryRunner {
+    /**
+     * The DataSource to retrieve connections from.
+     */
+    private final DataSource ds;
 
     /**
      * Constructor for QueryRunner.
      */
     public QueryRunner() {
-        super();
+        ds = null;
     }
 
     /**
@@ -43,8 +47,50 @@ public class QueryRunner extends Abstrac
      *
      * @param ds The <code>DataSource</code> to retrieve connections from.
      */
-    public QueryRunner(DataSource ds) {
-        super(ds);
+    public QueryRunner(final DataSource ds) {
+        this.ds = ds;
+    }
+    
+    /**
+     * Returns the <code>DataSource</code> this runner is using.
+     * <code>QueryRunner</code> methods always call this method to get the
+     * <code>DataSource</code> so subclasses can provide specialized behavior.
+     *
+     * @return DataSource the runner is using
+     */
+    public DataSource getDataSource() {
+        return this.ds;
+    }
+
+    /**
+     * Factory method that creates and initializes a <code>Connection</code>
+     * object. <code>QueryRunner</code> methods always call this method to
+     * retrieve connections from its DataSource. Subclasses can override this
+     * method to provide special <code>Connection</code> configuration if
+     * needed. This implementation simply calls 
<code>ds.getConnection()</code>.
+     *
+     * @return An initialized <code>Connection</code>.
+     * @throws SQLException if a database access error occurs
+     */
+    protected Connection prepareConnection() throws SQLException {
+        if (this.getDataSource() == null) {
+            throw new SQLException(
+                    "QueryRunner requires a DataSource to be "
+                    + "invoked in this way, or a Connection should be passed 
in");
+        }
+        return this.getDataSource().getConnection();
+    }
+
+    /**
+     * Close a <code>Connection</code>. This implementation avoids closing if
+     * null and does <strong>not</strong> suppress any exceptions. Subclasses
+     * can override to provide special handling like logging.
+     *
+     * @param conn Connection to close
+     * @throws SQLException if a database access error occurs
+     */
+    private void close(Connection conn) throws SQLException {
+        DbUtils.close(conn);
     }
 
     /**

Modified: 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/UpdateExecutor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/UpdateExecutor.java?rev=1450388&r1=1450387&r2=1450388&view=diff
==============================================================================
--- 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/UpdateExecutor.java
 (original)
+++ 
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/UpdateExecutor.java
 Tue Feb 26 20:12:32 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.commons.dbutils;
 
 import java.sql.Connection;


Reply via email to