cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r699753 - in /cayenne/main/trunk/framework: cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/co...
Date Sat, 27 Sep 2008 22:41:57 GMT
Author: aadamchik
Date: Sat Sep 27 15:41:56 2008
New Revision: 699753

URL: http://svn.apache.org/viewvc?rev=699753&view=rev
Log:
CAY-1107 Support JDBC 4
(adding JDBC 4 methods to JDBC 3 classes that do not require new JDBC interfaces)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/TransactionConnectionDecorator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/NodeDataSource.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/DriverDataSource.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectDataSource.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryBlob.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryClob.java
    cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/Provider.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java Sat Sep 27 15:41:56 2008
@@ -368,5 +368,21 @@
         public void setLogWriter(PrintWriter out) throws SQLException {
             dataSource.setLogWriter(out);
         }
+        
+        /**
+         * @since 3.0
+         */
+        // JDBC 4 compatibility under Java 1.5
+        public boolean isWrapperFor(Class<?> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * @since 3.0
+         */
+        // JDBC 4 compatibility under Java 1.5
+        public <T> T unwrap(Class<T> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/TransactionConnectionDecorator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/TransactionConnectionDecorator.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/TransactionConnectionDecorator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/TransactionConnectionDecorator.java Sat Sep 27 15:41:56 2008
@@ -19,7 +19,10 @@
 
 package org.apache.cayenne.access;
 
+import java.sql.Array;
+import java.sql.Blob;
 import java.sql.CallableStatement;
+import java.sql.Clob;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.PreparedStatement;
@@ -27,7 +30,9 @@
 import java.sql.SQLWarning;
 import java.sql.Savepoint;
 import java.sql.Statement;
+import java.sql.Struct;
 import java.util.Map;
+import java.util.Properties;
 
 /**
  * A wrapper of a JDBC connection that is attached to a transaction. The behavior of this
@@ -219,8 +224,52 @@
         connection.setTransactionIsolation(level);
     }
 
-    public void setTypeMap(Map arg0) throws SQLException {
-        connection.setTypeMap(arg0);
+    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        connection.setTypeMap(map);
+    }
+
+    public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
+        return null;
+    }
+
+    public Blob createBlob() throws SQLException {
+        return null;
+    }
+
+    public Clob createClob() throws SQLException {
+        return null;
+    }
+
+    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
+        return null;
+    }
+
+    public Properties getClientInfo() throws SQLException {
+        return null;
+    }
+
+    public String getClientInfo(String name) throws SQLException {
+        return null;
+    }
+
+    public boolean isValid(int timeout) throws SQLException {
+        return false;
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException();
     }
 
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/NodeDataSource.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/NodeDataSource.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/NodeDataSource.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/NodeDataSource.java Sat Sep 27 15:41:56 2008
@@ -66,4 +66,20 @@
     public int getLoginTimeout() throws SQLException {
         return node.getDataSource().getLoginTimeout();
     }
+    
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java Sat Sep 27 15:41:56 2008
@@ -19,7 +19,10 @@
 
 package org.apache.cayenne.conn;
 
+import java.sql.Array;
+import java.sql.Blob;
 import java.sql.CallableStatement;
+import java.sql.Clob;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.PreparedStatement;
@@ -27,7 +30,9 @@
 import java.sql.SQLWarning;
 import java.sql.Savepoint;
 import java.sql.Statement;
+import java.sql.Struct;
 import java.util.Map;
+import java.util.Properties;
 
 /**
  * ConnectionWrapper is a <code>java.sql.Connection</code> implementation that wraps
@@ -363,7 +368,7 @@
         }
     }
 
-    public void setTypeMap(Map map) throws SQLException {
+    public void setTypeMap(Map<String,Class<?>> map) throws SQLException {
         try {
             connection.setTypeMap(map);
         }
@@ -484,4 +489,75 @@
         }
     }
 
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public Blob createBlob() throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public Clob createClob() throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public Struct createStruct(String arg0, Object[] arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public Properties getClientInfo() throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public String getClientInfo(String arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public boolean isValid(int arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/DriverDataSource.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/DriverDataSource.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/DriverDataSource.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/DriverDataSource.java Sat Sep 27 15:41:56 2008
@@ -254,4 +254,20 @@
             this.driver = driverClassName != null ? loadDriver(driverClassName) : null;
         }
     }
+    
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java Sat Sep 27 15:41:56 2008
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.conn;
 
 import java.io.PrintWriter;
@@ -34,19 +33,17 @@
 import javax.sql.PooledConnection;
 
 /**
- * PoolManager is a pooling DataSource impementation. 
- * Internally to obtain connections PoolManager uses either a JDBC driver 
- * or another pooling datasource.
+ * PoolManager is a pooling DataSource impementation. Internally to obtain connections
+ * PoolManager uses either a JDBC driver or another pooling datasource.
  * 
  * @author Andrus Adamchik
  */
 public class PoolManager implements DataSource, ConnectionEventListener {
 
-    /** 
-     * Defines a maximum time in milliseconds that a connection
-     * request could wait in the connection queue. After this period
-     * expires, an exception will be thrown in the calling method.
-     * In the future this parameter should be made configurable.
+    /**
+     * Defines a maximum time in milliseconds that a connection request could wait in the
+     * connection queue. After this period expires, an exception will be thrown in the
+     * calling method. In the future this parameter should be made configurable.
      */
     public static final int MAX_QUEUE_WAIT = 20000;
 
@@ -63,32 +60,19 @@
 
     private PoolMaintenanceThread poolMaintenanceThread;
 
-
-    /** 
-     * Creates new PoolManager using org.apache.cayenne.conn.PoolDataSource
-     * for an underlying ConnectionPoolDataSource. 
-     */
-    public PoolManager(
-        String jdbcDriver,
-        String dataSourceUrl,
-        int minCons,
-        int maxCons,
-        String userName,
-        String password)
-        throws SQLException {
+    /**
+     * Creates new PoolManager using org.apache.cayenne.conn.PoolDataSource for an
+     * underlying ConnectionPoolDataSource.
+     */
+    public PoolManager(String jdbcDriver, String dataSourceUrl, int minCons, int maxCons,
+            String userName, String password) throws SQLException {
 
         this(jdbcDriver, dataSourceUrl, minCons, maxCons, userName, password, null);
     }
 
-    public PoolManager(
-        String jdbcDriver,
-        String dataSourceUrl,
-        int minCons,
-        int maxCons,
-        String userName,
-        String password,
-        ConnectionEventLoggingDelegate logger)
-        throws SQLException {
+    public PoolManager(String jdbcDriver, String dataSourceUrl, int minCons, int maxCons,
+            String userName, String password, ConnectionEventLoggingDelegate logger)
+            throws SQLException {
 
         if (logger != null) {
             DataSourceInfo info = new DataSourceInfo();
@@ -109,48 +93,46 @@
         init(poolDS, minCons, maxCons, userName, password);
     }
 
-    /** Creates new PoolManager with the specified policy for
-     *  connection pooling and a ConnectionPoolDataSource object.
-     *
-     *  @param poolDataSource data source for pooled connections
-     *  @param minCons Non-negative integer that specifies a minimum number of open connections
-     *  to keep in the pool at all times
-     *  @param maxCons Non-negative integer that specifies maximum number of simultaneuosly open connections
-     *
-     *  @throws SQLException if pool manager can not be created.
-     */
-    public PoolManager(
-        ConnectionPoolDataSource poolDataSource,
-        int minCons,
-        int maxCons,
-        String userName,
-        String password)
-        throws SQLException {
+    /**
+     * Creates new PoolManager with the specified policy for connection pooling and a
+     * ConnectionPoolDataSource object.
+     * 
+     * @param poolDataSource data source for pooled connections
+     * @param minCons Non-negative integer that specifies a minimum number of open
+     *            connections to keep in the pool at all times
+     * @param maxCons Non-negative integer that specifies maximum number of simultaneuosly
+     *            open connections
+     * @throws SQLException if pool manager can not be created.
+     */
+    public PoolManager(ConnectionPoolDataSource poolDataSource, int minCons, int maxCons,
+            String userName, String password) throws SQLException {
         init(poolDataSource, minCons, maxCons, userName, password);
     }
 
     /** Initializes pool. Normally called from constructor. */
     protected void init(
-        ConnectionPoolDataSource poolDataSource,
-        int minCons,
-        int maxCons,
-        String userName,
-        String password)
-        throws SQLException {
+            ConnectionPoolDataSource poolDataSource,
+            int minCons,
+            int maxCons,
+            String userName,
+            String password) throws SQLException {
 
         // do sanity checks...
         if (maxConnections < 0) {
-            throw new SQLException(
-                "Maximum number of connections can not be negative (" + maxCons + ").");
+            throw new SQLException("Maximum number of connections can not be negative ("
+                    + maxCons
+                    + ").");
         }
 
         if (minConnections < 0) {
-            throw new SQLException(
-                "Minimum number of connections can not be negative (" + minCons + ").");
+            throw new SQLException("Minimum number of connections can not be negative ("
+                    + minCons
+                    + ").");
         }
 
         if (minConnections > maxConnections) {
-            throw new SQLException("Minimum number of connections can not be bigger then maximum.");
+            throw new SQLException(
+                    "Minimum number of connections can not be bigger then maximum.");
         }
 
         // init properties
@@ -167,23 +149,22 @@
 
         startMaintenanceThread();
     }
-    
+
     protected synchronized void startMaintenanceThread() {
         disposeOfMaintenanceThread();
         this.poolMaintenanceThread = new PoolMaintenanceThread(this);
         this.poolMaintenanceThread.start();
     }
 
-    /** 
-     * Creates and returns new PooledConnection object, adding itself as a listener 
-     * for connection events. 
+    /**
+     * Creates and returns new PooledConnection object, adding itself as a listener for
+     * connection events.
      */
     protected PooledConnection newPooledConnection(String userName, String password)
-        throws SQLException {
-        PooledConnection connection =
-            (userName != null)
-                ? poolDataSource.getPooledConnection(userName, password)
-                : poolDataSource.getPooledConnection();
+            throws SQLException {
+        PooledConnection connection = (userName != null) ? poolDataSource
+                .getPooledConnection(userName, password) : poolDataSource
+                .getPooledConnection();
         connection.addConnectionEventListener(this);
         return connection;
     }
@@ -216,7 +197,7 @@
 
         disposeOfMaintenanceThread();
     }
-    
+
     protected void disposeOfMaintenanceThread() {
         if (poolMaintenanceThread != null) {
             this.poolMaintenanceThread.dispose();
@@ -230,17 +211,16 @@
         return getPoolSize() < maxConnections;
     }
 
-    /** 
+    /**
      * Increases connection pool by the specified number of connections.
      * 
-     * @return the actual number of created connections. 
+     * @return the actual number of created connections.
      * @throws SQLException if an error happens when creating a new connection.
      */
     protected synchronized int growPool(
-        int addConnections,
-        String userName,
-        String password)
-        throws SQLException {
+            int addConnections,
+            String userName,
+            String password) throws SQLException {
 
         int i = 0;
         int startPoolSize = getPoolSize();
@@ -259,16 +239,16 @@
 
             try {
                 con.close();
-            } catch (SQLException ex) {
+            }
+            catch (SQLException ex) {
                 // ignore
             }
         }
     }
 
-    /** 
-     * Returns maximum number of connections this pool can keep.
-     * This parameter when configured allows to limit the number of simultaneously
-     * open connections.
+    /**
+     * Returns maximum number of connections this pool can keep. This parameter when
+     * configured allows to limit the number of simultaneously open connections.
      */
     public int getMaxConnections() {
         return maxConnections;
@@ -278,8 +258,10 @@
         this.maxConnections = maxConnections;
     }
 
-    /** Returns the absolute minimum number of connections allowed 
-      * in this pool at any moment in time. */
+    /**
+     * Returns the absolute minimum number of connections allowed in this pool at any
+     * moment in time.
+     */
     public int getMinConnections() {
         return minConnections;
     }
@@ -288,14 +270,18 @@
         this.minConnections = minConnections;
     }
 
-    /** Returns a database URL used to initialize this pool.
-      * Will return null if the pool was initialized with ConnectionPoolDataSource. */
+    /**
+     * Returns a database URL used to initialize this pool. Will return null if the pool
+     * was initialized with ConnectionPoolDataSource.
+     */
     public String getDataSourceUrl() {
         return dataSourceUrl;
     }
 
-    /** Returns a name of a JDBC driver used to initialize this pool.
-      * Will return null if the pool was initialized with ConnectionPoolDataSource. */
+    /**
+     * Returns a name of a JDBC driver used to initialize this pool. Will return null if
+     * the pool was initialized with ConnectionPoolDataSource.
+     */
     public String getJdbcDriver() {
         return jdbcDriver;
     }
@@ -317,28 +303,29 @@
         return usedPool.size() + unusedPool.size();
     }
 
-    /** 
-     * Returns the number of connections obtained via this DataSource
-     * that are currently in use by the DataSource clients. 
+    /**
+     * Returns the number of connections obtained via this DataSource that are currently
+     * in use by the DataSource clients.
      */
     public synchronized int getCurrentlyInUse() {
         return usedPool.size();
     }
 
-    /** 
-     * Returns the number of connections maintained in the 
-     * pool that are currently not used by any clients and are
-     * available immediately via <code>getConnection</code> method. 
+    /**
+     * Returns the number of connections maintained in the pool that are currently not
+     * used by any clients and are available immediately via <code>getConnection</code>
+     * method.
      */
     public synchronized int getCurrentlyUnused() {
         return unusedPool.size();
     }
 
-    /** 
-     * Returns connection from the pool using internal values of user name
-     * and password. Eqivalent to calling: 
-     * 
-     * <p><code>ds.getConnection(ds.getUserName(), ds.getPassword())</code></p> 
+    /**
+     * Returns connection from the pool using internal values of user name and password.
+     * Eqivalent to calling:
+     * <p>
+     * <code>ds.getConnection(ds.getUserName(), ds.getPassword())</code>
+     * </p>
      */
     public Connection getConnection() throws SQLException {
         return getConnection(userName, password);
@@ -360,7 +347,7 @@
             }
             catch (SQLException ignored) {
             }
-            
+
             // do one reconnect attempt...
             pooledConnection = uncheckPooledConnection(userName, password);
             try {
@@ -372,12 +359,12 @@
                 }
                 catch (SQLException ignored) {
                 }
-                
+
                 throw reconnectEx;
             }
         }
     }
-    
+
     private Connection uncheckConnection(PooledConnection pooledConnection)
             throws SQLException {
         Connection c = pooledConnection.getConnection();
@@ -386,33 +373,32 @@
         usedPool.add(pooledConnection);
         return c;
     }
-    
+
     private PooledConnection uncheckPooledConnection(String userName, String password)
             throws SQLException {
-        // wait for returned connections or the maintenance thread 
+        // wait for returned connections or the maintenance thread
         // to bump the pool size...
 
         if (unusedPool.size() == 0) {
-            
+
             // first try to open a new connection
             if (canGrowPool()) {
                 return newPooledConnection(userName, password);
             }
-            
+
             // can't open no more... will have to wait for others to return a connection
-            
-            // note that if we were woken up 
+
+            // note that if we were woken up
             // before the full wait period expired, and no connections are
             // available yet, go back to sleep. Otherwise we don't give a maintenance
             // thread a chance to increase pool size
-            long waitTill =
-                System.currentTimeMillis()
-                + MAX_QUEUE_WAIT;
+            long waitTill = System.currentTimeMillis() + MAX_QUEUE_WAIT;
 
             do {
                 try {
                     wait(MAX_QUEUE_WAIT);
-                } catch (InterruptedException iex) {
+                }
+                catch (InterruptedException iex) {
                     // ignoring
                 }
 
@@ -420,8 +406,8 @@
 
             if (unusedPool.size() == 0) {
                 throw new SQLException(
-                    "Can't obtain connection. Request timed out. Total used connections: "
-                        + usedPool.size());
+                        "Can't obtain connection. Request timed out. Total used connections: "
+                                + usedPool.size());
             }
         }
 
@@ -445,13 +431,13 @@
         poolDataSource.setLogWriter(out);
     }
 
-    /** 
-     * Returns closed connection to the pool. 
+    /**
+     * Returns closed connection to the pool.
      */
     public synchronized void connectionClosed(ConnectionEvent event) {
         // return connection to the pool
         PooledConnection closedConn = (PooledConnection) event.getSource();
-        
+
         // remove this connection from the list of connections
         // managed by this pool...
         int usedInd = usedPool.indexOf(closedConn);
@@ -463,14 +449,15 @@
             notifyAll();
         }
         // else ....
-        // other possibility is that this is a bad connection, so just ignore its closing event,
+        // other possibility is that this is a bad connection, so just ignore its closing
+        // event,
         // since it was unregistered in "connectionErrorOccurred"
     }
 
-    /** 
-     * Removes connection with an error from the pool. This method
-     * is called by PoolManager connections on connection errors
-     * to notify PoolManager that connection is in invalid state.
+    /**
+     * Removes connection with an error from the pool. This method is called by
+     * PoolManager connections on connection errors to notify PoolManager that connection
+     * is in invalid state.
      */
     public synchronized void connectionErrorOccurred(ConnectionEvent event) {
         // later on we should analyze the error to see if this
@@ -484,7 +471,8 @@
         int usedInd = usedPool.indexOf(errorSrc);
         if (usedInd >= 0) {
             usedPool.remove(usedInd);
-        } else {
+        }
+        else {
             int unusedInd = unusedPool.indexOf(errorSrc);
             if (unusedInd >= 0)
                 unusedPool.remove(unusedInd);
@@ -496,6 +484,7 @@
     }
 
     static class PoolMaintenanceThread extends Thread {
+
         protected boolean shouldDie;
         protected PoolManager pool;
 
@@ -507,13 +496,14 @@
 
         @Override
         public void run() {
-            // periodically wakes up to check if the pool should grow or shrink 
+            // periodically wakes up to check if the pool should grow or shrink
             while (true) {
 
                 try {
                     // don't do it too often
                     sleep(600000);
-                } catch (InterruptedException iex) {
+                }
+                catch (InterruptedException iex) {
                     // ignore...
                 }
 
@@ -522,17 +512,17 @@
                 }
 
                 synchronized (pool) {
-                    // TODO: implement a smarter algorithm for pool management... 
+                    // TODO: implement a smarter algorithm for pool management...
                     // right now it will simply close one connection if the count is
                     // above median and there are any idle connections.
 
                     int unused = pool.getCurrentlyUnused();
                     int used = pool.getCurrentlyInUse();
                     int total = unused + used;
-                    int median =
-                        pool.minConnections
+                    int median = pool.minConnections
                             + 1
-                            + (pool.maxConnections - pool.minConnections) / 2;
+                            + (pool.maxConnections - pool.minConnections)
+                            / 2;
 
                     if (unused > 0 && total > median) {
                         pool.shrinkPool(1);
@@ -548,4 +538,20 @@
             shouldDie = true;
         }
     }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java Sat Sep 27 15:41:56 2008
@@ -17,14 +17,12 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.conn;
 
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.sql.ConnectionEvent;
@@ -52,7 +50,8 @@
         // TODO: maybe remove synchronization and use
         // FastArrayList from commons-collections? After
         // all the only listener is usually pool manager.
-        this.connectionEventListeners = Collections.synchronizedList(new ArrayList<ConnectionEventListener>(10));
+        this.connectionEventListeners = Collections
+                .synchronizedList(new ArrayList<ConnectionEventListener>(10));
     }
 
     /** Creates new PooledConnection */

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java Sat Sep 27 15:41:56 2008
@@ -325,16 +325,18 @@
             return delegate.getLong(columnName);
         }
 
-        public Object getObject(int i, Map map) throws SQLException {
-            return delegate.getObject(i, map);
+        public Object getObject(int columnIndex, Map<String, Class<?>> map)
+                throws SQLException {
+            return delegate.getObject(columnIndex, map);
         }
 
         public Object getObject(int columnIndex) throws SQLException {
             return delegate.getObject(columnIndex);
         }
 
-        public Object getObject(String colName, Map map) throws SQLException {
-            return delegate.getObject(colName, map);
+        public Object getObject(String columnLabel, Map<String, Class<?>> map)
+                throws SQLException {
+            return delegate.getObject(columnLabel, map);
         }
 
         public Object getObject(String columnName) throws SQLException {
@@ -703,6 +705,167 @@
         public boolean wasNull() throws SQLException {
             return delegate.wasNull();
         }
+
+        public int getHoldability() throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public Reader getNCharacterStream(int arg0) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public Reader getNCharacterStream(String arg0) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public String getNString(int arg0) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public String getNString(String arg0) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean isClosed() throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateAsciiStream(int arg0, InputStream arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateAsciiStream(String arg0, InputStream arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateAsciiStream(int arg0, InputStream arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateAsciiStream(String arg0, InputStream arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBinaryStream(int arg0, InputStream arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBinaryStream(String arg0, InputStream arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBinaryStream(int arg0, InputStream arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBinaryStream(String arg0, InputStream arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBlob(int arg0, InputStream arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBlob(String arg0, InputStream arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBlob(int arg0, InputStream arg1, long arg2) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateBlob(String arg0, InputStream arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateCharacterStream(int arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateCharacterStream(String arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateCharacterStream(int arg0, Reader arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateCharacterStream(String arg0, Reader arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateClob(int arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateClob(String arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateClob(int arg0, Reader arg1, long arg2) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateClob(String arg0, Reader arg1, long arg2) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNCharacterStream(int arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNCharacterStream(String arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNCharacterStream(int arg0, Reader arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNCharacterStream(String arg0, Reader arg1, long arg2)
+                throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNClob(int arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNClob(String arg0, Reader arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNClob(int arg0, Reader arg1, long arg2) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNClob(String arg0, Reader arg1, long arg2) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNString(int arg0, String arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void updateNString(String arg0, String arg1) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean isWrapperFor(Class<?> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        public <T> T unwrap(Class<T> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
     }
 
     final class OracleResultSetMetadata implements ResultSetMetaData {
@@ -814,5 +977,21 @@
         public boolean isWritable(int column) throws SQLException {
             return delegate.isWritable(column);
         }
+
+        /**
+         * @since 3.0
+         */
+        // JDBC 4 compatibility under Java 1.5
+        public boolean isWrapperFor(Class<?> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * @since 3.0
+         */
+        // JDBC 4 compatibility under Java 1.5
+        public <T> T unwrap(Class<T> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectDataSource.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectDataSource.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectDataSource.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectDataSource.java Sat Sep 27 15:41:56 2008
@@ -63,4 +63,20 @@
     public int getLoginTimeout() throws SQLException {
         throw new SQLException("Method not implemented");
     }
+    
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryBlob.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryBlob.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryBlob.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryBlob.java Sat Sep 27 15:41:56 2008
@@ -82,14 +82,13 @@
      * retrieve the octets from pos to this.length(). Another would be to throw an
      * exception. This implementation observes the later policy.
      * 
-     * @param pos the ordinal position of the first byte in the <code>BLOB</code> value
-     *            to be extracted; the first byte is at position 1
+     * @param pos the ordinal position of the first byte in the <code>BLOB</code> value to
+     *            be extracted; the first byte is at position 1
      * @param length the number of consecutive bytes to be copied
      * @return a byte array containing up to <code>length</code> consecutive bytes from
-     *         the <code>BLOB</code> value designated by this <code>Blob</code>
-     *         object, starting with the byte at position <code>pos</code>
-     * @exception SQLException if there is an error accessing the <code>BLOB</code>
-     *                value
+     *         the <code>BLOB</code> value designated by this <code>Blob</code> object,
+     *         starting with the byte at position <code>pos</code>
+     * @exception SQLException if there is an error accessing the <code>BLOB</code> value
      */
     public byte[] getBytes(long pos, final int length) throws SQLException {
 
@@ -112,12 +111,11 @@
     }
 
     /**
-     * Retrieves the <code>BLOB</code> value designated by this <code>Blob</code>
-     * instance as a stream.
+     * Retrieves the <code>BLOB</code> value designated by this <code>Blob</code> instance
+     * as a stream.
      * 
      * @return a stream containing the <code>BLOB</code> data
-     * @exception SQLException if there is an error accessing the <code>BLOB</code>
-     *                value
+     * @exception SQLException if there is an error accessing the <code>BLOB</code> value
      */
     public InputStream getBinaryStream() throws SQLException {
         return new ByteArrayInputStream(data);
@@ -182,16 +180,15 @@
 
     /**
      * Retrieves the byte position in the <code>BLOB</code> value designated by this
-     * <code>Blob</code> object at which <code>pattern</code> begins. The search
-     * begins at position <code>start</code>.
+     * <code>Blob</code> object at which <code>pattern</code> begins. The search begins at
+     * position <code>start</code>.
      * 
-     * @param pattern the <code>Blob</code> object designating the <code>BLOB</code>
-     *            value for which to search
+     * @param pattern the <code>Blob</code> object designating the <code>BLOB</code> value
+     *            for which to search
      * @param start the position in the <code>BLOB</code> value at which to begin
      *            searching; the first position is 1
      * @return the position at which the pattern begins, else -1
-     * @exception SQLException if there is an error accessing the <code>BLOB</code>
-     *                value
+     * @exception SQLException if there is an error accessing the <code>BLOB</code> value
      */
     public long position(final Blob pattern, long start) throws SQLException {
 
@@ -271,13 +268,12 @@
     }
 
     /**
-     * Truncates the <code>BLOB</code> value that this <code>Blob</code> object
-     * represents to be <code>len</code> bytes in length.
+     * Truncates the <code>BLOB</code> value that this <code>Blob</code> object represents
+     * to be <code>len</code> bytes in length.
      * 
      * @param len the length, in bytes, to which the <code>BLOB</code> value that this
      *            <code>Blob</code> object represents should be truncated
-     * @exception SQLException if there is an error accessing the <code>BLOB</code>
-     *                value
+     * @exception SQLException if there is an error accessing the <code>BLOB</code> value
      */
     public void truncate(final long len) throws SQLException {
 
@@ -295,4 +291,19 @@
         System.arraycopy(ldata, 0, newData, 0, (int) len);
         data = newData;
     }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public void free() throws SQLException {
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public InputStream getBinaryStream(long arg0, long arg1) throws SQLException {
+        return null;
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryClob.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryClob.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryClob.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/MemoryClob.java Sat Sep 27 15:41:56 2008
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.Reader;
 import java.io.StringReader;
 import java.sql.Clob;
 import java.sql.SQLException;
@@ -319,4 +320,19 @@
             return available / 2;
         }
     }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public void free() throws SQLException {
+    }
+
+    /**
+     * @since 3.0
+     */
+    // JDBC 4 compatibility under Java 1.5
+    public Reader getCharacterStream(long pos, long length) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/Provider.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/Provider.java?rev=699753&r1=699752&r2=699753&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/Provider.java (original)
+++ cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/Provider.java Sat Sep 27 15:41:56 2008
@@ -552,6 +552,22 @@
         public int getLoginTimeout() throws SQLException {
             return getDataSource().getLoginTimeout();
         }
+        
+        /**
+         * @since 3.0
+         */
+        // JDBC 4 compatibility under Java 1.5
+        public boolean isWrapperFor(Class<?> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * @since 3.0
+         */
+        // JDBC 4 compatibility under Java 1.5
+        public <T> T unwrap(Class<T> iface) throws SQLException {
+            throw new UnsupportedOperationException();
+        }
     }
 
     class LazyConfiguration extends Configuration {



Mime
View raw message