User: lqd
Date: 02/03/04 15:35:08
Modified:src/main/org/jboss/pool/jdbc Tag: Branch_2_4
JDBCConnectionFactory.java JDBCPoolDataSource.java
Log:
- more changes from proprietary PrintWriter logging to log4j
- no more NPE at startup
Revision ChangesPath
No revision
No revision
1.1.1.1.2.2 +231 -167
jbosspool/src/main/org/jboss/pool/jdbc/Attic/JDBCConnectionFactory.java
Index: JDBCConnectionFactory.java
===
RCS file:
/cvsroot/jboss/jbosspool/src/main/org/jboss/pool/jdbc/Attic/JDBCConnectionFactory.java,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2
--- JDBCConnectionFactory.java27 Feb 2002 08:14:03 - 1.1.1.1.2.1
+++ JDBCConnectionFactory.java4 Mar 2002 23:35:08 - 1.1.1.1.2.2
@@ -3,13 +3,15 @@
*/
package org.jboss.pool.jdbc;
-import java.io.PrintWriter;
import java.sql.*;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import org.jboss.pool.cache.ObjectCache;
-import org.jboss.pool.*;
+import org.jboss.pool.ObjectPool;
+import org.jboss.pool.PoolObjectFactory;
+
+import org.jboss.logging.Logger;
/**
* Object factory that creates java.sql.Connections. This is meant for use
@@ -20,169 +22,231 @@
*
* @author Aaron Mulder ([EMAIL PROTECTED])
*/
-public class JDBCConnectionFactory extends PoolObjectFactory {
-private String url;
-private Properties props;
-private String userName;
-private String password;
-private PrintWriter log;
-private int psCacheSize = 10;
-private ObjectPool pool;
-
-/**
- * Creates a new factory. You must configure it with JDBC properties
- * before you can use it.
- */
-public JDBCConnectionFactory() {
-}
-
-/**
- * Sets the JDBC URL used to create new connections.
- */
-public void setConnectURL(String url) {this.url = url;}
-
-/**
- * Gets the JDBC URL used to create new connections.
- */
-public String getConnectURL() {return url;}
-
-/**
- * Sets the JDBC Propeties used to create new connections.
- * This is optional, and will only be used if present.
- */
-public void setConnectProperties(Properties props) {this.props = props;}
-
-/**
- * Gets the JDBC Properties used to create new connections.
- */
-public Properties getConnectProperties() {return props;}
-
-/**
- * Sets the JDBC user name used to create new connections.
- * This is optional, and will only be used if present.
- */
-public void setUser(String userName) {this.userName = userName;}
-
-/**
- * Gets the JDBC user name used to create new connections.
- */
-public String getUser() {return userName;}
-
-/**
- * Sets the JDBC password used to create new connections.
- * This is optional, and will only be used if present.
- */
-public void setPassword(String password) {this.password = password;}
-
-/**
- * Gets the JDBC password used to create new connections.
- */
-public String getPassword() {return password;}
-
-/**
- * Sets the number of PreparedStatements to be cached for each
- * Connection. Your DB product may impose a limit on the number
- * of open PreparedStatements. The default value is 10.
- */
-public void setPSCacheSize(int size) {
-psCacheSize = size;
-}
-
-/**
- * Gets the number of PreparedStatements to be cached for each
- * Connection. The default value is 10.
- */
-public int getPSCacheSize() {
-return psCacheSize;
-}
-
-/**
- * Validates that connection properties were set (at least a URL).
- */
-public void poolStarted(ObjectPool pool, PrintWriter log) {
-super.poolStarted(pool);
-if(url == null)
-throw new IllegalStateException(Must specify JDBC connection URL to
+getClass().getName());
-this.pool = pool;
-}
-
-/**
- * Cleans up.
- */
-public void poolClosing(ObjectPool pool) {
-super.poolClosing(pool);
-this.pool = null;
-log = null;
-}
-
-/**
- * Creates a new JDBC Connection.
- */
-public Object createObject(Object parameters) {
-try {
-if(userName != null userName.length() 0)
-return DriverManager.getConnection(url, userName, password);
-else if(props != null)
-return DriverManager.getConnection(url, props);
-else
-return