commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jdbc2pool default.properties
Date Fri, 05 Jul 2002 08:23:05 GMT
mpoeschl    2002/07/05 01:23:05

  Modified:    jdbc2pool/src/java/org/apache/commons/jdbc2pool
                        TorqueClassicDataSource.java
                        Jdbc2PoolDataSource.java
               jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter
                        PoolablePreparedStatementStub.java
               jdbc2pool default.properties
  Log:
  use latest version of commons-lang and commons-dbcp
  
  Revision  Changes    Path
  1.5       +138 -188  jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/TorqueClassicDataSource.java
  
  Index: TorqueClassicDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/TorqueClassicDataSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TorqueClassicDataSource.java	21 May 2002 19:43:28 -0000	1.4
  +++ TorqueClassicDataSource.java	5 Jul 2002 08:23:04 -0000	1.5
  @@ -25,13 +25,13 @@
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and 
  - *    "Apache Turbine" must not be used to endorse or promote products 
  - *    derived from this software without prior written permission. For 
  + * 4. The names "Apache" and "Apache Software Foundation" and
  + *    "Apache Turbine" must not be used to endorse or promote products
  + *    derived from this software without prior written permission. For
    *    written permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", nor may "Apache" appear in their name, without 
  + *    "Apache Turbine", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  @@ -53,7 +53,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  - 
  +
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  @@ -80,7 +80,7 @@
   import javax.naming.NamingException;
   import javax.naming.spi.ObjectFactory;
   
  -import org.apache.commons.lang.Objects;
  +import org.apache.commons.lang.Serialization;
   
   /**
    * Torque's default connection pool DataSource
  @@ -92,7 +92,7 @@
       implements DataSource, Referenceable, Serializable, ObjectFactory
   {
       /** Pools keyed by username. */
  -    private static Map pools = new HashMap(); 
  +    private static Map pools = new HashMap();
   
       /** DataSource Name used to find the ConnectionPoolDataSource */
       private String dataSourceName;
  @@ -121,13 +121,13 @@
       /**
        * Default no-arg constructor for Serialization
        */
  -    public TorqueClassicDataSource() 
  +    public TorqueClassicDataSource()
       {
           defaultAutoCommit = true;
       }
   
       // Properties
  -        
  +
       /**
        * Get the number of database connections to cache per user.
        * This value is used for any username which is not specified
  @@ -135,11 +135,11 @@
        *
        * @return value of maxConnections.
        */
  -    public int getDefaultMaxConnections() 
  +    public int getDefaultMaxConnections()
       {
           return defaultMaxConnections;
       }
  -    
  +
       /**
        * Set the number of database connections to cache per user.
        * This value is used for any username which is not specified
  @@ -147,12 +147,12 @@
        *
        * @param v  Value to assign to maxConnections.
        */
  -    public void setDefaultMaxConnections(int  v) 
  +    public void setDefaultMaxConnections(int  v)
       {
           this.defaultMaxConnections = v;
       }
  -    
  -    
  +
  +
       /**
        * Get the number of database connections to cache per user.  The keys
        * are usernames and the value is the maximum connections.  Any username
  @@ -160,59 +160,59 @@
        *
        * @return value of perUserMaxConnections.
        */
  -    public Properties getPerUserMaxConnections() 
  +    public Properties getPerUserMaxConnections()
       {
           return perUserMaxConnections;
       }
  -    
  +
       /**
        * Set the number of database connections to cache per user.  The keys
        * are usernames and the value is the maximum connections.  Any username
        * specified here will override the value of defaultMaxConnections.
  -     * 
  +     *
        * @param v  Value to assign to perUserMaxConnections.
        */
  -    public void setPerUserMaxConnections(Properties  v) 
  +    public void setPerUserMaxConnections(Properties  v)
       {
           this.perUserMaxConnections = v;
       }
  -    
  -    
  +
  +
       /**
  -     * Get the amount of time (in seconds) that database connections 
  +     * Get the amount of time (in seconds) that database connections
        * will be cached.  The default is 3600 (1 hour).
  -     * 
  +     *
        * @return value of expiryTime.
        */
  -    public int getMaxExpiryTime() 
  +    public int getMaxExpiryTime()
       {
           return maxExpiryTime;
       }
  -    
  +
       /**
  -     * Set the amount of time (in seconds) that database connections 
  +     * Set the amount of time (in seconds) that database connections
        * will be cached.  The default is 3600 (1 hour).
        *
        * @param v  Value to assign to expiryTime.
        */
  -    public void setMaxExpiryTime(int  v) 
  +    public void setMaxExpiryTime(int  v)
       {
           this.maxExpiryTime = v;
       }
  -    
  -    
  +
  +
       /**
  -     * Get the amount of time (in seconds) a connection request will  
  +     * Get the amount of time (in seconds) a connection request will
        * have to wait before a time out occurs and an error is thrown.
        * The default is 10 seconds.
        *
        * @return value of connectionWaitTimeout.
        */
  -    public int getConnectionWaitTimeout() 
  +    public int getConnectionWaitTimeout()
       {
           return connectionWaitTimeout;
       }
  -    
  +
       /**
        * Eet the amount of time (in seconds) a connection request will
        * have to wait before a time out occurs and an error is thrown.
  @@ -220,113 +220,113 @@
        *
        * @param v  Value to assign to connectionWaitTimeout.
        */
  -    public void setConnectionWaitTimeout(int  v) 
  +    public void setConnectionWaitTimeout(int  v)
       {
           this.connectionWaitTimeout = v;
       }
  -    
  -    
  +
  +
       /**
  -     * Get the interval (in seconds) between which the ConnectionPool logs 
  -     * the status of it's Connections. Default is 0 which indicates no 
  +     * Get the interval (in seconds) between which the ConnectionPool logs
  +     * the status of it's Connections. Default is 0 which indicates no
        * logging.
        *
        * @return value of logInterval.
        */
  -    public int getLogInterval() 
  +    public int getLogInterval()
       {
           return logInterval;
       }
  -    
  +
       /**
  -     * Set the interval (in seconds) between which the ConnectionPool logs 
  -     * the status of it's Connections. Default is 0 which indicates no 
  +     * Set the interval (in seconds) between which the ConnectionPool logs
  +     * the status of it's Connections. Default is 0 which indicates no
        * logging.
        *
        * @param v  Value to assign to logInterval.
        */
  -    public void setLogInterval(int  v) 
  +    public void setLogInterval(int  v)
       {
           this.logInterval = v;
       }
  -    
  -    /** 
  -     * Get the value of defaultAutoCommit, which defines the state of 
  +
  +    /**
  +     * Get the value of defaultAutoCommit, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setAutoCommit(boolean).
        * The default is true.
        *
        * @return value of defaultAutoCommit.
        */
  -    public boolean isDefaultAutoCommit() 
  +    public boolean isDefaultAutoCommit()
       {
           return defaultAutoCommit;
       }
  -    
  +
       /**
  -     * Set the value of defaultAutoCommit, which defines the state of 
  +     * Set the value of defaultAutoCommit, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setAutoCommit(boolean).
        * The default is true.
        *
        * @param v  Value to assign to defaultAutoCommit.
        */
  -    public void setDefaultAutoCommit(boolean  v) 
  +    public void setDefaultAutoCommit(boolean  v)
       {
           this.defaultAutoCommit = v;
       }
  -        
  +
       /**
  -     * Get the value of defaultReadOnly, which defines the state of 
  +     * Get the value of defaultReadOnly, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setReadOnly(boolean).
        * The default is false.
        *
        * @return value of defaultReadOnly.
        */
  -    public boolean isDefaultReadOnly() 
  +    public boolean isDefaultReadOnly()
       {
           return defaultReadOnly;
       }
  -    
  +
       /**
  -     * Set the value of defaultReadOnly, which defines the state of 
  +     * Set the value of defaultReadOnly, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setReadOnly(boolean).
        * The default is false.
        *
        * @param v  Value to assign to defaultReadOnly.
        */
  -    public void setDefaultReadOnly(boolean  v) 
  +    public void setDefaultReadOnly(boolean  v)
       {
           this.defaultReadOnly = v;
       }
  -    
  +
       /**
        * Get the name of the ConnectionPoolDataSource which backs this pool.
  -     * This name is used to look up the datasource from a jndi service 
  +     * This name is used to look up the datasource from a jndi service
        * provider.
        *
        * @return value of dataSourceName.
        */
  -    public String getDataSourceName() 
  +    public String getDataSourceName()
       {
           return dataSourceName;
       }
  -    
  +
       /**
        * Set the name of the ConnectionPoolDataSource which backs this pool.
  -     * This name is used to look up the datasource from a jndi service 
  +     * This name is used to look up the datasource from a jndi service
        * provider.
        *
        * @param v  Value to assign to dataSourceName.
        */
  -    public void setDataSourceName(String  v) 
  +    public void setDataSourceName(String  v)
       {
           this.dataSourceName = v;
       }
  -    
  -    
  +
  +
       /**
        * Get the description.  This property is defined by jdbc as for use with
        * GUI (or other) tools that might deploy the datasource.  It serves no
  @@ -334,19 +334,19 @@
        *
        * @return value of description.
        */
  -    public String getDescription() 
  +    public String getDescription()
       {
           return description;
       }
  -    
  +
       /**
        * Set the description.  This property is defined by jdbc as for use with
        * GUI (or other) tools that might deploy the datasource.  It serves no
        * internal purpose.
  -     * 
  +     *
        * @param v  Value to assign to description.
        */
  -    public void setDescription(String  v) 
  +    public void setDescription(String  v)
       {
           this.description = v;
       }
  @@ -359,16 +359,16 @@
        *
        * @return value of jndiEnvironment.
        */
  -    public String getJndiEnvironment(String key) 
  +    public String getJndiEnvironment(String key)
       {
           String value = null;
  -        if (jndiEnvironment != null) 
  +        if (jndiEnvironment != null)
           {
               value = jndiEnvironment.getProperty(key);
           }
           return value;
       }
  -    
  +
       /**
        * Set the value of jndiEnvironment which is used when instantiating
        * a jndi InitialContext.  This InitialContext is used to locate the
  @@ -376,58 +376,58 @@
        *
        * @param v  Value to assign to jndiEnvironment.
        */
  -    public void setJndiEnvironment(String key, String value) 
  +    public void setJndiEnvironment(String key, String value)
       {
  -        if (jndiEnvironment == null) 
  +        if (jndiEnvironment == null)
           {
               jndiEnvironment = new Properties();
           }
           jndiEnvironment.setProperty(key, value);
       }
   
  -    
  +
       /**
        * Get the value of connectionPoolDataSource.  This method will return
        * null, if the backing datasource is being accessed via jndi.
        *
        * @return value of connectionPoolDataSource.
        */
  -    public ConnectionPoolDataSource getConnectionPoolDataSource() 
  +    public ConnectionPoolDataSource getConnectionPoolDataSource()
       {
           return cpds;
       }
  -    
  +
       /**
        * Set the backend ConnectionPoolDataSource.  This property should not be
        * set if using jndi to access the datasource.
        *
        * @param v  Value to assign to connectionPoolDataSource.
        */
  -    public void setConnectionPoolDataSource(ConnectionPoolDataSource  v) 
  +    public void setConnectionPoolDataSource(ConnectionPoolDataSource  v)
       {
           this.cpds = v;
       }
  -    
  +
   
       /**
        * Attempt to establish a database connection.
        */
  -    public Connection getConnection() 
  +    public Connection getConnection()
           throws SQLException
       {
           return getConnection(null, null);
       }
  -                     
  +
       /**
        * Attempt to establish a database connection.
        */
  -    synchronized public Connection getConnection(String username, 
  +    synchronized public Connection getConnection(String username,
                                                    String password)
           throws SQLException
       {
           String key = getKey(username);
           ConnectionPool pool = (ConnectionPool)pools.get(key);
  -        if ( pool == null ) 
  +        if ( pool == null )
           {
               try
               {
  @@ -440,7 +440,7 @@
               }
           }
   
  -        Connection con = 
  +        Connection con =
               pool.getConnection(username, password).getConnection();
           con.setAutoCommit(defaultAutoCommit);
           con.setReadOnly(defaultReadOnly);
  @@ -450,9 +450,9 @@
       private String getKey(String suffix)
       {
           String key = getDataSourceName();
  -        if ( suffix != null ) 
  +        if ( suffix != null )
           {
  -            key += suffix;            
  +            key += suffix;
           }
           return key;
       }
  @@ -461,17 +461,17 @@
            throws javax.naming.NamingException
       {
           String key = getKey(username);
  -        if ( !pools.containsKey(key) ) 
  +        if ( !pools.containsKey(key) )
           {
               ConnectionPoolDataSource cpds = this.cpds;
  -            if ( cpds == null ) 
  -            {            
  +            if ( cpds == null )
  +            {
                   Context ctx = null;
  -                if ( jndiEnvironment == null ) 
  +                if ( jndiEnvironment == null )
                   {
  -                    ctx = new InitialContext();                
  +                    ctx = new InitialContext();
                   }
  -                else 
  +                else
                   {
                       ctx = new InitialContext(jndiEnvironment);
                   }
  @@ -479,133 +479,117 @@
               }
   
               int maxConnections = getDefaultMaxConnections();
  -            if ( username != null ) 
  +            if ( username != null )
               {
  -                String userMaxCon = 
  +                String userMaxCon =
                       (String)getPerUserMaxConnections().get(username);
  -                if ( userMaxCon != null ) 
  +                if ( userMaxCon != null )
                   {
                       maxConnections = Integer.parseInt(userMaxCon);
                   }
  -            }    
  -        
  +            }
  +
               ConnectionPool pool = new ConnectionPool(cpds, username, password,
  -                maxConnections, maxExpiryTime, connectionWaitTimeout, 
  +                maxConnections, maxExpiryTime, connectionWaitTimeout,
                   logInterval, getLogWriter());
   
               // avoid ConcurrentModificationException
               Map newPools = new HashMap(pools);
               newPools.put(key, pool);
  -            pools = newPools;   
  -        }        
  +            pools = newPools;
  +        }
       }
  -    
  +
       /**
  -     * Gets the maximum time in seconds that this data source can wait 
  +     * Gets the maximum time in seconds that this data source can wait
        * while attempting to connect to a database.
        */
  -    public int getLoginTimeout() 
  +    public int getLoginTimeout()
       {
           return loginTimeout;
       }
  -                           
  +
       /**
        * Get the log writer for this data source.
        */
  -    public PrintWriter getLogWriter() 
  +    public PrintWriter getLogWriter()
       {
  -        if (logWriter == null) 
  +        if (logWriter == null)
           {
               logWriter = new PrintWriter(System.out);
  -        }        
  +        }
           return logWriter;
       }
  -                           
  +
       /**
  -     * Sets the maximum time in seconds that this data source will wait 
  +     * Sets the maximum time in seconds that this data source will wait
        * while attempting to connect to a database. NOT USED.
        */
       public void setLoginTimeout(int seconds)
       {
           loginTimeout = seconds;
  -    } 
  -                           
  +    }
  +
       /**
        * Set the log writer for this data source.
        */
       public void setLogWriter(java.io.PrintWriter out)
       {
           logWriter = out;
  -    } 
  +    }
   
       /**
        * <CODE>Referenceable</CODE> implementation.
        */
  -    public Reference getReference() 
  +    public Reference getReference()
           throws NamingException
       {
           String factory = getClass().getName();
  -        
  +
           Reference ref = new Reference(getClass().getName(), factory, null);
   
  -        ref.add(new StringRefAddr("defaultMaxConnections", 
  +        ref.add(new StringRefAddr("defaultMaxConnections",
                                     String.valueOf(getDefaultMaxConnections())));
  -        ref.add(new StringRefAddr("maxExpiryTime", 
  +        ref.add(new StringRefAddr("maxExpiryTime",
                                     String.valueOf(getMaxExpiryTime())));
  -        ref.add(new StringRefAddr("connectionWaitTimeout", 
  +        ref.add(new StringRefAddr("connectionWaitTimeout",
                                     String.valueOf(getConnectionWaitTimeout())));
  -        ref.add(new StringRefAddr("logInterval", 
  +        ref.add(new StringRefAddr("logInterval",
                                     String.valueOf(getLogInterval())));
           ref.add(new StringRefAddr("dataSourceName", getDataSourceName()));
           ref.add(new StringRefAddr("description", getDescription()));
   
           byte[] serJndiEnv = null;
           // BinaryRefAddr does not allow null byte[].
  -        if ( jndiEnvironment != null ) 
  +        if ( jndiEnvironment != null )
           {
  -            try
  -            {
  -                serJndiEnv = serialize(jndiEnvironment);
  -                ref.add(new BinaryRefAddr("jndiEnvironment", serJndiEnv));
  -            }
  -            catch (IOException ioe)
  -            {
  -                throw new NamingException("An IOException prevented " + 
  -                   "serializing the jndiEnvironment properties.");
  -            }
  +            serJndiEnv = Serialization.serialize(jndiEnvironment);
  +            ref.add(new BinaryRefAddr("jndiEnvironment", serJndiEnv));
           }
   
           byte[] serPUMC = null;
           // BinaryRefAddr does not allow null byte[].
  -        if ( getPerUserMaxConnections() != null ) 
  +        if ( getPerUserMaxConnections() != null )
           {
  -            try
  -            {
  -                serPUMC = serialize(getPerUserMaxConnections());
  -                ref.add(new BinaryRefAddr("perUserMaxConnections", serPUMC));
  -            }
  -            catch (IOException ioe)
  -            {
  -                throw new NamingException("An IOException prevented " + 
  -                   "serializing the perUserMaxConnections properties.");
  -            }
  +            serPUMC = Serialization.serialize(getPerUserMaxConnections());
  +            ref.add(new BinaryRefAddr("perUserMaxConnections", serPUMC));
           }
  -        
  +
           return ref;
       }
   
   
       /**
        * implements ObjectFactory to create an instance of this class
  -     */ 
  -    public Object getObjectInstance(Object refObj, Name name, 
  -                                    Context context, Hashtable env) 
  -        throws Exception 
  +     */
  +    public Object getObjectInstance(Object refObj, Name name,
  +                                    Context context, Hashtable env)
  +        throws Exception
       {
           Reference ref = (Reference)refObj;
  -	
  -        if (ref.getClassName().equals(getClass().getName())) 
  -        {   
  +
  +        if (ref.getClassName().equals(getClass().getName()))
  +        {
               setDefaultMaxConnections(Integer.parseInt(
                   (String)ref.get("defaultMaxConnections").getContent()));
               setMaxExpiryTime(Integer.parseInt(
  @@ -618,60 +602,26 @@
               setDescription((String)ref.get("description").getContent());
   
               RefAddr refAddr = ref.get("jndiEnvironment");
  -            if ( refAddr != null ) 
  +            if ( refAddr != null )
               {
                   byte[] serialized = (byte[])refAddr.getContent();
  -                jndiEnvironment = (Properties)Objects.deserialize(serialized);
  +                jndiEnvironment = (Properties)Serialization.deserialize(serialized);
               }
   
               refAddr = ref.get("perUserMaxConnections");
  -            if ( refAddr != null ) 
  +            if ( refAddr != null )
               {
                   byte[] serialized = (byte[])refAddr.getContent();
  -                setPerUserMaxConnections( 
  -                    (Properties)Objects.deserialize(serialized) );
  +                setPerUserMaxConnections(
  +                    (Properties)Serialization.deserialize(serialized) );
               }
  -            
  +
               return this;
           }
  -        else 
  -        { 
  +        else
  +        {
               // We can't create an instance of the reference
               return null;
           }
       }
  -
  -    /**
  -     * Converts a object to a byte array for storage/serialization.
  -     * FIXME! this method has been moved to commons.lang.Objects
  -     *
  -     * @param hash The Hashtable to convert.
  -     * @return A byte[] with the converted Hashtable.
  -     * @exception Exception, a generic exception.
  -     */
  -    private static byte[] serialize(Serializable obj)
  -        throws IOException
  -    {
  -        byte[] byteArray = null;
  -        ByteArrayOutputStream baos = null;
  -        ObjectOutputStream out = null;
  -        try
  -        {
  -            // These objects are closed in the finally.
  -            baos = new ByteArrayOutputStream();
  -            out = new ObjectOutputStream(baos);
  -
  -            out.writeObject(obj);
  -            byteArray = baos.toByteArray();
  -        }
  -        finally
  -        {
  -            if (out != null) 
  -            {
  -                out.close();
  -            }
  -        }
  -        return byteArray;
  -    }
  -
   }
  
  
  
  1.8       +238 -238  jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/Jdbc2PoolDataSource.java
  
  Index: Jdbc2PoolDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/Jdbc2PoolDataSource.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Jdbc2PoolDataSource.java	29 May 2002 02:12:25 -0000	1.7
  +++ Jdbc2PoolDataSource.java	5 Jul 2002 08:23:04 -0000	1.8
  @@ -25,13 +25,13 @@
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and 
  - *    "Apache Turbine" must not be used to endorse or promote products 
  - *    derived from this software without prior written permission. For 
  + * 4. The names "Apache" and "Apache Software Foundation" and
  + *    "Apache Turbine" must not be used to endorse or promote products
  + *    derived from this software without prior written permission. For
    *    written permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", nor may "Apache" appear in their name, without 
  + *    "Apache Turbine", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  @@ -53,7 +53,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  - 
  +
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  @@ -82,7 +82,7 @@
   import javax.naming.spi.ObjectFactory;
   
   import org.apache.commons.collections.FastHashMap;
  -import org.apache.commons.lang.Objects;
  +import org.apache.commons.lang.Serialization;
   import org.apache.commons.pool.ObjectPool;
   import org.apache.commons.pool.impl.GenericObjectPool;
   import org.apache.commons.pool.KeyedObjectPool;
  @@ -90,7 +90,7 @@
   import org.apache.commons.pool.impl.StackObjectPool;
   
   /**
  - * DataSource that pools PooledConnection's from a 
  + * DataSource that pools PooledConnection's from a
    * ConnectionPoolDataSource.
    *
    * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
  @@ -99,16 +99,16 @@
   public class Jdbc2PoolDataSource
       implements DataSource, Referenceable, Serializable, ObjectFactory
   {
  -    private static final String GET_CONNECTION_CALLED = 
  -        "A Connection was already requested from this source, " + 
  +    private static final String GET_CONNECTION_CALLED =
  +        "A Connection was already requested from this source, " +
           "further initialization is not allowed.";
   
       public static Map dsInstanceMap = new HashMap();
   
  -    private static ObjectPool userPassKeyPool = 
  +    private static ObjectPool userPassKeyPool =
           new StackObjectPool(new UserPassKey.Factory(), 256);
   
  -    private static ObjectPool poolKeyPool = 
  +    private static ObjectPool poolKeyPool =
           new StackObjectPool(new PoolKey.Factory(), 256);
   
       private boolean getConnectionCalled = false;
  @@ -129,11 +129,11 @@
       private int loginTimeout;
       /** Log stream */
       private PrintWriter logWriter;
  -    private Map perUserDefaultAutoCommit;    
  -    private Map perUserMaxActive;    
  -    private Map perUserMaxIdle;    
  +    private Map perUserDefaultAutoCommit;
  +    private Map perUserMaxActive;
  +    private Map perUserMaxIdle;
       private Map perUserMaxWait;
  -    private Map perUserDefaultReadOnly;    
  +    private Map perUserDefaultReadOnly;
       private boolean _testOnBorrow;
       private boolean _testOnReturn;
       private int _timeBetweenEvictionRunsMillis;
  @@ -148,7 +148,7 @@
       /**
        * Default no-arg constructor for Serialization
        */
  -    public Jdbc2PoolDataSource() 
  +    public Jdbc2PoolDataSource()
       {
           isNew = true;
           defaultAutoCommit = true;
  @@ -159,9 +159,9 @@
        * been requested.
        */
       private void assertInitializationAllowed()
  -        throws IllegalStateException 
  +        throws IllegalStateException
       {
  -        if (getConnectionCalled) 
  +        if (getConnectionCalled)
           {
               throw new IllegalStateException(GET_CONNECTION_CALLED);
           }
  @@ -176,27 +176,27 @@
        *
        * @return value of connectionPoolDataSource.
        */
  -    public ConnectionPoolDataSource getConnectionPoolDataSource() 
  +    public ConnectionPoolDataSource getConnectionPoolDataSource()
       {
           return cpds;
       }
  -    
  +
       /**
        * Set the backend ConnectionPoolDataSource.  This property should not be
        * set if using jndi to access the datasource.
        *
        * @param v  Value to assign to connectionPoolDataSource.
        */
  -    public void setConnectionPoolDataSource(ConnectionPoolDataSource  v) 
  +    public void setConnectionPoolDataSource(ConnectionPoolDataSource  v)
       {
           assertInitializationAllowed();
  -        if (dataSourceName != null) 
  +        if (dataSourceName != null)
           {
               throw new IllegalStateException(
                   "Cannot set the DataSource, if JNDI is used.");
           }
           this.cpds = v;
  -        if (isNew) 
  +        if (isNew)
           {
               registerInstance();
           }
  @@ -204,62 +204,62 @@
   
       /**
        * Get the name of the ConnectionPoolDataSource which backs this pool.
  -     * This name is used to look up the datasource from a jndi service 
  +     * This name is used to look up the datasource from a jndi service
        * provider.
        *
        * @return value of dataSourceName.
        */
  -    public String getDataSourceName() 
  +    public String getDataSourceName()
       {
           return dataSourceName;
       }
  -    
  +
       /**
        * Set the name of the ConnectionPoolDataSource which backs this pool.
  -     * This name is used to look up the datasource from a jndi service 
  +     * This name is used to look up the datasource from a jndi service
        * provider.
        *
        * @param v  Value to assign to dataSourceName.
        */
  -    public void setDataSourceName(String  v) 
  +    public void setDataSourceName(String  v)
       {
           assertInitializationAllowed();
  -        if (cpds != null) 
  +        if (cpds != null)
           {
               throw new IllegalStateException(
                   "Cannot set the JNDI name for the DataSource, if already " +
                   "set using setConnectionPoolDataSource.");
           }
           this.dataSourceName = v;
  -        if (isNew) 
  +        if (isNew)
           {
               registerInstance();
           }
       }
   
  -    
  -    /** 
  -     * Get the value of defaultAutoCommit, which defines the state of 
  +
  +    /**
  +     * Get the value of defaultAutoCommit, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setAutoCommit(boolean).
        * The default is true.
        *
        * @return value of defaultAutoCommit.
        */
  -    public boolean isDefaultAutoCommit() 
  +    public boolean isDefaultAutoCommit()
       {
           return defaultAutoCommit;
       }
  -    
  +
       /**
  -     * Set the value of defaultAutoCommit, which defines the state of 
  +     * Set the value of defaultAutoCommit, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setAutoCommit(boolean).
        * The default is true.
        *
        * @param v  Value to assign to defaultAutoCommit.
        */
  -    public void setDefaultAutoCommit(boolean  v) 
  +    public void setDefaultAutoCommit(boolean  v)
       {
           assertInitializationAllowed();
           this.defaultAutoCommit = v;
  @@ -313,7 +313,7 @@
       /**
        * The maximum number of milliseconds that the pool will wait (when there
        * are no available connections) for a connection to be returned before
  -     * throwing an exception, or -1 to wait indefinitely.  Will fail 
  +     * throwing an exception, or -1 to wait indefinitely.  Will fail
        * immediately if value is 0.
        * This value is used for any username which is not specified
        * in perUserMaxWait.  The default is -1.
  @@ -325,7 +325,7 @@
       /**
        * The maximum number of milliseconds that the pool will wait (when there
        * are no available connections) for a connection to be returned before
  -     * throwing an exception, or -1 to wait indefinitely.  Will fail 
  +     * throwing an exception, or -1 to wait indefinitely.  Will fail
        * immediately if value is 0.
        * This value is used for any username which is not specified
        * in perUserMaxWait.  The default is -1.
  @@ -337,33 +337,33 @@
   
   
       /**
  -     * Get the value of defaultReadOnly, which defines the state of 
  +     * Get the value of defaultReadOnly, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setReadOnly(boolean).
        * The default is false.
        *
        * @return value of defaultReadOnly.
        */
  -    public boolean isDefaultReadOnly() 
  +    public boolean isDefaultReadOnly()
       {
           return defaultReadOnly;
       }
  -    
  +
       /**
  -     * Set the value of defaultReadOnly, which defines the state of 
  +     * Set the value of defaultReadOnly, which defines the state of
        * connections handed out from this pool.  The value can be changed
        * on the Connection using Connection.setReadOnly(boolean).
        * The default is false.
        *
        * @param v  Value to assign to defaultReadOnly.
        */
  -    public void setDefaultReadOnly(boolean  v) 
  +    public void setDefaultReadOnly(boolean  v)
       {
           assertInitializationAllowed();
           this.defaultReadOnly = v;
       }
   
  -    
  +
       /**
        * Get the description.  This property is defined by jdbc as for use with
        * GUI (or other) tools that might deploy the datasource.  It serves no
  @@ -371,23 +371,23 @@
        *
        * @return value of description.
        */
  -    public String getDescription() 
  +    public String getDescription()
       {
           return description;
       }
  -    
  +
       /**
        * Set the description.  This property is defined by jdbc as for use with
        * GUI (or other) tools that might deploy the datasource.  It serves no
        * internal purpose.
  -     * 
  +     *
        * @param v  Value to assign to description.
        */
  -    public void setDescription(String  v) 
  +    public void setDescription(String  v)
       {
           this.description = v;
       }
  -        
  +
   
       /**
        * Get the value of jndiEnvironment which is used when instantiating
  @@ -396,16 +396,16 @@
        *
        * @return value of jndiEnvironment.
        */
  -    public String getJndiEnvironment(String key) 
  +    public String getJndiEnvironment(String key)
       {
           String value = null;
  -        if (jndiEnvironment != null) 
  +        if (jndiEnvironment != null)
           {
               value = jndiEnvironment.getProperty(key);
           }
           return value;
       }
  -    
  +
       /**
        * Set the value of jndiEnvironment which is used when instantiating
        * a jndi InitialContext.  This InitialContext is used to locate the
  @@ -413,113 +413,113 @@
        *
        * @param v  Value to assign to jndiEnvironment.
        */
  -    public void setJndiEnvironment(String key, String value) 
  +    public void setJndiEnvironment(String key, String value)
       {
  -        if (jndiEnvironment == null) 
  +        if (jndiEnvironment == null)
           {
               jndiEnvironment = new Properties();
           }
           jndiEnvironment.setProperty(key, value);
       }
   
  -    
  +
       /**
        * Get the value of loginTimeout.
        * @return value of loginTimeout.
        */
  -    public int getLoginTimeout() 
  +    public int getLoginTimeout()
       {
           return loginTimeout;
       }
  -    
  +
       /**
        * Set the value of loginTimeout.
        * @param v  Value to assign to loginTimeout.
        */
  -    public void setLoginTimeout(int  v) 
  +    public void setLoginTimeout(int  v)
       {
           this.loginTimeout = v;
       }
  -    
  -    
  +
  +
       /**
        * Get the value of logWriter.
        * @return value of logWriter.
        */
  -    public PrintWriter getLogWriter() 
  +    public PrintWriter getLogWriter()
       {
  -        if (logWriter == null) 
  +        if (logWriter == null)
           {
               logWriter = new PrintWriter(System.out);
  -        }        
  +        }
           return logWriter;
       }
  -    
  +
       /**
        * Set the value of logWriter.
        * @param v  Value to assign to logWriter.
        */
  -    public void setLogWriter(PrintWriter  v) 
  +    public void setLogWriter(PrintWriter  v)
       {
           this.logWriter = v;
       }
  -    
  +
   
       /**
  -     * The keys are usernames and the value is the --.  Any 
  +     * The keys are usernames and the value is the --.  Any
        * username specified here will override the value of defaultAutoCommit.
        */
  -    public Boolean getPerUserDefaultAutoCommit(String key) 
  +    public Boolean getPerUserDefaultAutoCommit(String key)
       {
           Boolean value = null;
  -        if (perUserDefaultAutoCommit != null) 
  +        if (perUserDefaultAutoCommit != null)
           {
               value = (Boolean)perUserDefaultAutoCommit.get(key);
           }
           return value;
       }
  -    
  +
       /**
  -     * The keys are usernames and the value is the --.  Any 
  +     * The keys are usernames and the value is the --.  Any
        * username specified here will override the value of defaultAutoCommit.
        */
  -    public void setPerUserDefaultAutoCommit(String username, Boolean value) 
  +    public void setPerUserDefaultAutoCommit(String username, Boolean value)
       {
           assertInitializationAllowed();
  -        if (perUserDefaultAutoCommit == null) 
  +        if (perUserDefaultAutoCommit == null)
           {
               perUserDefaultAutoCommit = new HashMap();
           }
           perUserDefaultAutoCommit.put(username, value);
       }
   
  -    
  +
       /**
        * The maximum number of active connections that can be allocated from
        * this pool at the same time, or zero for no limit.
  -     * The keys are usernames and the value is the maximum connections.  Any 
  +     * The keys are usernames and the value is the maximum connections.  Any
        * username specified here will override the value of defaultMaxActive.
        */
  -    public Integer getPerUserMaxActive(String username) 
  +    public Integer getPerUserMaxActive(String username)
       {
           Integer value = null;
  -        if (perUserMaxActive != null) 
  +        if (perUserMaxActive != null)
           {
               value = (Integer)perUserMaxActive.get(username);
           }
           return value;
       }
  -    
  +
       /**
        * The maximum number of active connections that can be allocated from
        * this pool at the same time, or zero for no limit.
  -     * The keys are usernames and the value is the maximum connections.  Any 
  +     * The keys are usernames and the value is the maximum connections.  Any
        * username specified here will override the value of defaultMaxActive.
        */
  -    public void setPerUserMaxActive(String username, Integer value) 
  +    public void setPerUserMaxActive(String username, Integer value)
       {
           assertInitializationAllowed();
  -        if (perUserMaxActive == null) 
  +        if (perUserMaxActive == null)
           {
               perUserMaxActive = new HashMap();
           }
  @@ -530,65 +530,65 @@
       /**
        * The maximum number of active connections that can remain idle in the
        * pool, without extra ones being released, or zero for no limit.
  -     * The keys are usernames and the value is the maximum connections.  Any 
  +     * The keys are usernames and the value is the maximum connections.  Any
        * username specified here will override the value of defaultMaxIdle.
        */
  -    public Integer getPerUserMaxIdle(String username) 
  +    public Integer getPerUserMaxIdle(String username)
       {
           Integer value = null;
  -        if (perUserMaxIdle != null) 
  +        if (perUserMaxIdle != null)
           {
               value = (Integer)perUserMaxIdle.get(username);
           }
           return value;
       }
  -    
  +
       /**
        * The maximum number of active connections that can remain idle in the
        * pool, without extra ones being released, or zero for no limit.
  -     * The keys are usernames and the value is the maximum connections.  Any 
  +     * The keys are usernames and the value is the maximum connections.  Any
        * username specified here will override the value of defaultMaxIdle.
        */
  -    public void setPerUserMaxIdle(String username, Integer value) 
  +    public void setPerUserMaxIdle(String username, Integer value)
       {
           assertInitializationAllowed();
  -        if (perUserMaxIdle == null) 
  +        if (perUserMaxIdle == null)
           {
               perUserMaxIdle = new HashMap();
           }
           perUserMaxIdle.put(username, value);
       }
  -    
  +
       /**
        * The maximum number of milliseconds that the pool will wait (when there
        * are no available connections) for a connection to be returned before
  -     * throwing an exception, or -1 to wait indefinitely.  Will fail 
  +     * throwing an exception, or -1 to wait indefinitely.  Will fail
        * immediately if value is 0.
  -     * The keys are usernames and the value is the maximum connections.  Any 
  +     * The keys are usernames and the value is the maximum connections.  Any
        * username specified here will override the value of defaultMaxWait.
        */
  -    public Integer getPerUserMaxWait(String username) 
  +    public Integer getPerUserMaxWait(String username)
       {
           Integer value = null;
  -        if (perUserMaxWait != null) 
  +        if (perUserMaxWait != null)
           {
               value = (Integer)perUserMaxWait.get(username);
           }
           return value;
       }
  -    
  +
       /**
        * The maximum number of milliseconds that the pool will wait (when there
        * are no available connections) for a connection to be returned before
  -     * throwing an exception, or -1 to wait indefinitely.  Will fail 
  +     * throwing an exception, or -1 to wait indefinitely.  Will fail
        * immediately if value is 0.
  -     * The keys are usernames and the value is the maximum connections.  Any 
  +     * The keys are usernames and the value is the maximum connections.  Any
        * username specified here will override the value of defaultMaxWait.
        */
  -    public void setPerUserMaxWait(String username, Integer value) 
  +    public void setPerUserMaxWait(String username, Integer value)
       {
           assertInitializationAllowed();
  -        if (perUserMaxWait == null) 
  +        if (perUserMaxWait == null)
           {
               perUserMaxWait = new HashMap();
           }
  @@ -597,27 +597,27 @@
   
   
       /**
  -     * The keys are usernames and the value is the --.  Any 
  +     * The keys are usernames and the value is the --.  Any
        * username specified here will override the value of defaultReadOnly.
        */
  -    public Boolean getPerUserDefaultReadOnly(String username) 
  +    public Boolean getPerUserDefaultReadOnly(String username)
       {
           Boolean value = null;
  -        if (perUserDefaultReadOnly != null) 
  +        if (perUserDefaultReadOnly != null)
           {
               value = (Boolean)perUserDefaultReadOnly.get(username);
           }
           return value;
       }
  -    
  +
       /**
  -     * The keys are usernames and the value is the --.  Any 
  +     * The keys are usernames and the value is the --.  Any
        * username specified here will override the value of defaultReadOnly.
        */
  -    public void setPerUserDefaultReadOnly(String username, Boolean value) 
  +    public void setPerUserDefaultReadOnly(String username, Boolean value)
       {
           assertInitializationAllowed();
  -        if (perUserDefaultReadOnly == null) 
  +        if (perUserDefaultReadOnly == null)
           {
               perUserDefaultReadOnly = new HashMap();
           }
  @@ -699,7 +699,7 @@
        *
        * *see #getTimeBetweenEvictionRunsMillis
        */
  -    public void 
  +    public void
           setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) {
           assertInitializationAllowed();
               _timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
  @@ -754,7 +754,7 @@
        * *see #getMinEvictableIdleTimeMillis
        * *see #setTimeBetweenEvictionRunsMillis
        */
  -    public void 
  +    public void
           setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
           assertInitializationAllowed();
           _minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
  @@ -810,12 +810,12 @@
       }
   
       // ----------------------------------------------------------------------
  -    // DataSource implementation 
  +    // DataSource implementation
   
       /**
        * Attempt to establish a database connection.
        */
  -    public Connection getConnection() 
  +    public Connection getConnection()
           throws SQLException
       {
           return getConnection(null, null);
  @@ -827,17 +827,17 @@
       public Connection getConnection(String username, String password)
           throws SQLException
       {
  -        if (isNew) 
  +        if (isNew)
           {
  -            throw new SQLException("Must set the ConnectionPoolDataSource " + 
  -                "through setDataSourceName or setConnectionPoolDataSource " + 
  +            throw new SQLException("Must set the ConnectionPoolDataSource " +
  +                "through setDataSourceName or setConnectionPoolDataSource " +
                   "before calling getConnection.");
           }
           getConnectionCalled = true;
           Map pools = (Map)dsInstanceMap.get(instanceKey);
           PoolKey key = getPoolKey(username);
           Object pool = pools.get(key);
  -        if ( pool == null ) 
  +        if ( pool == null )
           {
               try
               {
  @@ -853,7 +853,7 @@
           returnPoolKey(key);
   
           PooledConnection pc = null;
  -        if (pool instanceof ObjectPool) 
  +        if (pool instanceof ObjectPool)
           {
               try
               {
  @@ -861,18 +861,18 @@
               }
               catch (Exception e)
               {
  -                if (e instanceof RuntimeException) 
  +                if (e instanceof RuntimeException)
                   {
                       throw (RuntimeException)e;
                   }
  -                else 
  +                else
                   {
                       throw new SQLException(e.getMessage());
                   }
               }
           }
           else // assume KeyedObjectPool
  -        { 
  +        {
               try
               {
                   UserPassKey upkey = getPCKey(username, password);
  @@ -882,40 +882,40 @@
               }
               catch (Exception e)
               {
  -                if (e instanceof RuntimeException) 
  +                if (e instanceof RuntimeException)
                   {
                       throw (RuntimeException)e;
                   }
  -                else 
  +                else
                   {
                       throw new SQLException(e.getMessage());
                   }
               }
           }
  -        
  +
           boolean defaultAutoCommit = isDefaultAutoCommit();
  -        if ( username != null ) 
  +        if ( username != null )
           {
  -            Boolean userMax = 
  +            Boolean userMax =
                   getPerUserDefaultAutoCommit(username);
  -            if ( userMax != null ) 
  +            if ( userMax != null )
               {
                   defaultAutoCommit = userMax.booleanValue();
               }
  -        }    
  +        }
   
           boolean defaultReadOnly = isDefaultReadOnly();
  -        if ( username != null ) 
  +        if ( username != null )
           {
  -            Boolean userMax = 
  +            Boolean userMax =
                   getPerUserDefaultReadOnly(username);
  -            if ( userMax != null ) 
  +            if ( userMax != null )
               {
                   defaultReadOnly = userMax.booleanValue();
               }
  -        }    
  +        }
   
  -        Connection con = pc.getConnection();        
  +        Connection con = pc.getConnection();
           con.setAutoCommit(defaultAutoCommit);
           con.setReadOnly(defaultReadOnly);
           return con;
  @@ -941,7 +941,7 @@
   
       private void returnPCKey(UserPassKey key)
       {
  -        if (key.isReusable()) 
  +        if (key.isReusable())
           {
               try
               {
  @@ -970,9 +970,9 @@
                   + e.getMessage());
               key = new PoolKey();
           }
  -        if ( username != null && 
  -             (perUserMaxActive == null 
  -              || !perUserMaxActive.containsKey(username)) ) 
  +        if ( username != null &&
  +             (perUserMaxActive == null
  +              || !perUserMaxActive.containsKey(username)) )
           {
               username = null;
           }
  @@ -996,11 +996,11 @@
   
       synchronized private void registerInstance()
       {
  -        if (isNew) 
  +        if (isNew)
           {
               int max = 0;
               Iterator i = dsInstanceMap.keySet().iterator();
  -            while (i.hasNext()) 
  +            while (i.hasNext())
               {
                   int key = ((Integer)i.next()).intValue();
                   max = Math.max(max, key);
  @@ -1018,7 +1018,7 @@
       {
           Map pools = (Map)dsInstanceMap.get(instanceKey);
           PoolKey key = getPoolKey(username);
  -        if ( !pools.containsKey(key) ) 
  +        if ( !pools.containsKey(key) )
           {
               int maxActive = getDefaultMaxActive();
               int maxIdle = getDefaultMaxIdle();
  @@ -1026,14 +1026,14 @@
   
               // The source of physical db connections
               ConnectionPoolDataSource cpds = this.cpds;
  -            if ( cpds == null ) 
  -            {            
  +            if ( cpds == null )
  +            {
                   Context ctx = null;
  -                if ( jndiEnvironment == null ) 
  +                if ( jndiEnvironment == null )
                   {
  -                    ctx = new InitialContext();                
  +                    ctx = new InitialContext();
                   }
  -                else 
  +                else
                   {
                       ctx = new InitialContext(jndiEnvironment);
                   }
  @@ -1041,21 +1041,21 @@
               }
   
               Object whicheverPool = null;
  -            if (perUserMaxActive != null 
  -                && perUserMaxActive.containsKey(username)) 
  -            {                
  +            if (perUserMaxActive != null
  +                && perUserMaxActive.containsKey(username))
  +            {
                   Integer userMax = getPerUserMaxActive(username);
  -                if ( userMax != null ) 
  +                if ( userMax != null )
                   {
                       maxActive = userMax.intValue();
                   }
                   userMax = getPerUserMaxIdle(username);
  -                if ( userMax != null ) 
  +                if ( userMax != null )
                   {
                       maxIdle = userMax.intValue();
                   }
                   userMax = getPerUserMaxWait(username);
  -                if ( userMax != null ) 
  +                if ( userMax != null )
                   {
                       maxWait = userMax.intValue();
                   }
  @@ -1075,7 +1075,7 @@
                   pool.setMinEvictableIdleTimeMillis(
                       getMinEvictableIdleTimeMillis());
                   pool.setTestWhileIdle(getTestWhileIdle());
  -                
  +
                   // Set up the factory we will use (passing the pool associates
                   // the factory with the pool, so we do not have to do so
                   // explicitly)
  @@ -1100,67 +1100,67 @@
                   pool.setMinEvictableIdleTimeMillis(
                       getMinEvictableIdleTimeMillis());
                   pool.setTestWhileIdle(getTestWhileIdle());
  -                
  +
                   // Set up the factory we will use (passing the pool associates
                   // the factory with the pool, so we do not have to do so
                   // explicitly)
                   new KeyedCPDSConnectionFactory(cpds, pool, validationQuery);
                   whicheverPool = pool;
               }
  -            
  +
               // pools is a FastHashMap set to put the pool in a thread-safe way
               pools.put(key, whicheverPool);
  -        }        
  +        }
       }
   
       private byte getWhenExhausted(int maxActive, int maxWait)
       {
           byte whenExhausted = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
  -        if (maxActive <= 0) 
  +        if (maxActive <= 0)
           {
               whenExhausted = GenericObjectPool.WHEN_EXHAUSTED_GROW;
           }
  -        else if (maxWait == 0) 
  +        else if (maxWait == 0)
           {
               whenExhausted = GenericObjectPool.WHEN_EXHAUSTED_FAIL;
           }
           return whenExhausted;
  -    }    
  +    }
   
       // ----------------------------------------------------------------------
  -    // Referenceable implementation 
  +    // Referenceable implementation
   
       /**
        * <CODE>Referenceable</CODE> implementation prepares object for
        * binding in jndi.
        */
  -    public Reference getReference() 
  +    public Reference getReference()
           throws NamingException
       {
           // this class implements its own factory
           String factory = getClass().getName();
           Reference ref = new Reference(getClass().getName(), factory, null);
   
  -        ref.add(new StringRefAddr("isNew", 
  +        ref.add(new StringRefAddr("isNew",
                                     String.valueOf(isNew)));
  -        ref.add(new StringRefAddr("instanceKey", 
  +        ref.add(new StringRefAddr("instanceKey",
               (instanceKey == null ? null : instanceKey.toString()) ));
           ref.add(new StringRefAddr("dataSourceName", getDataSourceName()));
  -        ref.add(new StringRefAddr("defaultAutoCommit", 
  +        ref.add(new StringRefAddr("defaultAutoCommit",
                                     String.valueOf(isDefaultAutoCommit())));
  -        ref.add(new StringRefAddr("defaultMaxActive", 
  +        ref.add(new StringRefAddr("defaultMaxActive",
                                     String.valueOf(getDefaultMaxActive())));
  -        ref.add(new StringRefAddr("defaultMaxIdle", 
  +        ref.add(new StringRefAddr("defaultMaxIdle",
                                     String.valueOf(getDefaultMaxIdle())));
  -        ref.add(new StringRefAddr("defaultMaxWait", 
  +        ref.add(new StringRefAddr("defaultMaxWait",
                                     String.valueOf(getDefaultMaxWait())));
  -        ref.add(new StringRefAddr("defaultReadOnly", 
  +        ref.add(new StringRefAddr("defaultReadOnly",
                                     String.valueOf(isDefaultReadOnly())));
           ref.add(new StringRefAddr("description", getDescription()));
   
           byte[] ser = null;
           // BinaryRefAddr does not allow null byte[].
  -        if ( jndiEnvironment != null ) 
  +        if ( jndiEnvironment != null )
           {
               try
               {
  @@ -1169,15 +1169,15 @@
               }
               catch (IOException ioe)
               {
  -                throw new NamingException("An IOException prevented " + 
  +                throw new NamingException("An IOException prevented " +
                      "serializing the jndiEnvironment properties.");
               }
           }
   
  -        ref.add(new StringRefAddr("loginTimeout", 
  +        ref.add(new StringRefAddr("loginTimeout",
                                     String.valueOf(getLoginTimeout())));
   
  -        if ( perUserDefaultAutoCommit != null ) 
  +        if ( perUserDefaultAutoCommit != null )
           {
               try
               {
  @@ -1186,12 +1186,12 @@
               }
               catch (IOException ioe)
               {
  -                throw new NamingException("An IOException prevented " + 
  +                throw new NamingException("An IOException prevented " +
                      "serializing the perUserDefaultAutoCommit properties.");
               }
           }
   
  -        if ( perUserMaxActive != null ) 
  +        if ( perUserMaxActive != null )
           {
               try
               {
  @@ -1200,12 +1200,12 @@
               }
               catch (IOException ioe)
               {
  -                throw new NamingException("An IOException prevented " + 
  +                throw new NamingException("An IOException prevented " +
                      "serializing the perUserMaxActive properties.");
               }
           }
   
  -        if ( perUserMaxIdle != null ) 
  +        if ( perUserMaxIdle != null )
           {
               try
               {
  @@ -1214,12 +1214,12 @@
               }
               catch (IOException ioe)
               {
  -                throw new NamingException("An IOException prevented " + 
  +                throw new NamingException("An IOException prevented " +
                      "serializing the perUserMaxIdle properties.");
               }
           }
   
  -        if ( perUserMaxWait != null ) 
  +        if ( perUserMaxWait != null )
           {
               try
               {
  @@ -1228,12 +1228,12 @@
               }
               catch (IOException ioe)
               {
  -                throw new NamingException("An IOException prevented " + 
  +                throw new NamingException("An IOException prevented " +
                      "serializing the perUserMaxWait properties.");
               }
           }
   
  -        if ( perUserDefaultReadOnly != null ) 
  +        if ( perUserDefaultReadOnly != null )
           {
               try
               {
  @@ -1242,25 +1242,25 @@
               }
               catch (IOException ioe)
               {
  -                throw new NamingException("An IOException prevented " + 
  +                throw new NamingException("An IOException prevented " +
                      "serializing the perUserDefaultReadOnly properties.");
               }
           }
   
  -        ref.add(new StringRefAddr("testOnBorrow", 
  +        ref.add(new StringRefAddr("testOnBorrow",
                                     String.valueOf(getTestOnBorrow())));
  -        ref.add(new StringRefAddr("testOnReturn", 
  +        ref.add(new StringRefAddr("testOnReturn",
                                     String.valueOf(getTestOnReturn())));
  -        ref.add(new StringRefAddr("timeBetweenEvictionRunsMillis", 
  +        ref.add(new StringRefAddr("timeBetweenEvictionRunsMillis",
               String.valueOf(getTimeBetweenEvictionRunsMillis())));
  -        ref.add(new StringRefAddr("numTestsPerEvictionRun", 
  +        ref.add(new StringRefAddr("numTestsPerEvictionRun",
               String.valueOf(getNumTestsPerEvictionRun())));
  -        ref.add(new StringRefAddr("minEvictableIdleTimeMillis", 
  +        ref.add(new StringRefAddr("minEvictableIdleTimeMillis",
               String.valueOf(getMinEvictableIdleTimeMillis())));
  -        ref.add(new StringRefAddr("testWhileIdle", 
  +        ref.add(new StringRefAddr("testWhileIdle",
                                     String.valueOf(getTestWhileIdle())));
           ref.add(new StringRefAddr("validationQuery", getValidationQuery()));
  -        
  +
           return ref;
       }
   
  @@ -1288,7 +1288,7 @@
           }
           finally
           {
  -            if (out != null) 
  +            if (out != null)
               {
                   out.close();
               }
  @@ -1298,190 +1298,190 @@
   
   
       // ----------------------------------------------------------------------
  -    // ObjectFactory implementation 
  +    // ObjectFactory implementation
   
       /**
        * implements ObjectFactory to create an instance of this class
  -     */ 
  -    public Object getObjectInstance(Object refObj, Name name, 
  -                                    Context context, Hashtable env) 
  -        throws Exception 
  +     */
  +    public Object getObjectInstance(Object refObj, Name name,
  +                                    Context context, Hashtable env)
  +        throws Exception
       {
  -        // The spec says to return null if we can't create an instance 
  +        // The spec says to return null if we can't create an instance
           // of the reference
           Jdbc2PoolDataSource ds = null;
  -        if (refObj instanceof Reference) 
  +        if (refObj instanceof Reference)
           {
               Reference ref = (Reference)refObj;
  -	
  -            if (ref.getClassName().equals(getClass().getName())) 
  -            {   
  +
  +            if (ref.getClassName().equals(getClass().getName()))
  +            {
                   RefAddr ra = ref.get("isNew");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       isNew = Boolean.getBoolean(ra.getContent().toString());
                   }
   
                   ra = ref.get("instanceKey");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       instanceKey = new Integer(ra.getContent().toString());
                   }
   
                   ra = ref.get("dataSourceName");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setDataSourceName(ra.getContent().toString());
                   }
   
                   ra = ref.get("defaultAutoCommit");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setDefaultAutoCommit
                           (Boolean.getBoolean(ra.getContent().toString()));
                   }
   
                   ra = ref.get("defaultMaxActive");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setDefaultMaxActive(
                           Integer.parseInt(ra.getContent().toString()));
                   }
   
                   ra = ref.get("defaultMaxIdle");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setDefaultMaxIdle(
                           Integer.parseInt(ra.getContent().toString()));
                   }
   
                   ra = ref.get("defaultMaxWait");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setDefaultMaxWait(
                           Integer.parseInt(ra.getContent().toString()));
                   }
   
                   ra = ref.get("defaultReadOnly");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setDefaultReadOnly
                           (Boolean.getBoolean(ra.getContent().toString()));
                   }
   
                   ra = ref.get("description");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setDescription(ra.getContent().toString());
                   }
   
                   ra = ref.get("jndiEnvironment");
  -                if (ra != null  && ra.getContent() != null) 
  +                if (ra != null  && ra.getContent() != null)
                   {
                       byte[] serialized = (byte[])ra.getContent();
  -                    jndiEnvironment = 
  -                        (Properties)Objects.deserialize(serialized);
  +                    jndiEnvironment =
  +                        (Properties)Serialization.deserialize(serialized);
                   }
  -                
  +
                   ra = ref.get("loginTimeout");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setLoginTimeout(
                           Integer.parseInt(ra.getContent().toString()));
                   }
   
                   ra = ref.get("perUserDefaultAutoCommit");
  -                if (ra != null  && ra.getContent() != null) 
  +                if (ra != null  && ra.getContent() != null)
                   {
                       byte[] serialized = (byte[])ra.getContent();
  -                    perUserDefaultAutoCommit = 
  -                        (Map)Objects.deserialize(serialized);
  +                    perUserDefaultAutoCommit =
  +                        (Map)Serialization.deserialize(serialized);
                   }
  -                
  +
                   ra = ref.get("perUserMaxActive");
  -                if (ra != null  && ra.getContent() != null) 
  +                if (ra != null  && ra.getContent() != null)
                   {
                       byte[] serialized = (byte[])ra.getContent();
  -                    perUserMaxActive = 
  -                        (Map)Objects.deserialize(serialized);
  +                    perUserMaxActive =
  +                        (Map)Serialization.deserialize(serialized);
                   }
   
                   ra = ref.get("perUserMaxIdle");
  -                if (ra != null  && ra.getContent() != null) 
  +                if (ra != null  && ra.getContent() != null)
                   {
                       byte[] serialized = (byte[])ra.getContent();
  -                    perUserMaxIdle = 
  -                        (Map)Objects.deserialize(serialized);
  +                    perUserMaxIdle =
  +                        (Map)Serialization.deserialize(serialized);
                   }
   
                   ra = ref.get("perUserMaxWait");
  -                if (ra != null  && ra.getContent() != null) 
  +                if (ra != null  && ra.getContent() != null)
                   {
                       byte[] serialized = (byte[])ra.getContent();
  -                    perUserMaxWait = 
  -                        (Map)Objects.deserialize(serialized);
  +                    perUserMaxWait =
  +                        (Map)Serialization.deserialize(serialized);
                   }
  -                
  +
                   ra = ref.get("perUserDefaultReadOnly");
  -                if (ra != null  && ra.getContent() != null) 
  +                if (ra != null  && ra.getContent() != null)
                   {
                       byte[] serialized = (byte[])ra.getContent();
  -                    perUserDefaultReadOnly = 
  -                        (Map)Objects.deserialize(serialized);
  +                    perUserDefaultReadOnly =
  +                        (Map)Serialization.deserialize(serialized);
                   }
  -                
  +
                   ra = ref.get("testOnBorrow");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setTestOnBorrow
                           (Boolean.getBoolean(ra.getContent().toString()));
                   }
   
                   ra = ref.get("testOnReturn");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setTestOnReturn
                           (Boolean.getBoolean(ra.getContent().toString()));
                   }
   
                   ra = ref.get("timeBetweenEvictionRunsMillis");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setTimeBetweenEvictionRunsMillis(
                           Integer.parseInt(ra.getContent().toString()));
                   }
   
                   ra = ref.get("numTestsPerEvictionRun");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setNumTestsPerEvictionRun(
                           Integer.parseInt(ra.getContent().toString()));
                   }
   
                   ra = ref.get("minEvictableIdleTimeMillis");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setMinEvictableIdleTimeMillis(
                           Integer.parseInt(ra.getContent().toString()));
                   }
   
                   ra = ref.get("testWhileIdle");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setTestWhileIdle
                           (Boolean.getBoolean(ra.getContent().toString()));
                   }
  -                
  +
                   ra = ref.get("validationQuery");
  -                if (ra != null && ra.getContent() != null) 
  +                if (ra != null && ra.getContent() != null)
                   {
                       setValidationQuery(ra.getContent().toString());
                   }
   
                   ds = this;
  -            }            
  +            }
           }
  -        
  +
           return ds;
       }
   }
  
  
  
  1.2       +7 -7      jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/PoolablePreparedStatementStub.java
  
  Index: PoolablePreparedStatementStub.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/PoolablePreparedStatementStub.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PoolablePreparedStatementStub.java	4 Mar 2002 07:50:15 -0000	1.1
  +++ PoolablePreparedStatementStub.java	5 Jul 2002 08:23:05 -0000	1.2
  @@ -74,7 +74,7 @@
    * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
    * @version $Id$
    */
  -public class PoolablePreparedStatementStub 
  +public class PoolablePreparedStatementStub
       extends PoolablePreparedStatement {
   
       /**
  @@ -84,7 +84,7 @@
        * @param pool the {*link KeyedObjectPool} from which I was obtained.
        * @param conn the {*link Connection} from which I was created
        */
  -    public PoolablePreparedStatementStub(PreparedStatement stmt, Object key, 
  +    public PoolablePreparedStatementStub(PreparedStatement stmt, Object key,
           KeyedObjectPool pool, Connection conn) {
           super(stmt, key, pool, conn);
       }
  @@ -93,7 +93,7 @@
           super.activate();
       }
   
  -    protected void passivate() {
  +    protected void passivate() throws SQLException {
           super.passivate();
       }
   }
  
  
  
  1.6       +5 -5      jakarta-commons-sandbox/jdbc2pool/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jdbc2pool/default.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- default.properties	19 May 2002 23:22:54 -0000	1.5
  +++ default.properties	5 Jul 2002 08:23:05 -0000	1.6
  @@ -26,10 +26,10 @@
   # your ${user.home}/build.properties or local build.properties file in
   # order to build Jdbc2pool:
   
  -commons-lang.jar = ${lib.repo}/commons-lang-0.1-dev.jar
  -commons-collections.jar = ${lib.repo}/commons-collections.jar
  -commons-pool.jar = ${lib.repo}/commons-pool.jar
  -commons-dbcp.jar = ${lib.repo}/commons-dbcp.jar
  +commons-lang.jar = ${lib.repo}/commons-lang-1.0-dev.jar
  +commons-collections.jar = ${lib.repo}/commons-collections-2.1-dev.jar
  +commons-pool.jar = ${lib.repo}/commons-pool-1.1-dev.jar
  +commons-dbcp.jar = ${lib.repo}/commons-dbcp-1.0-dev.jar
   jdbc.jar = ${lib.repo}/jdbc2_0-stdext.jar
   junit.jar = ${lib.repo}/junit-3.7.jar
   
  @@ -37,6 +37,6 @@
   test.dir = ${src.dir}/test
   test.libDir = ${build.test}/lib
   test.haltonfailure=true
  -dbcp.home=/home/jmcnally/projects/jakarta/jakarta-commons/dbcp
  +dbcp.home=../../jakarta-commons/dbcp
   build.dbcp=${dbcp.home}/dist/classes
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message