openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r406215 [3/10] - in /incubator/openjpa/trunk/openjpa-lib: ./ java/ java/org/ java/org/apache/ java/org/apache/openjpa/ java/org/apache/openjpa/lib/ java/org/apache/openjpa/lib/conf/ java/org/apache/openjpa/lib/jdbc/ java/org/apache/openjpa/...
Date Sun, 14 May 2006 03:26:02 GMT
Added: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingConnection.java
URL: http://svn.apache.org/viewcvs/incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingConnection.java?rev=406215&view=auto
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingConnection.java (added)
+++ incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingConnection.java Sat May 13 20:25:56 2006
@@ -0,0 +1,751 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openjpa.lib.jdbc;
+
+
+import java.lang.reflect.*;
+import java.sql.*;
+import java.util.*;
+
+import org.apache.commons.lang.exception.*;
+
+import org.apache.openjpa.lib.util.*;
+import org.apache.openjpa.lib.util.Closeable;
+
+import serp.util.*;
+
+
+/**
+ *	<p>Wrapper around an existing connection.  Subclasses can override the
+ *	methods whose behavior they mean to change.  The <code>equals</code> and 
+ *	<code>hashCode</code> methods pass through to the base underlying data 
+ *	store connection.</p>
+ *
+ *	@author		Abe White
+ */
+public class DelegatingConnection
+	implements Connection, Closeable
+{
+	// jdbc 3 method keys
+	private static final Object SET_HOLDABILITY         = new Object ();
+	private static final Object GET_HOLDABILITY         = new Object ();
+	private static final Object SET_SAVEPOINT_NONAME    = new Object ();
+	private static final Object SET_SAVEPOINT           = new Object ();
+	private static final Object ROLLBACK_SAVEPOINT      = new Object ();
+	private static final Object RELEASE_SAVEPOINT       = new Object ();
+	private static final Object CREATE_STATEMENT        = new Object ();
+	private static final Object PREPARE_STATEMENT       = new Object ();
+	private static final Object PREPARE_CALL            = new Object ();
+	private static final Object PREPARE_WITH_KEYS       = new Object ();
+	private static final Object PREPARE_WITH_INDEX      = new Object ();
+    private static final Object PREPARE_WITH_NAMES      = new Object ();
+
+	private static final Localizer _loc = Localizer.forPackage
+		(DelegatingConnection.class);
+
+	private static final Map _jdbc3;
+	static
+	{
+		boolean jdbc3 = false;
+		Method m = null;
+		try
+		{
+			m = Connection.class.getMethod ("setSavepoint",
+				new Class[] { String.class });
+			jdbc3 = true;
+		}
+		catch (Throwable t) {}
+
+		if (jdbc3)
+		{
+			_jdbc3 = new HashMap ();
+			_jdbc3.put (SET_SAVEPOINT, m);
+		}
+		else
+			_jdbc3 = null;
+    }
+
+	private final Connection 			_conn;
+	private final DelegatingConnection 	_del;
+
+
+	public DelegatingConnection (Connection conn)
+	{
+		_conn = conn;
+		if (conn instanceof DelegatingConnection)
+			_del = (DelegatingConnection) _conn;
+		else
+			_del = null;
+	}
+
+
+	/**
+	 *	Return the wrapped connection.
+	 */
+	public Connection getDelegate ()
+	{
+		return _conn;
+	}
+
+	
+	/**
+	 *	Return the base underlying data store connection.
+	 */
+	public Connection getInnermostDelegate ()
+	{
+		return (_del == null) ? _conn : _del.getInnermostDelegate ();
+	}
+
+
+	public int hashCode ()
+	{
+		return getInnermostDelegate ().hashCode ();
+	}
+
+
+	public boolean equals (Object other)
+	{
+		if (other == this)
+			return true;
+		if (other instanceof DelegatingConnection)
+			other = ((DelegatingConnection) other).getInnermostDelegate ();
+		return getInnermostDelegate ().equals (other);
+	}
+
+
+	public String toString ()
+	{
+		StringBuffer buf = new StringBuffer ("conn ").append (hashCode ());
+		appendInfo (buf);
+		return buf.toString ();
+	}
+
+
+	protected void appendInfo (StringBuffer buf)
+	{
+		if (_del != null)
+			_del.appendInfo (buf);
+	}
+
+
+	public Statement createStatement () 
+		throws SQLException
+	{
+		return createStatement (true);
+	}
+
+
+	/**
+ 	 *	Create a statement, with the option of not wrapping it in a
+	 *	{@link DelegatingStatement}, which is the default.
+	 */
+	protected Statement createStatement (boolean wrap)
+		throws SQLException
+	{
+		Statement stmnt;
+		if (_del != null)
+			stmnt = _del.createStatement (false);
+		else
+			stmnt = _conn.createStatement ();
+		if (wrap)
+			stmnt = new DelegatingStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public PreparedStatement prepareStatement (String str) 
+		throws SQLException
+	{
+		return prepareStatement (str, true);
+	}
+
+
+	/**
+ 	 *	Prepare a statement, with the option of not wrapping it in a
+	 *	{@link DelegatingPreparedStatement}, which is the default.
+	 */
+	protected PreparedStatement prepareStatement (String str, boolean wrap) 
+		throws SQLException
+	{
+		PreparedStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareStatement (str, false);
+		else
+			stmnt = _conn.prepareStatement (str);
+		if (wrap)
+			stmnt = new DelegatingPreparedStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public CallableStatement prepareCall (String str) 
+		throws SQLException
+	{
+		return prepareCall (str, true);
+	}
+
+
+	/**
+ 	 *	Prepare a call, with the option of not wrapping it in a
+	 *	{@link DelegatingCallableStatement}, which is the default.
+	 */
+	protected CallableStatement prepareCall (String str, boolean wrap) 
+		throws SQLException
+	{
+		CallableStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareCall (str, false);
+		else
+			stmnt = _conn.prepareCall (str);
+		if (wrap)
+			stmnt = new DelegatingCallableStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public String nativeSQL (String str) 
+		throws SQLException
+	{
+		return _conn.nativeSQL (str);
+	}
+
+
+	public void setAutoCommit (boolean bool) 
+		throws SQLException
+	{
+		_conn.setAutoCommit (bool);
+	}
+
+
+	public boolean getAutoCommit () 
+		throws SQLException
+	{
+		return _conn.getAutoCommit ();
+	}
+
+
+	public void commit () 
+		throws SQLException
+	{
+		_conn.commit ();
+	}
+
+
+	public void rollback () 
+		throws SQLException
+	{
+		_conn.rollback ();
+	}
+
+
+	public void close () 
+		throws SQLException
+	{
+		_conn.close ();
+	}
+
+
+	public boolean isClosed () 
+		throws SQLException
+	{
+		return _conn.isClosed ();
+	}
+
+
+	public DatabaseMetaData getMetaData () 
+		throws SQLException
+	{
+		return getMetaData (true);
+	}
+
+
+	/**
+ 	 *	Return the metadata, with the option of not wrapping it in a
+	 *	{@link DelegatingDatabaseMetaData}, which is the default.
+	 */
+	protected DatabaseMetaData getMetaData (boolean wrap)
+		throws SQLException
+	{
+		DatabaseMetaData meta;
+		if (_del != null)
+			meta = _del.getMetaData (false);
+		else
+			meta = _conn.getMetaData ();
+		if (wrap)
+			meta = new DelegatingDatabaseMetaData (meta, this);
+		return meta;
+	}
+
+
+	public void setReadOnly (boolean bool) 
+		throws SQLException
+	{
+		_conn.setReadOnly (bool);
+	}
+
+
+	public boolean isReadOnly () 
+		throws SQLException
+	{
+		return _conn.isReadOnly ();
+	}
+
+
+	public void setCatalog (String str) 
+		throws SQLException
+	{
+		_conn.setCatalog (str);
+	}
+
+
+	public String getCatalog () 
+		throws SQLException
+	{
+		return _conn.getCatalog ();
+	}
+
+
+	public void setTransactionIsolation (int i) 
+		throws SQLException
+	{
+		_conn.setTransactionIsolation (i);
+	}
+
+
+	public int getTransactionIsolation () 
+		throws SQLException
+	{
+		return _conn.getTransactionIsolation ();
+	}
+
+
+	public SQLWarning getWarnings () 
+		throws SQLException
+	{
+		return _conn.getWarnings ();
+	}
+
+
+	public void clearWarnings () 
+		throws SQLException
+	{
+		_conn.clearWarnings ();
+	}
+
+
+	public Statement createStatement (int type, int concur) 
+		throws SQLException
+	{
+		return createStatement (type, concur, true);
+	}
+
+
+	/**
+ 	 *	Create a statement, with the option of not wrapping it in a
+	 *	{@link DelegatingStatement}, which is the default.
+	 */
+	protected Statement createStatement (int type, int concur, boolean wrap)
+		throws SQLException
+	{
+		Statement stmnt;
+		if (_del != null)
+			stmnt = _del.createStatement (type, concur, false);
+		else
+			stmnt = _conn.createStatement (type, concur);
+		if (wrap)
+			stmnt = new DelegatingStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public PreparedStatement prepareStatement (String str, int type,
+		int concur) 
+		throws SQLException
+	{
+		return prepareStatement (str, type, concur, true);
+	}
+
+
+	/**
+ 	 *	Prepare a statement, with the option of not wrapping it in a
+	 *	{@link DelegatingPreparedStatement}, which is the default.
+	 */
+	protected PreparedStatement prepareStatement (String str, int type,
+		int concur, boolean wrap) 
+		throws SQLException
+	{
+		PreparedStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareStatement (str, type, concur, false);
+		else
+			stmnt = _conn.prepareStatement (str, type, concur);
+		if (wrap)
+			stmnt = new DelegatingPreparedStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public CallableStatement prepareCall (String str, int type, int concur) 
+		throws SQLException
+	{
+		return prepareCall (str, type, concur, true);
+	}
+
+
+	/**
+ 	 *	Prepare a call, with the option of not wrapping it in a
+	 *	{@link DelegatingCallableStatement}, which is the default.
+	 */
+	protected CallableStatement prepareCall (String str, int type, int concur, 
+		boolean wrap) 
+		throws SQLException
+	{
+		CallableStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareCall (str, type, concur, false);
+		else
+			stmnt = _conn.prepareCall (str, type, concur);
+		if (wrap)
+			stmnt = new DelegatingCallableStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public Map getTypeMap () 
+		throws SQLException
+	{
+		return _conn.getTypeMap ();
+	}
+
+
+	public void setTypeMap (Map map) 
+		throws SQLException
+	{
+		_conn.setTypeMap (map);
+	}
+
+
+	// JDBC 3.0 methods follow; these are required to be able to 
+	// compile against JDK 1.4; these methods will not work on
+	// previous JVMs
+
+
+	public void setHoldability (int holdability)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		Method m = (Method) _jdbc3.get (SET_HOLDABILITY);
+		if (m == null)
+			m = createJDBC3Method (SET_HOLDABILITY, "setHoldability",
+				new Class[] {int.class});
+		invokeJDBC3 (m, new Object[] {Numbers.valueOf (holdability)});
+	}
+
+
+	public int getHoldability ()
+		throws SQLException
+	{
+		assertJDBC3 ();
+		Method m = (Method) _jdbc3.get (GET_HOLDABILITY);
+		if (m == null)
+			m = createJDBC3Method (GET_HOLDABILITY, "getHoldability", null);
+		return ((Number) invokeJDBC3 (m, null)).intValue ();
+	}
+
+
+	public Savepoint setSavepoint ()
+		throws SQLException
+	{
+		assertJDBC3 ();
+		Method m = (Method) _jdbc3.get (SET_SAVEPOINT_NONAME);
+		if (m == null)
+			m = createJDBC3Method (SET_SAVEPOINT_NONAME, "setSavepoint", null);
+		return (Savepoint) invokeJDBC3 (m, null);
+	}
+
+
+	public Savepoint setSavepoint (String savepoint)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		Method m = (Method) _jdbc3.get (SET_SAVEPOINT);
+		if (m == null)
+			m = createJDBC3Method (SET_SAVEPOINT, "setSavepoint", 
+				new Class[] {String.class});
+		return (Savepoint) invokeJDBC3 (m, new Object[] {savepoint});
+	}
+
+
+	public void rollback (Savepoint savepoint)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		Method m = (Method) _jdbc3.get (ROLLBACK_SAVEPOINT);
+		if (m == null)
+			m = createJDBC3Method (ROLLBACK_SAVEPOINT, "rollback", 
+				new Class[] {Savepoint.class});
+		invokeJDBC3 (m, new Object[] {savepoint});
+	}
+
+
+	public void releaseSavepoint (Savepoint savepoint)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		Method m = (Method) _jdbc3.get (RELEASE_SAVEPOINT);
+		if (m == null)
+			m = createJDBC3Method (RELEASE_SAVEPOINT, "releaseSavepoint", 
+				new Class[] {Savepoint.class});
+		invokeJDBC3 (m, new Object[] {savepoint});
+	}
+
+
+	public Statement createStatement (int resultSetType,
+		int resultSetConcurrency, int resultSetHoldability)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		return createStatement (resultSetType, resultSetConcurrency, 
+			resultSetHoldability, true);
+	}
+
+
+	protected Statement createStatement (int resultSetType,
+		int resultSetConcurrency, int resultSetHoldability, boolean wrap)
+		throws SQLException
+	{
+		Statement stmnt;
+		if (_del != null)
+			stmnt = _del.createStatement (resultSetType, resultSetConcurrency,
+				resultSetHoldability, false);
+		else
+		{
+			Method m = (Method) _jdbc3.get (CREATE_STATEMENT);
+			if (m == null)
+				m = createJDBC3Method (CREATE_STATEMENT, "createStatement", 
+					new Class[] {int.class, int.class, int.class});
+			stmnt = (Statement) invokeJDBC3 (m, new Object[] {
+				Numbers.valueOf (resultSetType), 
+				Numbers.valueOf (resultSetConcurrency),
+				Numbers.valueOf (resultSetHoldability)});
+		}
+		if (wrap)
+			stmnt = new DelegatingStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public PreparedStatement prepareStatement (String sql,
+		int resultSetType, int resultSetConcurrency, int resultSetHoldability)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		return prepareStatement (sql, resultSetType, resultSetConcurrency,
+			resultSetHoldability, true);
+	}
+
+
+	protected PreparedStatement prepareStatement (String sql,
+		int resultSetType, int resultSetConcurrency, int resultSetHoldability,
+		boolean wrap)
+		throws SQLException
+	{
+		PreparedStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareStatement (sql, resultSetType, 
+				resultSetConcurrency, resultSetHoldability, false);
+		else
+		{
+			Method m = (Method) _jdbc3.get (PREPARE_STATEMENT);
+			if (m == null)
+				m = createJDBC3Method (PREPARE_STATEMENT, "prepareStatement", 
+					new Class[]{String.class, int.class, int.class, int.class});
+			stmnt = (PreparedStatement) invokeJDBC3 (m, new Object[] { sql,
+				Numbers.valueOf (resultSetType), 
+				Numbers.valueOf (resultSetConcurrency),
+				Numbers.valueOf (resultSetHoldability)});
+		}
+		if (wrap)
+			stmnt = new DelegatingPreparedStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public CallableStatement prepareCall (String sql,
+		int resultSetType, int resultSetConcurrency, int resultSetHoldability)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		return prepareCall (sql, resultSetType, resultSetConcurrency,
+			resultSetHoldability, true);
+	}
+
+
+	protected CallableStatement prepareCall (String sql, int resultSetType, 
+		int resultSetConcurrency, int resultSetHoldability, boolean wrap)
+		throws SQLException
+	{
+		CallableStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareCall (sql, resultSetType, 
+				resultSetConcurrency, resultSetHoldability, false);
+		else
+		{
+			Method m = (Method) _jdbc3.get (PREPARE_CALL);
+			if (m == null)
+				m = createJDBC3Method (PREPARE_CALL, "prepareCall", 
+					new Class[]{String.class, int.class, int.class, int.class});
+			stmnt = (CallableStatement) invokeJDBC3 (m, new Object[] { sql,
+				Numbers.valueOf (resultSetType), 
+				Numbers.valueOf (resultSetConcurrency),
+				Numbers.valueOf (resultSetHoldability)});
+		}
+		if (wrap)
+			stmnt = new DelegatingCallableStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public PreparedStatement prepareStatement (String sql,
+		int autoGeneratedKeys)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		return prepareStatement (sql, autoGeneratedKeys, true);
+	}
+
+
+	protected PreparedStatement prepareStatement (String sql,
+		int autoGeneratedKeys, boolean wrap)
+		throws SQLException
+	{
+		PreparedStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareStatement (sql, autoGeneratedKeys); 
+		else
+		{
+			Method m = (Method) _jdbc3.get (PREPARE_WITH_KEYS);
+			if (m == null)
+				m = createJDBC3Method (PREPARE_WITH_KEYS, "prepareStatement", 
+					new Class[] {String.class, int.class});
+			stmnt = (PreparedStatement) invokeJDBC3 (m, new Object[] { sql,
+				Numbers.valueOf (autoGeneratedKeys)});
+		}
+		if (wrap)
+			stmnt = new DelegatingPreparedStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public PreparedStatement prepareStatement (String sql, int[] columnIndexes)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		return prepareStatement (sql, columnIndexes, true);
+	}
+
+
+	protected PreparedStatement prepareStatement (String sql, 
+		int[] columnIndexes, boolean wrap)
+		throws SQLException
+	{
+		PreparedStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareStatement (sql, columnIndexes, wrap); 
+		else
+		{
+			Method m = (Method) _jdbc3.get (PREPARE_WITH_INDEX);
+			if (m == null)
+				m = createJDBC3Method (PREPARE_WITH_INDEX, "prepareStatement", 
+					new Class[] {String.class, int[].class});
+			stmnt = (PreparedStatement) invokeJDBC3 (m, new Object[] { sql,
+				columnIndexes});
+		}
+		if (wrap)
+			stmnt = new DelegatingPreparedStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	public PreparedStatement prepareStatement (String sql, String[] columnNames)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		return prepareStatement (sql, columnNames, true);
+	}
+
+
+	protected PreparedStatement prepareStatement (String sql, 
+		String[] columnNames, boolean wrap)
+		throws SQLException
+	{
+		assertJDBC3 ();
+		PreparedStatement stmnt;
+		if (_del != null)
+			stmnt = _del.prepareStatement (sql, columnNames, wrap); 
+		else
+		{
+			Method m = (Method) _jdbc3.get (PREPARE_WITH_NAMES);
+			if (m == null)
+				m = createJDBC3Method (PREPARE_WITH_NAMES, "prepareStatement", 
+					new Class[] {String.class, String[].class});
+			stmnt = (PreparedStatement) invokeJDBC3 (m, new Object[] { sql,
+				columnNames});
+		}
+		if (wrap)
+			stmnt = new DelegatingPreparedStatement (stmnt, this);
+		return stmnt;
+	}
+
+
+	private static void assertJDBC3 ()
+	{
+		if (_jdbc3 == null)
+			throw new UnsupportedOperationException (_loc.get ("not-jdbc3"));
+	}
+
+
+	private Object invokeJDBC3 (Method m, Object[] args)
+		throws SQLException
+	{
+		try
+		{
+			return m.invoke (_conn, args);
+		}
+		catch (Throwable t)
+		{
+			if (t instanceof SQLException)
+				throw (SQLException) t;
+			throw new NestableRuntimeException (_loc.get ("invoke-jdbc3"), t);
+		}
+	}
+
+
+	private static Method createJDBC3Method (Object key, String name, 
+		Class[] args)
+	{
+		try
+		{
+			Method m = Connection.class.getMethod (name, args);
+			_jdbc3.put (key, m);
+			return m;
+		}
+		catch (Throwable t)
+		{
+			throw new NestableRuntimeException (_loc.get ("error-jdbc3"), t);
+		}
+	}
+}

Propchange: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingConnection.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDataSource.java
URL: http://svn.apache.org/viewcvs/incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDataSource.java?rev=406215&view=auto
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDataSource.java (added)
+++ incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDataSource.java Sat May 13 20:25:56 2006
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openjpa.lib.jdbc;
+
+
+import java.io.*;
+import java.sql.*;
+import javax.sql.*;
+
+import org.apache.openjpa.lib.util.*;
+import org.apache.openjpa.lib.util.Closeable; 
+
+
+/**
+ *	<p>Wrapper around an existing data source.  Subclasses can override the
+ *	methods whose behavior they mean to change.  The <code>equals</code> and 
+ *	<code>hashCode</code> methods pass through to the base underlying data 
+ *	store.</p>
+ *
+ *	@author		Abe White
+ */
+public class DelegatingDataSource
+	implements DataSource, Closeable
+{
+	private final DataSource 			_ds;
+	private final DelegatingDataSource	_del;
+
+
+	/**
+	 *	Constructor.  Supply wrapped data source.
+	 */
+	public DelegatingDataSource (DataSource ds)
+	{
+		_ds = ds;
+
+		if (_ds instanceof DelegatingDataSource)
+			_del = (DelegatingDataSource) _ds;
+		else
+			_del = null;
+	}
+
+
+	/**
+	 *	Return the wrapped data source.
+	 */
+	public DataSource getDelegate ()
+	{
+		return _ds;
+	}
+
+
+	/**
+	 *	Return the inner-most wrapped delegate.
+	 */
+	public DataSource getInnermostDelegate ()
+	{
+		return (_del == null) ? _ds : _del.getInnermostDelegate ();
+	}
+
+
+	public int hashCode ()
+	{
+		return getInnermostDelegate ().hashCode ();
+	}
+
+
+	public boolean equals (Object other)
+	{
+		if (other == this)
+			return true;
+		if (other instanceof DelegatingDataSource)
+			other = ((DelegatingDataSource) other).getInnermostDelegate ();
+		return getInnermostDelegate ().equals (other);	
+	}
+
+
+	public String toString ()
+	{
+		StringBuffer buf = new StringBuffer ("datasource ").
+			append (hashCode ());
+		appendInfo (buf);
+		return buf.toString ();
+	}
+
+
+	protected void appendInfo (StringBuffer buf)
+	{
+		if (_del != null)
+			_del.appendInfo (buf);
+	}
+
+
+	public PrintWriter getLogWriter ()
+		throws SQLException
+	{
+		return _ds.getLogWriter ();
+	}
+
+
+    public void setLogWriter (PrintWriter out) 
+		throws SQLException
+	{
+		_ds.setLogWriter (out);
+	}
+
+
+	public int getLoginTimeout ()
+		throws SQLException
+	{
+		return _ds.getLoginTimeout ();
+	}
+
+
+    public void setLoginTimeout (int timeout)
+		throws SQLException
+	{
+		_ds.setLoginTimeout (timeout);
+	}
+
+
+	public Connection getConnection ()
+		throws SQLException
+	{
+		return _ds.getConnection ();
+	}
+
+
+	public Connection getConnection (String user, String pass)
+		throws SQLException
+	{
+		if (user == null && pass == null)
+			return _ds.getConnection ();
+		return _ds.getConnection (user, pass);
+	}
+
+
+	public void close ()
+		throws Exception
+	{
+		if (_ds instanceof Closeable)
+			((Closeable) _ds).close ();
+	}
+}

Propchange: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDataSource.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDatabaseMetaData.java
URL: http://svn.apache.org/viewcvs/incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDatabaseMetaData.java?rev=406215&view=auto
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDatabaseMetaData.java (added)
+++ incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDatabaseMetaData.java Sat May 13 20:25:56 2006
@@ -0,0 +1,1265 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openjpa.lib.jdbc;
+
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+
+
+/**
+ *	<p>Wrapper around a DatabaseMetadata instance.</p>
+ *
+ *	@author		Marc Prud'hommeaux
+ */
+public class DelegatingDatabaseMetaData
+	implements DatabaseMetaData
+{
+	private final DatabaseMetaData 	_metaData;
+	private final Connection	 	_conn;
+
+
+	public DelegatingDatabaseMetaData (DatabaseMetaData metaData,
+		Connection conn)
+	{
+		_conn = conn;
+		_metaData = metaData;
+	}
+
+
+	/**
+	 *	Return the base underlying database metadata.
+	 */
+	public DatabaseMetaData getInnermostDelegate ()
+	{
+		return _metaData instanceof DelegatingDatabaseMetaData ?
+			((DelegatingDatabaseMetaData)_metaData).getInnermostDelegate ()
+			: _metaData;
+	}
+
+
+	public int hashCode ()
+	{
+		return getInnermostDelegate ().hashCode ();
+	}
+
+
+	public boolean equals (Object other)
+	{
+		if (other == this)
+			return true;
+		if (other instanceof DelegatingDatabaseMetaData)
+			other = ((DelegatingDatabaseMetaData) other)
+			.getInnermostDelegate ();
+		return getInnermostDelegate ().equals (other);
+	}
+
+
+	public String toString ()
+	{
+		StringBuffer buf = new StringBuffer ("metadata ").append (hashCode ());
+		buf.append ("[").append (_metaData.toString ()).append ("]");
+		return buf.toString ();
+	}
+
+
+	public boolean allProceduresAreCallable ()
+		throws SQLException
+	{
+		return _metaData.allProceduresAreCallable ();
+	}
+
+
+	public boolean allTablesAreSelectable ()
+		throws SQLException
+	{
+		return _metaData.allTablesAreSelectable ();
+	}
+
+
+	public boolean dataDefinitionCausesTransactionCommit ()
+		throws SQLException
+	{
+		return _metaData.dataDefinitionCausesTransactionCommit ();
+	}
+
+
+	public boolean dataDefinitionIgnoredInTransactions ()
+		throws SQLException
+	{
+		return _metaData.dataDefinitionIgnoredInTransactions ();
+	}
+
+
+	public boolean deletesAreDetected (int type)
+		throws SQLException
+	{
+		return _metaData.deletesAreDetected (type);
+	}
+
+
+	public boolean doesMaxRowSizeIncludeBlobs ()
+		throws SQLException
+	{
+		return _metaData.doesMaxRowSizeIncludeBlobs ();
+	}
+
+
+	public ResultSet getBestRowIdentifier (String catalog,
+		String schema, String table, int scope, boolean nullable)
+		throws SQLException
+	{
+		return _metaData.getBestRowIdentifier (catalog, schema,
+			table, scope, nullable);
+	}
+
+
+	public ResultSet getCatalogs ()
+		throws SQLException
+	{
+		return _metaData.getCatalogs ();
+	}
+
+
+	public String getCatalogSeparator ()
+		throws SQLException
+	{
+		return _metaData.getCatalogSeparator ();
+	}
+
+
+	public String getCatalogTerm ()
+		throws SQLException
+	{
+		return _metaData.getCatalogTerm ();
+	}
+
+
+	public ResultSet getColumnPrivileges (String catalog, String schema,
+		String table, String columnNamePattern)
+		throws SQLException
+	{
+		return _metaData.getColumnPrivileges (catalog, schema,
+			table, columnNamePattern);
+	}
+
+
+	public ResultSet getColumns (String catalog, String schemaPattern,
+		String tableNamePattern, String columnNamePattern)
+		throws SQLException
+	{
+		return _metaData.getColumns (catalog, schemaPattern,
+			tableNamePattern, columnNamePattern);
+	}
+
+
+	public Connection getConnection ()
+		throws SQLException
+	{
+		return _conn;
+	}
+
+
+	public ResultSet getCrossReference (String primaryCatalog,
+		String primarySchema, String primaryTable, String foreignCatalog,
+		String foreignSchema, String foreignTable)
+		throws SQLException
+	{
+		return _metaData.getCrossReference (primaryCatalog, primarySchema,
+			primaryTable, foreignCatalog, foreignSchema, foreignTable);
+	}
+
+
+	public String getDatabaseProductName ()
+		throws SQLException
+	{
+		return _metaData.getDatabaseProductName ();
+	}
+
+
+	public String getDatabaseProductVersion ()
+		throws SQLException
+	{
+		return _metaData.getDatabaseProductVersion ();
+	}
+
+
+	public int getDefaultTransactionIsolation ()
+		throws SQLException
+	{
+		return _metaData.getDefaultTransactionIsolation ();
+	}
+
+
+	public int getDriverMajorVersion ()
+	{
+		return _metaData.getDriverMajorVersion ();
+	}
+
+
+	public int getDriverMinorVersion ()
+	{
+		return _metaData.getDriverMinorVersion ();
+	}
+
+
+	public String getDriverName ()
+		throws SQLException
+	{
+		return _metaData.getDriverName ();
+	}
+
+
+	public String getDriverVersion ()
+		throws SQLException
+	{
+		return _metaData.getDriverVersion ();
+	}
+
+
+	public ResultSet getExportedKeys (String catalog, String schema,
+		String table)
+		throws SQLException
+	{
+		return _metaData.getExportedKeys (catalog, schema, table);
+	}
+
+
+	public String getExtraNameCharacters ()
+		throws SQLException
+	{
+		return _metaData.getExtraNameCharacters ();
+	}
+
+
+	public String getIdentifierQuoteString ()
+		throws SQLException
+	{
+		return _metaData.getIdentifierQuoteString ();
+	}
+
+
+	public ResultSet getImportedKeys (String catalog, String schema,
+		String table)
+		throws SQLException
+	{
+		return _metaData.getImportedKeys (catalog, schema, table);
+	}
+
+
+	public ResultSet getIndexInfo (String catalog, String schema,
+		String table, boolean unique, boolean approximate)
+		throws SQLException
+	{
+		return _metaData.getIndexInfo (catalog, schema, table, unique,
+			approximate);
+	}
+
+
+	public int getMaxBinaryLiteralLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxBinaryLiteralLength ();
+	}
+
+
+	public int getMaxCatalogNameLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxCatalogNameLength ();
+	}
+
+
+	public int getMaxCharLiteralLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxCharLiteralLength ();
+	}
+
+
+	public int getMaxColumnNameLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxColumnNameLength ();
+	}
+
+
+	public int getMaxColumnsInGroupBy ()
+		throws SQLException
+	{
+		return _metaData.getMaxColumnsInGroupBy ();
+	}
+
+
+	public int getMaxColumnsInIndex ()
+		throws SQLException
+	{
+		return _metaData.getMaxColumnsInIndex ();
+	}
+
+
+	public int getMaxColumnsInOrderBy ()
+		throws SQLException
+	{
+		return _metaData.getMaxColumnsInOrderBy ();
+	}
+
+
+	public int getMaxColumnsInSelect ()
+		throws SQLException
+	{
+		return _metaData.getMaxColumnsInSelect ();
+	}
+
+
+	public int getMaxColumnsInTable ()
+		throws SQLException
+	{
+		return _metaData.getMaxColumnsInTable ();
+	}
+
+
+	public int getMaxConnections ()
+		throws SQLException
+	{
+		return _metaData.getMaxConnections ();
+	}
+
+
+	public int getMaxCursorNameLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxCursorNameLength ();
+	}
+
+
+	public int getMaxIndexLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxIndexLength ();
+	}
+
+
+	public int getMaxProcedureNameLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxProcedureNameLength ();
+	}
+
+
+	public int getMaxRowSize ()
+		throws SQLException
+	{
+		return _metaData.getMaxRowSize ();
+	}
+
+
+	public int getMaxSchemaNameLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxSchemaNameLength ();
+	}
+
+
+	public int getMaxStatementLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxStatementLength ();
+	}
+
+
+	public int getMaxStatements ()
+		throws SQLException
+	{
+		return _metaData.getMaxStatements ();
+	}
+
+
+	public int getMaxTableNameLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxTableNameLength ();
+	}
+
+
+	public int getMaxTablesInSelect ()
+		throws SQLException
+	{
+		return _metaData.getMaxTablesInSelect ();
+	}
+
+
+	public int getMaxUserNameLength ()
+		throws SQLException
+	{
+		return _metaData.getMaxUserNameLength ();
+	}
+
+
+	public String getNumericFunctions ()
+		throws SQLException
+	{
+		return _metaData.getNumericFunctions ();
+	}
+
+
+	public ResultSet getPrimaryKeys (String catalog, String schema,
+		String table)
+		throws SQLException
+	{
+		return _metaData.getPrimaryKeys (catalog, schema, table);
+	}
+
+
+	public ResultSet getProcedureColumns (String catalog, String schemaPattern,
+		String procedureNamePattern, String columnNamePattern)
+		throws SQLException
+	{
+		return _metaData.getProcedureColumns (catalog, schemaPattern,
+			procedureNamePattern, columnNamePattern);
+	}
+
+
+	public ResultSet getProcedures (String catalog, String schemaPattern,
+		String procedureNamePattern)
+		throws SQLException
+	{
+		return _metaData.getProcedures (catalog, schemaPattern,
+			procedureNamePattern);
+	}
+
+
+	public String getProcedureTerm ()
+		throws SQLException
+	{
+		return _metaData.getProcedureTerm ();
+	}
+
+
+	public ResultSet getSchemas ()
+		throws SQLException
+	{
+		return _metaData.getSchemas ();
+	}
+
+
+	public String getSchemaTerm ()
+		throws SQLException
+	{
+		return _metaData.getSchemaTerm ();
+	}
+
+
+	public String getSearchStringEscape ()
+		throws SQLException
+	{
+		return _metaData.getSearchStringEscape ();
+	}
+
+
+	public String getSQLKeywords ()
+		throws SQLException
+	{
+		return _metaData.getSQLKeywords ();
+	}
+
+
+	public String getStringFunctions ()
+		throws SQLException
+	{
+		return _metaData.getStringFunctions ();
+	}
+
+
+	public String getSystemFunctions ()
+		throws SQLException
+	{
+		return _metaData.getSystemFunctions ();
+	}
+
+
+	public ResultSet getTablePrivileges (String catalog,
+		String schemaPattern, String tableNamePattern)
+		throws SQLException
+	{
+		return _metaData.getTablePrivileges (catalog, schemaPattern,
+			tableNamePattern);
+	}
+
+
+	public ResultSet getTables (String catalog, String schemaPattern,
+		String tableNamePattern, String[] types)
+		throws SQLException
+	{
+		return _metaData.getTables (catalog, schemaPattern,
+			tableNamePattern, types);
+	}
+
+
+	public ResultSet getTableTypes ()
+		throws SQLException
+	{
+		return _metaData.getTableTypes ();
+	}
+
+
+	public String getTimeDateFunctions ()
+		throws SQLException
+	{
+		return _metaData.getTimeDateFunctions ();
+	}
+
+
+	public ResultSet getTypeInfo ()
+		throws SQLException
+	{
+		return _metaData.getTypeInfo ();
+	}
+
+
+	public ResultSet getUDTs (String catalog, String schemaPattern,
+		String typeNamePattern, int[] types)
+		throws SQLException
+	{
+		return _metaData.getUDTs (catalog, schemaPattern,
+			typeNamePattern, types);
+	}
+
+
+	public String getURL ()
+		throws SQLException
+	{
+		return _metaData.getURL ();
+	}
+
+
+	public String getUserName ()
+		throws SQLException
+	{
+		return _metaData.getUserName ();
+	}
+
+
+	public ResultSet getVersionColumns (String catalog,
+		String schema, String table)
+		throws SQLException
+	{
+		return _metaData.getVersionColumns (catalog, schema, table);
+	}
+
+
+	public boolean insertsAreDetected (int type)
+		throws SQLException
+	{
+		return _metaData.insertsAreDetected (type);
+	}
+
+
+	public boolean isCatalogAtStart ()
+		throws SQLException
+	{
+		return _metaData.isCatalogAtStart ();
+	}
+
+
+	public boolean isReadOnly ()
+		throws SQLException
+	{
+		return _metaData.isReadOnly ();
+	}
+
+
+	public boolean nullPlusNonNullIsNull ()
+		throws SQLException
+	{
+		return _metaData.nullPlusNonNullIsNull ();
+	}
+
+
+	public boolean nullsAreSortedAtEnd ()
+		throws SQLException
+	{
+		return _metaData.nullsAreSortedAtEnd ();
+	}
+
+
+	public boolean nullsAreSortedAtStart ()
+		throws SQLException
+	{
+		return _metaData.nullsAreSortedAtStart ();
+	}
+
+
+	public boolean nullsAreSortedHigh ()
+		throws SQLException
+	{
+		return _metaData.nullsAreSortedHigh ();
+	}
+
+
+	public boolean nullsAreSortedLow ()
+		throws SQLException
+	{
+		return _metaData.nullsAreSortedLow ();
+	}
+
+
+	public boolean othersDeletesAreVisible (int type)
+		throws SQLException
+	{
+		return _metaData.othersDeletesAreVisible (type);
+	}
+
+
+	public boolean othersInsertsAreVisible (int type)
+		throws SQLException
+	{
+		return _metaData.othersInsertsAreVisible (type);
+	}
+
+
+	public boolean othersUpdatesAreVisible (int type)
+		throws SQLException
+	{
+		return _metaData.othersUpdatesAreVisible (type);
+	}
+
+
+	public boolean ownDeletesAreVisible (int type)
+		throws SQLException
+	{
+		return _metaData.ownDeletesAreVisible (type);
+	}
+
+
+	public boolean ownInsertsAreVisible (int type)
+		throws SQLException
+	{
+		return _metaData.ownInsertsAreVisible (type);
+	}
+
+
+	public boolean ownUpdatesAreVisible (int type)
+		throws SQLException
+	{
+		return _metaData.ownUpdatesAreVisible (type);
+	}
+
+
+	public boolean storesLowerCaseIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.storesLowerCaseIdentifiers ();
+	}
+
+
+	public boolean storesLowerCaseQuotedIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.storesLowerCaseQuotedIdentifiers ();
+	}
+
+
+	public boolean storesMixedCaseIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.storesMixedCaseIdentifiers ();
+	}
+
+
+	public boolean storesMixedCaseQuotedIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.storesMixedCaseQuotedIdentifiers ();
+	}
+
+
+	public boolean storesUpperCaseIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.storesUpperCaseIdentifiers ();
+	}
+
+
+	public boolean storesUpperCaseQuotedIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.storesUpperCaseQuotedIdentifiers ();
+	}
+
+
+	public boolean supportsAlterTableWithAddColumn ()
+		throws SQLException
+	{
+		return _metaData.supportsAlterTableWithAddColumn ();
+	}
+
+
+	public boolean supportsAlterTableWithDropColumn ()
+		throws SQLException
+	{
+		return _metaData.supportsAlterTableWithDropColumn ();
+	}
+
+
+	public boolean supportsANSI92EntryLevelSQL ()
+		throws SQLException
+	{
+		return _metaData.supportsANSI92EntryLevelSQL ();
+	}
+
+
+	public boolean supportsANSI92FullSQL ()
+		throws SQLException
+	{
+		return _metaData.supportsANSI92FullSQL ();
+	}
+
+
+	public boolean supportsANSI92IntermediateSQL ()
+		throws SQLException
+	{
+		return _metaData.supportsANSI92IntermediateSQL ();
+	}
+
+
+	public boolean supportsBatchUpdates ()
+		throws SQLException
+	{
+		return _metaData.supportsBatchUpdates ();
+	}
+
+
+	public boolean supportsCatalogsInDataManipulation ()
+		throws SQLException
+	{
+		return _metaData.supportsCatalogsInDataManipulation ();
+	}
+
+
+	public boolean supportsCatalogsInIndexDefinitions ()
+		throws SQLException
+	{
+		return _metaData.supportsCatalogsInIndexDefinitions ();
+	}
+
+
+	public boolean supportsCatalogsInPrivilegeDefinitions ()
+		throws SQLException
+	{
+		return _metaData.supportsCatalogsInPrivilegeDefinitions ();
+	}
+
+
+	public boolean supportsCatalogsInProcedureCalls ()
+		throws SQLException
+	{
+		return _metaData.supportsCatalogsInProcedureCalls ();
+	}
+
+
+	public boolean supportsCatalogsInTableDefinitions ()
+		throws SQLException
+	{
+		return _metaData.supportsCatalogsInTableDefinitions ();
+	}
+
+
+	public boolean supportsColumnAliasing ()
+		throws SQLException
+	{
+		return _metaData.supportsColumnAliasing ();
+	}
+
+
+	public boolean supportsConvert ()
+		throws SQLException
+	{
+		return _metaData.supportsConvert ();
+	}
+
+
+	public boolean supportsConvert (int fromType, int toType)
+		throws SQLException
+	{
+		return _metaData.supportsConvert (fromType, toType);
+	}
+
+
+	public boolean supportsCoreSQLGrammar ()
+		throws SQLException
+	{
+		return _metaData.supportsCoreSQLGrammar ();
+	}
+
+
+	public boolean supportsCorrelatedSubqueries ()
+		throws SQLException
+	{
+		return _metaData.supportsCorrelatedSubqueries ();
+	}
+
+
+	public boolean supportsDataDefinitionAndDataManipulationTransactions ()
+		throws SQLException
+	{
+		return _metaData
+			.supportsDataDefinitionAndDataManipulationTransactions ();
+	}
+
+
+	public boolean supportsDataManipulationTransactionsOnly ()
+		throws SQLException
+	{
+		return _metaData.supportsDataManipulationTransactionsOnly ();
+	}
+
+
+	public boolean supportsDifferentTableCorrelationNames ()
+		throws SQLException
+	{
+		return _metaData.supportsDifferentTableCorrelationNames ();
+	}
+
+
+	public boolean supportsExpressionsInOrderBy ()
+		throws SQLException
+	{
+		return _metaData.supportsExpressionsInOrderBy ();
+	}
+
+
+	public boolean supportsExtendedSQLGrammar ()
+		throws SQLException
+	{
+		return _metaData.supportsExtendedSQLGrammar ();
+	}
+
+
+	public boolean supportsFullOuterJoins ()
+		throws SQLException
+	{
+		return _metaData.supportsFullOuterJoins ();
+	}
+
+
+	public boolean supportsGroupBy ()
+		throws SQLException
+	{
+		return _metaData.supportsGroupBy ();
+	}
+
+
+	public boolean supportsGroupByBeyondSelect ()
+		throws SQLException
+	{
+		return _metaData.supportsGroupByBeyondSelect ();
+	}
+
+
+	public boolean supportsGroupByUnrelated ()
+		throws SQLException
+	{
+		return _metaData.supportsGroupByUnrelated ();
+	}
+
+
+	public boolean supportsIntegrityEnhancementFacility ()
+		throws SQLException
+	{
+		return _metaData.supportsIntegrityEnhancementFacility ();
+	}
+
+
+	public boolean supportsLikeEscapeClause ()
+		throws SQLException
+	{
+		return _metaData.supportsLikeEscapeClause ();
+	}
+
+
+	public boolean supportsLimitedOuterJoins ()
+		throws SQLException
+	{
+		return _metaData.supportsLimitedOuterJoins ();
+	}
+
+
+	public boolean supportsMinimumSQLGrammar ()
+		throws SQLException
+	{
+		return _metaData.supportsMinimumSQLGrammar ();
+	}
+
+
+	public boolean supportsMixedCaseIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.supportsMixedCaseIdentifiers ();
+	}
+
+
+	public boolean supportsMixedCaseQuotedIdentifiers ()
+		throws SQLException
+	{
+		return _metaData.supportsMixedCaseQuotedIdentifiers ();
+	}
+
+
+	public boolean supportsMultipleResultSets ()
+		throws SQLException
+	{
+		return _metaData.supportsMultipleResultSets ();
+	}
+
+
+	public boolean supportsMultipleTransactions ()
+		throws SQLException
+	{
+		return _metaData.supportsMultipleTransactions ();
+	}
+
+
+	public boolean supportsNonNullableColumns ()
+		throws SQLException
+	{
+		return _metaData.supportsNonNullableColumns ();
+	}
+
+
+	public boolean supportsOpenCursorsAcrossCommit ()
+		throws SQLException
+	{
+		return _metaData.supportsOpenCursorsAcrossCommit ();
+	}
+
+
+	public boolean supportsOpenCursorsAcrossRollback ()
+		throws SQLException
+	{
+		return _metaData.supportsOpenCursorsAcrossRollback ();
+	}
+
+
+	public boolean supportsOpenStatementsAcrossCommit ()
+		throws SQLException
+	{
+		return _metaData.supportsOpenStatementsAcrossCommit ();
+	}
+
+
+	public boolean supportsOpenStatementsAcrossRollback ()
+		throws SQLException
+	{
+		return _metaData.supportsOpenStatementsAcrossRollback ();
+	}
+
+
+	public boolean supportsOrderByUnrelated ()
+		throws SQLException
+	{
+		return _metaData.supportsOrderByUnrelated ();
+	}
+
+
+	public boolean supportsOuterJoins ()
+		throws SQLException
+	{
+		return _metaData.supportsOuterJoins ();
+	}
+
+
+	public boolean supportsPositionedDelete ()
+		throws SQLException
+	{
+		return _metaData.supportsPositionedDelete ();
+	}
+
+
+	public boolean supportsPositionedUpdate ()
+		throws SQLException
+	{
+		return _metaData.supportsPositionedUpdate ();
+	}
+
+
+	public boolean supportsResultSetConcurrency (int type, int concurrency)
+		throws SQLException
+	{
+		return _metaData.supportsResultSetConcurrency (type, concurrency);
+	}
+
+
+	public boolean supportsResultSetType (int type)
+		throws SQLException
+	{
+		return _metaData.supportsResultSetType (type);
+	}
+
+
+	public boolean supportsSchemasInDataManipulation ()
+		throws SQLException
+	{
+		return _metaData.supportsSchemasInDataManipulation ();
+	}
+
+
+	public boolean supportsSchemasInIndexDefinitions ()
+		throws SQLException
+	{
+		return _metaData.supportsSchemasInIndexDefinitions ();
+	}
+
+
+	public boolean supportsSchemasInPrivilegeDefinitions ()
+		throws SQLException
+	{
+		return _metaData.supportsSchemasInPrivilegeDefinitions ();
+	}
+
+
+	public boolean supportsSchemasInProcedureCalls ()
+		throws SQLException
+	{
+		return _metaData.supportsSchemasInProcedureCalls ();
+	}
+
+
+	public boolean supportsSchemasInTableDefinitions ()
+		throws SQLException
+	{
+		return _metaData.supportsSchemasInTableDefinitions ();
+	}
+
+
+	public boolean supportsSelectForUpdate ()
+		throws SQLException
+	{
+		return _metaData.supportsSelectForUpdate ();
+	}
+
+
+	public boolean supportsStoredProcedures ()
+		throws SQLException
+	{
+		return _metaData.supportsStoredProcedures ();
+	}
+
+
+	public boolean supportsSubqueriesInComparisons ()
+		throws SQLException
+	{
+		return _metaData.supportsSubqueriesInComparisons ();
+	}
+
+
+	public boolean supportsSubqueriesInExists ()
+		throws SQLException
+	{
+		return _metaData.supportsSubqueriesInExists ();
+	}
+
+
+	public boolean supportsSubqueriesInIns ()
+		throws SQLException
+	{
+		return _metaData.supportsSubqueriesInIns ();
+	}
+
+
+	public boolean supportsSubqueriesInQuantifieds ()
+		throws SQLException
+	{
+		return _metaData.supportsSubqueriesInQuantifieds ();
+	}
+
+
+	public boolean supportsTableCorrelationNames ()
+		throws SQLException
+	{
+		return _metaData.supportsTableCorrelationNames ();
+	}
+
+
+	public boolean supportsTransactionIsolationLevel (int level)
+		throws SQLException
+	{
+		return _metaData.supportsTransactionIsolationLevel (level);
+	}
+
+
+	public boolean supportsTransactions ()
+		throws SQLException
+	{
+		return _metaData.supportsTransactions ();
+	}
+
+
+	public boolean supportsUnion ()
+		throws SQLException
+	{
+		return _metaData.supportsUnion ();
+	}
+
+
+	public boolean supportsUnionAll ()
+		throws SQLException
+	{
+		return _metaData.supportsUnionAll ();
+	}
+
+
+	public boolean updatesAreDetected (int type)
+		throws SQLException
+	{
+		return _metaData.updatesAreDetected (type);
+	}
+
+
+	public boolean usesLocalFilePerTable ()
+		throws SQLException
+	{
+		return _metaData.usesLocalFilePerTable ();
+	}
+
+
+	public boolean usesLocalFiles ()
+		throws SQLException
+	{
+		return _metaData.usesLocalFiles ();
+	}
+
+
+	// JDBC 3.0 methods (unsupported) follow; these are required to be able to 
+	// compile against JDK 1.4
+
+
+	public boolean supportsSavepoints ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean supportsNamedParameters ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean supportsMultipleOpenResults ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean supportsGetGeneratedKeys ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public ResultSet getSuperTypes (String catalog, String schemaPatter,
+		String typeNamePattern)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public ResultSet getSuperTables (String catalog, String schemaPatter,
+		String tableNamePattern)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public ResultSet getAttributes (String catalog, String schemaPatter,
+		String typeNamePattern, String attributeNamePattern)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean supportsResultSetHoldability (int holdability)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getResultSetHoldability ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getDatabaseMajorVersion ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getDatabaseMinorVersion ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getJDBCMajorVersion ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getJDBCMinorVersion ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getSQLStateType ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean locatorsUpdateCopy ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean supportsStatementPooling ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+}
+

Propchange: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingDatabaseMetaData.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingPreparedStatement.java
URL: http://svn.apache.org/viewcvs/incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingPreparedStatement.java?rev=406215&view=auto
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingPreparedStatement.java (added)
+++ incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingPreparedStatement.java Sat May 13 20:25:56 2006
@@ -0,0 +1,684 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openjpa.lib.jdbc;
+
+
+import java.io.*;
+import java.math.*;
+import java.net.*;
+import java.sql.*;
+import java.sql.Date;
+import java.util.*;
+
+import org.apache.openjpa.lib.util.*;
+import org.apache.openjpa.lib.util.Closeable;
+
+
+/**
+ *	<p>Wrapper around an existing statement.  Subclasses can override the
+ *	methods whose behavior they mean to change.  The <code>equals</code> and 
+ *	<code>hashCode</code> methods pass through to the base underlying data 
+ *	store statement.</p>
+ *
+ *	@author		Abe White
+ */
+public class DelegatingPreparedStatement
+	implements PreparedStatement, Closeable
+{
+	private final PreparedStatement 			_stmnt;
+	private final DelegatingPreparedStatement	_del;
+	private final Connection					_conn;
+
+
+	public DelegatingPreparedStatement (PreparedStatement stmnt, 
+		Connection conn)
+	{
+		_conn = conn;
+		_stmnt = stmnt;
+		if (_stmnt instanceof DelegatingPreparedStatement)
+			_del = (DelegatingPreparedStatement) _stmnt;
+		else
+			_del = null;
+	}
+
+
+	protected ResultSet wrapResult (ResultSet rs, boolean wrap)
+	{
+		if (!wrap || rs == null)
+			return rs;
+		return new DelegatingResultSet (rs, this);
+	}
+
+
+	/**
+	 *	Return the wrapped statement.
+	 */
+	public PreparedStatement getDelegate ()
+	{
+		return _stmnt;
+	}
+
+
+	/**
+	 *	Return the base underlying data store statement.
+	 */
+	public PreparedStatement getInnermostDelegate ()
+	{
+		return (_del == null) ? _stmnt : _del.getInnermostDelegate ();
+	}
+
+
+	public int hashCode ()
+	{
+		return getInnermostDelegate ().hashCode ();
+	}
+
+
+	public boolean equals (Object other)
+	{
+		if (other == this)
+			return true;
+		if (other instanceof DelegatingPreparedStatement)
+			other = ((DelegatingPreparedStatement) other).
+				getInnermostDelegate ();
+		return getInnermostDelegate ().equals (other);
+	}
+
+
+	public String toString ()
+	{
+		StringBuffer buf = new StringBuffer ("prepstmnt ").append (hashCode ());
+		appendInfo (buf);
+		return buf.toString ();
+	}
+
+
+	protected void appendInfo (StringBuffer buf)
+	{
+		if (_del != null)
+			_del.appendInfo (buf);
+	}
+
+
+    public ResultSet executeQuery (String str) 
+		throws SQLException
+	{
+		return executeQuery (str, true);
+	}
+
+
+	/**
+ 	 *	Execute the query, with the option of not wrapping it in a
+	 *	{@link DelegatingResultSet}, which is the default.
+	 */
+	protected ResultSet executeQuery (String sql, boolean wrap)
+		throws SQLException
+	{
+		ResultSet rs;
+		if (_del != null)
+			rs = _del.executeQuery (sql, false);
+		else
+			rs = _stmnt.executeQuery (sql);
+		return wrapResult (rs, wrap);
+	}
+
+
+    public int executeUpdate (String str) 
+		throws SQLException
+	{
+		return _stmnt.executeUpdate (str);
+	}
+
+
+    public boolean execute (String str) 
+		throws SQLException
+	{
+		return _stmnt.execute (str);
+	}
+
+
+    public void close () 
+		throws SQLException
+	{
+		_stmnt.close ();
+	}
+
+
+    public int getMaxFieldSize () 
+		throws SQLException
+	{
+		return _stmnt.getMaxFieldSize ();
+	}
+
+
+    public void setMaxFieldSize (int i) 
+		throws SQLException
+	{
+		_stmnt.setMaxFieldSize (i);
+	}
+
+
+    public int getMaxRows () 
+		throws SQLException
+	{
+		return _stmnt.getMaxRows ();
+	}
+
+
+    public void setMaxRows (int i) 
+		throws SQLException
+	{
+		_stmnt.setMaxRows (i);
+	}
+
+
+    public void setEscapeProcessing (boolean bool) 
+		throws SQLException
+	{
+		_stmnt.setEscapeProcessing (bool);
+	}
+
+
+    public int getQueryTimeout () 
+		throws SQLException
+	{
+		return _stmnt.getQueryTimeout ();
+	}
+
+
+    public void setQueryTimeout (int i) 
+		throws SQLException
+	{
+		_stmnt.setQueryTimeout (i);
+	}
+
+
+    public void cancel () 
+		throws SQLException
+	{
+		_stmnt.cancel ();
+	}
+
+
+    public SQLWarning getWarnings () 
+		throws SQLException
+	{
+		return _stmnt.getWarnings ();
+	}
+
+
+    public void clearWarnings () 
+		throws SQLException
+	{
+		_stmnt.clearWarnings ();
+	}
+
+
+    public void setCursorName (String str) 
+		throws SQLException
+	{
+		_stmnt.setCursorName (str);
+	}
+
+
+    public ResultSet getResultSet () 
+		throws SQLException
+	{
+		return getResultSet (true);
+	}
+
+
+	/**
+ 	 *	Get the last result set, with the option of not wrapping it in a
+	 *	{@link DelegatingResultSet}, which is the default.
+	 */
+	protected ResultSet getResultSet (boolean wrap)
+		throws SQLException
+	{
+		ResultSet rs;
+		if (_del != null)
+			rs = _del.getResultSet (false);
+		else
+			rs = _stmnt.getResultSet ();
+		return wrapResult (rs, wrap);
+	}
+
+
+    public int getUpdateCount () 
+		throws SQLException
+	{
+		return _stmnt.getUpdateCount ();
+	}
+
+
+    public boolean getMoreResults () 
+		throws SQLException
+	{
+		return _stmnt.getMoreResults ();
+	}
+
+
+    public void setFetchDirection (int i) 
+		throws SQLException
+	{
+		_stmnt.setFetchDirection (i);
+	}
+
+
+    public int getFetchDirection () 
+		throws SQLException
+	{
+		return _stmnt.getFetchDirection ();
+	}
+
+
+    public void setFetchSize (int i) 
+		throws SQLException
+	{
+		_stmnt.setFetchSize (i);
+	}
+
+
+    public int getFetchSize () 
+		throws SQLException
+	{
+		return _stmnt.getFetchSize ();
+	}
+
+
+    public int getResultSetConcurrency () 
+		throws SQLException
+	{
+		return _stmnt.getResultSetConcurrency ();
+	}
+
+
+    public int getResultSetType () 
+		throws SQLException
+	{
+		return _stmnt.getResultSetType ();
+	}
+
+
+    public void addBatch (String str) 
+		throws SQLException
+	{
+		_stmnt.addBatch (str);
+	}
+
+
+    public void clearBatch () 
+		throws SQLException
+	{
+		_stmnt.clearBatch ();
+	}
+
+
+    public int[] executeBatch ()
+		throws SQLException
+	{
+		return _stmnt.executeBatch ();
+	}
+
+
+    public Connection getConnection () 
+		throws SQLException
+	{
+		return _conn;
+	}
+
+
+	public ResultSet executeQuery () 
+		throws SQLException
+	{
+		return executeQuery (true);
+	}
+
+
+	/**
+ 	 *	Execute the query, with the option of not wrapping it in a
+	 *	{@link DelegatingResultSet}, which is the default.
+	 */
+	protected ResultSet executeQuery (boolean wrap)
+		throws SQLException
+	{
+		ResultSet rs;
+		if (_del != null)
+			rs = _del.executeQuery (false);
+		else
+			rs = _stmnt.executeQuery ();
+		return wrapResult (rs, wrap);
+	}
+
+
+	public int executeUpdate  () 
+		throws SQLException
+	{
+		return _stmnt.executeUpdate ();
+	}
+
+
+	public void setNull (int i1, int i2) 
+		throws SQLException
+	{
+		_stmnt.setNull (i1, i2);
+	}
+
+
+	public void setBoolean (int i, boolean b) 
+		throws SQLException
+	{
+		_stmnt.setBoolean (i, b);
+	}
+
+
+	public void setByte (int i, byte b) 
+		throws SQLException
+	{
+		_stmnt.setByte (i, b);
+	}
+
+
+	public void setShort (int i, short s) 
+		throws SQLException
+	{
+		_stmnt.setShort (i, s);
+	}
+
+
+	public void setInt (int i1, int i2) 
+		throws SQLException
+	{
+		_stmnt.setInt (i1, i2);
+	}
+
+
+	public void setLong (int i, long l) 
+		throws SQLException
+	{
+		_stmnt.setLong (i, l);
+	}
+
+
+	public void setFloat (int i, float f) 
+		throws SQLException
+	{
+		_stmnt.setFloat (i, f);
+	}
+
+
+	public void setDouble (int i, double d) 
+		throws SQLException
+	{
+		_stmnt.setDouble (i, d);
+	}
+
+
+	public void setBigDecimal (int i, BigDecimal bd) 
+		throws SQLException
+	{
+		_stmnt.setBigDecimal (i, bd);
+	}
+
+
+	public void setString (int i, String s) 
+		throws SQLException
+	{
+		_stmnt.setString (i, s);
+	}
+
+
+	public void setBytes (int i, byte[] b) 
+		throws SQLException
+	{
+		_stmnt.setBytes (i, b);
+	}
+
+
+	public void setDate (int i, Date d) 
+		throws SQLException
+	{
+		_stmnt.setDate (i, d);
+	}
+
+
+	public void setTime (int i, Time t) 
+		throws SQLException
+	{
+		_stmnt.setTime (i, t);
+	}
+
+
+	public void setTimestamp (int i, Timestamp t) 
+		throws SQLException
+	{
+		_stmnt.setTimestamp (i, t);
+	}
+
+
+	public void setAsciiStream (int i1, InputStream is, int i2) 
+		throws SQLException
+	{
+		_stmnt.setAsciiStream (i1, is, i2);
+	}
+
+
+	public void setUnicodeStream (int i1, InputStream is, int i2) 
+		throws SQLException
+	{
+		_stmnt.setUnicodeStream (i1, is, i2);
+	}
+
+
+	public void setBinaryStream (int i1, InputStream is, int i2) 
+		throws SQLException
+	{
+		_stmnt.setBinaryStream (i1, is, i2);
+	}
+
+
+    public void clearParameters () 
+		throws SQLException
+	{
+		_stmnt.clearParameters ();
+	}
+
+
+	public void setObject (int i1, Object o, int i2, int i3) 
+		throws SQLException
+	{
+		_stmnt.setObject (i1, o, i2, i3);
+	}
+
+
+	public void setObject (int i1, Object o, int i2)
+		throws SQLException
+	{
+		_stmnt.setObject (i1, o, i2);
+	}
+
+
+	public void setObject (int i, Object o) 
+		throws SQLException
+	{
+		_stmnt.setObject (i, o);
+	}
+
+
+    public boolean execute () 
+		throws SQLException
+	{
+		return _stmnt.execute ();
+	}
+
+
+    public void addBatch () 
+		throws SQLException
+	{
+		_stmnt.addBatch ();
+	}
+
+
+	public void setCharacterStream (int i1, Reader r, int i2)
+		throws SQLException
+	{
+		_stmnt.setCharacterStream (i1, r, i2);
+	}
+
+
+	public void setRef (int i, Ref r) 
+		throws SQLException
+	{
+		_stmnt.setRef (i, r);
+	}
+
+
+	public void setBlob (int i, Blob b) 
+		throws SQLException
+	{
+		_stmnt.setBlob (i, b);
+	}
+
+
+	public void setClob (int i, Clob c) 
+		throws SQLException
+	{
+		_stmnt.setClob (i, c);
+	}
+
+
+	public void setArray (int i, Array a) 
+		throws SQLException
+	{
+		_stmnt.setArray (i, a);
+	}
+
+
+    public ResultSetMetaData getMetaData () 
+		throws SQLException
+	{
+		return _stmnt.getMetaData ();
+	}
+
+
+	public void setDate (int i, Date d, Calendar c) 
+		throws SQLException
+	{
+		_stmnt.setDate (i, d, c);
+	}
+
+
+	public void setTime (int i, Time t, Calendar c) 
+		throws SQLException
+	{
+		_stmnt.setTime (i, t, c);
+	}
+
+
+	public void setTimestamp (int i, Timestamp t, Calendar c) 
+		throws SQLException
+	{
+		_stmnt.setTimestamp (i, t, c);
+	}
+
+
+	public void setNull (int i1, int i2, String s) 
+		throws SQLException
+	{
+		_stmnt.setNull (i1, i2, s);
+	}
+
+
+	// JDBC 3.0 (unsupported) method follow; these are required to be able 
+	// to compile against JDK 1.4
+
+
+	public boolean getMoreResults (int i)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public ResultSet getGeneratedKeys ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int executeUpdate (String s, int i) 
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int executeUpdate (String s, int[] ia)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int executeUpdate (String s, String[] sa)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean execute (String s, int i)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean execute (String s, int[] ia)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean execute (String s, String[] sa)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getResultSetHoldability ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void setURL (int i, URL url)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public ParameterMetaData getParameterMetaData ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+}

Propchange: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingPreparedStatement.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingResultSet.java
URL: http://svn.apache.org/viewcvs/incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingResultSet.java?rev=406215&view=auto
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingResultSet.java (added)
+++ incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingResultSet.java Sat May 13 20:25:56 2006
@@ -0,0 +1,1085 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openjpa.lib.jdbc;
+
+
+import java.io.*;
+import java.math.*;
+import java.net.*;
+import java.sql.*;
+import java.sql.Date;
+import java.util.*;
+
+import org.apache.openjpa.lib.util.*;
+import org.apache.openjpa.lib.util.Closeable;
+
+
+/**
+ *	<p>Wrapper around an existing result set.  Subclasses can override the
+ *	methods whose behavior they mean to change.  The <code>equals</code> and 
+ *	<code>hashCode</code> methods pass through to the base underlying data 
+ *	store statement.</p>
+ *
+ *	@author 	Marc Prud'hommeaux
+ */
+public class DelegatingResultSet
+	implements ResultSet, Closeable
+{
+	private final ResultSet 			_rs;
+	private final DelegatingResultSet	_del;
+	private final Statement 			_stmnt;
+
+
+	public DelegatingResultSet (ResultSet rs, Statement stmnt)
+	{
+		if (rs == null)
+			throw new IllegalArgumentException ();
+
+		_stmnt = stmnt;
+		_rs = rs;
+		if (_rs instanceof DelegatingResultSet)
+			_del = (DelegatingResultSet) _rs;
+		else
+			_del = null;
+	}
+
+
+	/**
+	 *	Return the wrapped result set.
+	 */
+	public ResultSet getDelegate ()
+	{
+		return _rs;
+	}
+
+
+	/**
+	 *	Return the inner-most wrapped delegate.
+	 */
+	public ResultSet getInnermostDelegate ()
+	{
+		return (_del == null) ? _rs : _del.getInnermostDelegate ();
+	}
+
+
+	public int hashCode ()
+	{
+		return _rs.hashCode ();
+	}
+
+
+	public boolean equals (Object other)
+	{
+		if (other == this)
+			return true;
+		if (other instanceof DelegatingResultSet)
+			other = ((DelegatingResultSet) other).getInnermostDelegate ();
+		return getInnermostDelegate ().equals (other);
+	}
+
+
+	public String toString ()
+	{
+		StringBuffer buf = new StringBuffer ("resultset ").append (hashCode ());
+		appendInfo (buf);
+		return buf.toString ();
+	}
+
+
+	protected void appendInfo (StringBuffer buf)
+	{
+		if (_del != null)
+			_del.appendInfo (buf);
+	}
+
+
+    public boolean next ()
+		throws SQLException
+	{
+		return _rs.next ();
+	}
+
+
+    public void close ()
+		throws SQLException
+	{
+		_rs.close ();
+	}
+
+
+    public boolean wasNull ()
+		throws SQLException
+	{
+		return _rs.wasNull ();
+	}
+
+
+    public String getString (int a)
+		throws SQLException
+	{
+		return _rs.getString (a);
+	}
+
+
+    public boolean getBoolean (int a)
+		throws SQLException
+	{
+		return _rs.getBoolean (a);
+	}
+
+
+    public byte getByte (int a)
+		throws SQLException
+	{
+		return _rs.getByte (a);
+	}
+
+
+    public short getShort (int a)
+		throws SQLException
+	{
+		return _rs.getShort (a);
+	}
+
+
+    public int getInt (int a)
+		throws SQLException
+	{
+		return _rs.getInt (a);
+	}
+
+
+    public long getLong (int a)
+		throws SQLException
+	{
+		return _rs.getLong (a);
+	}
+
+
+    public float getFloat (int a)
+		throws SQLException
+	{
+		return _rs.getFloat (a);
+	}
+
+
+    public double getDouble (int a)
+		throws SQLException
+	{
+		return _rs.getDouble (a);
+	}
+
+
+    public BigDecimal getBigDecimal (int a, int b)
+		throws SQLException
+	{
+		return _rs.getBigDecimal (a, b);
+	}
+
+
+    public byte[] getBytes (int a)
+		throws SQLException
+	{
+		return _rs.getBytes (a);
+	}
+
+
+    public Date getDate (int a)
+		throws SQLException
+	{
+		return _rs.getDate (a);
+	}
+
+
+    public Time getTime (int a)
+		throws SQLException
+	{
+		return _rs.getTime (a);
+	}
+
+
+    public Timestamp getTimestamp (int a)
+		throws SQLException
+	{
+		return _rs.getTimestamp (a);
+	}
+
+
+    public InputStream getAsciiStream (int a)
+		throws SQLException
+	{
+		return _rs.getAsciiStream (a);
+	}
+
+
+    public InputStream getUnicodeStream (int a)
+		throws SQLException
+	{
+		return _rs.getUnicodeStream (a);
+	}
+
+
+    public InputStream getBinaryStream (int a)
+		throws SQLException
+	{
+		return _rs.getBinaryStream (a);
+	}
+
+
+    public String getString (String a)
+		throws SQLException
+	{
+		return _rs.getString (a);
+	}
+
+
+    public boolean getBoolean (String a)
+		throws SQLException
+	{
+		return _rs.getBoolean (a);
+	}
+
+
+    public byte getByte (String a)
+		throws SQLException
+	{
+		return _rs.getByte (a);
+	}
+
+
+    public short getShort (String a)
+		throws SQLException
+	{
+		return _rs.getShort (a);
+	}
+
+
+    public int getInt (String a)
+		throws SQLException
+	{
+		return _rs.getInt (a);
+	}
+
+
+    public long getLong (String a)
+		throws SQLException
+	{
+		return _rs.getLong (a);
+	}
+
+
+    public float getFloat (String a)
+		throws SQLException
+	{
+		return _rs.getFloat (a);
+	}
+
+
+    public double getDouble (String a)
+		throws SQLException
+	{
+		return _rs.getDouble (a);
+	}
+
+
+    public BigDecimal getBigDecimal (String a, int b)
+		throws SQLException
+	{
+		return _rs.getBigDecimal (a, b);
+	}
+
+
+    public byte[] getBytes (String a)
+		throws SQLException
+	{
+		return _rs.getBytes (a);
+	}
+
+
+    public Date getDate (String a)
+		throws SQLException
+	{
+		return _rs.getDate (a);
+	}
+
+
+    public Time getTime (String a)
+		throws SQLException
+	{
+		return _rs.getTime (a);
+	}
+
+
+    public Timestamp getTimestamp (String a)
+		throws SQLException
+	{
+		return _rs.getTimestamp (a);
+	}
+
+
+    public InputStream getAsciiStream (String a)
+		throws SQLException
+	{
+		return _rs.getAsciiStream (a);
+	}
+
+
+    public InputStream getUnicodeStream (String a)
+		throws SQLException
+	{
+		return _rs.getUnicodeStream (a);
+	}
+
+
+    public InputStream getBinaryStream (String a)
+		throws SQLException
+	{
+		return _rs.getBinaryStream (a);
+	}
+
+
+    public SQLWarning getWarnings ()
+		throws SQLException
+	{
+		return _rs.getWarnings ();
+	}
+
+
+    public void clearWarnings ()
+		throws SQLException
+	{
+		_rs.clearWarnings ();
+	}
+
+
+    public String getCursorName ()
+		throws SQLException
+	{
+		return _rs.getCursorName ();
+	}
+
+
+    public ResultSetMetaData getMetaData ()
+		throws SQLException
+	{
+		return _rs.getMetaData ();
+	}
+
+
+    public Object getObject (int a)
+		throws SQLException
+	{
+		return _rs.getObject (a);
+	}
+
+
+    public Object getObject (String a)
+		throws SQLException
+	{
+		return _rs.getObject (a);
+	}
+
+
+    public int findColumn (String a)
+		throws SQLException
+	{
+		return _rs.findColumn (a);
+	}
+
+
+    public Reader getCharacterStream (int a)
+		throws SQLException
+	{
+		return _rs.getCharacterStream (a);
+	}
+
+
+    public Reader getCharacterStream (String a)
+		throws SQLException
+	{
+		return _rs.getCharacterStream (a);
+	}
+
+
+    public BigDecimal getBigDecimal (int a)
+		throws SQLException
+	{
+		return _rs.getBigDecimal (a);
+	}
+
+
+    public BigDecimal getBigDecimal (String a)
+		throws SQLException
+	{
+		return _rs.getBigDecimal (a);
+	}
+
+
+    public boolean isBeforeFirst ()
+		throws SQLException
+	{
+		return _rs.isBeforeFirst ();
+	}
+
+
+    public boolean isAfterLast ()
+		throws SQLException
+	{
+		return _rs.isAfterLast ();
+	}
+
+
+    public boolean isFirst ()
+		throws SQLException
+	{
+		return _rs.isFirst ();
+	}
+
+
+    public boolean isLast ()
+		throws SQLException
+	{
+		return _rs.isLast ();
+	}
+
+
+    public void beforeFirst ()
+		throws SQLException
+	{
+		_rs.beforeFirst ();
+	}
+
+
+    public void afterLast ()
+		throws SQLException
+	{
+		_rs.afterLast ();
+	}
+
+
+    public boolean first ()
+		throws SQLException
+	{
+		return _rs.first ();
+	}
+
+
+    public boolean last ()
+		throws SQLException
+	{
+		return _rs.last ();
+	}
+
+
+    public int getRow ()
+		throws SQLException
+	{
+		return _rs.getRow ();
+	}
+
+
+    public boolean absolute (int a)
+		throws SQLException
+	{
+		return _rs.absolute (a);
+	}
+
+
+    public boolean relative (int a)
+		throws SQLException
+	{
+		return _rs.relative (a);
+	}
+
+
+    public boolean previous ()
+		throws SQLException
+	{
+		return _rs.previous ();
+	}
+
+
+    public void setFetchDirection (int a)
+		throws SQLException
+	{
+		_rs.setFetchDirection (a);
+	}
+
+
+    public int getFetchDirection ()
+		throws SQLException
+	{
+		return _rs.getFetchDirection ();
+	}
+
+
+    public void setFetchSize (int a)
+		throws SQLException
+	{
+		_rs.setFetchSize (a);
+	}
+
+
+    public int getFetchSize ()
+		throws SQLException
+	{
+		return _rs.getFetchSize ();
+	}
+
+
+    public int getType ()
+		throws SQLException
+	{
+		return _rs.getType ();
+	}
+
+
+    public int getConcurrency ()
+		throws SQLException
+	{
+		return _rs.getConcurrency ();
+	}
+
+
+    public boolean rowUpdated ()
+		throws SQLException
+	{
+		return _rs.rowUpdated ();
+	}
+
+
+    public boolean rowInserted ()
+		throws SQLException
+	{
+		return _rs.rowInserted ();
+	}
+
+
+    public boolean rowDeleted ()
+		throws SQLException
+	{
+		return _rs.rowDeleted ();
+	}
+
+
+    public void updateNull (int a)
+		throws SQLException
+	{
+		_rs.updateNull (a);
+	}
+
+
+    public void updateBoolean (int a, boolean b)
+		throws SQLException
+	{
+		_rs.updateBoolean (a, b);
+	}
+
+
+    public void updateByte (int a, byte b)
+		throws SQLException
+	{
+		_rs.updateByte (a, b);
+	}
+
+
+    public void updateShort (int a, short b)
+		throws SQLException
+	{
+		_rs.updateShort (a, b);
+	}
+
+
+    public void updateInt (int a, int b)
+		throws SQLException
+	{
+		_rs.updateInt (a, b);
+	}
+
+
+    public void updateLong (int a, long b)
+		throws SQLException
+	{
+		_rs.updateLong (a, b);
+	}
+
+
+    public void updateFloat (int a, float b)
+		throws SQLException
+	{
+		_rs.updateFloat (a, b);
+	}
+
+
+    public void updateDouble (int a, double b)
+		throws SQLException
+	{
+		_rs.updateDouble (a, b);
+	}
+
+
+    public void updateBigDecimal (int a, BigDecimal b)
+		throws SQLException
+	{
+		_rs.updateBigDecimal (a, b);
+	}
+
+
+    public void updateString (int a, String b)
+		throws SQLException
+	{
+		_rs.updateString (a, b);
+	}
+
+
+    public void updateBytes (int a, byte[] b)
+		throws SQLException
+	{
+		_rs.updateBytes (a, b);
+	}
+
+
+    public void updateDate (int a, Date b)
+		throws SQLException
+	{
+		_rs.updateDate (a, b);
+	}
+
+
+    public void updateTime (int a, Time b)
+		throws SQLException
+	{
+		_rs.updateTime (a, b);
+	}
+
+
+    public void updateTimestamp (int a, Timestamp b)
+		throws SQLException
+	{
+		_rs.updateTimestamp (a, b);
+	}
+
+
+    public void updateAsciiStream (int a, InputStream in, int b)
+		throws SQLException
+	{
+		_rs.updateAsciiStream (a, in, b);
+	}
+
+
+    public void updateBinaryStream (int a, InputStream in, int b)
+		throws SQLException
+	{
+		_rs.updateBinaryStream (a, in, b);
+	}
+
+
+    public void updateCharacterStream (int a, Reader reader, int b)
+		throws SQLException
+	{
+		_rs.updateCharacterStream (a, reader, b);
+	}
+
+
+    public void updateObject (int a, Object ob, int b)
+		throws SQLException
+	{
+		_rs.updateObject (a, ob, b);
+	}
+
+
+    public void updateObject (int a, Object ob)
+		throws SQLException
+	{
+		_rs.updateObject (a, ob);
+	}
+
+
+    public void updateNull (String a)
+		throws SQLException
+	{
+		_rs.updateNull (a);
+	}
+
+
+    public void updateBoolean (String a, boolean b)
+		throws SQLException
+	{
+		_rs.updateBoolean (a, b);
+	}
+
+
+    public void updateByte (String a, byte b)
+		throws SQLException
+	{
+		_rs.updateByte (a, b);
+	}
+
+
+    public void updateShort (String a, short b)
+		throws SQLException
+	{
+		_rs.updateShort (a, b);
+	}
+
+
+    public void updateInt (String a, int b)
+		throws SQLException
+	{
+		_rs.updateInt (a, b);
+	}
+
+
+    public void updateLong (String a, long b)
+		throws SQLException
+	{
+		_rs.updateLong (a, b);
+	}
+
+
+    public void updateFloat (String a, float b)
+		throws SQLException
+	{
+		_rs.updateFloat (a, b);
+	}
+
+
+    public void updateDouble (String a, double b)
+		throws SQLException
+	{
+		_rs.updateDouble (a, b);
+	}
+
+
+    public void updateBigDecimal (String a, BigDecimal b)
+		throws SQLException
+	{
+		_rs.updateBigDecimal (a, b);
+	}
+
+
+    public void updateString (String a, String b)
+		throws SQLException
+	{
+		_rs.updateString (a, b);
+	}
+
+
+    public void updateBytes (String a, byte[] b)
+		throws SQLException
+	{
+		_rs.updateBytes (a, b);
+	}
+
+
+    public void updateDate (String a, Date b)
+		throws SQLException
+	{
+		_rs.updateDate (a, b);
+	}
+
+
+    public void updateTime (String a, Time b)
+		throws SQLException
+	{
+		_rs.updateTime (a, b);
+	}
+
+
+    public void updateTimestamp (String a, Timestamp b)
+		throws SQLException
+	{
+		_rs.updateTimestamp (a, b);
+	}
+
+
+    public void updateAsciiStream (String a, InputStream in, int b)
+		throws SQLException
+	{
+		_rs.updateAsciiStream (a, in, b);
+	}
+
+
+    public void updateBinaryStream (String a, InputStream in, int b)
+		throws SQLException
+	{
+		_rs.updateBinaryStream (a, in, b);
+	}
+
+
+    public void updateCharacterStream (String a, Reader reader, int b)
+		throws SQLException
+	{
+		_rs.updateCharacterStream (a, reader, b);
+	}
+
+
+    public void updateObject (String a, Object ob, int b)
+		throws SQLException
+	{
+		_rs.updateObject (a, ob, b);
+	}
+
+
+    public void updateObject (String a, Object b)
+		throws SQLException
+	{
+		_rs.updateObject (a, b);
+	}
+
+
+    public void insertRow ()
+		throws SQLException
+	{
+		_rs.insertRow ();
+	}
+
+
+    public void updateRow ()
+		throws SQLException
+	{
+		_rs.updateRow ();
+	}
+
+
+    public void deleteRow ()
+		throws SQLException
+	{
+		_rs.deleteRow ();
+	}
+
+
+    public void refreshRow ()
+		throws SQLException
+	{
+		_rs.refreshRow ();
+	}
+
+
+    public void cancelRowUpdates ()
+		throws SQLException
+	{
+		_rs.cancelRowUpdates ();
+	}
+
+
+    public void moveToInsertRow ()
+		throws SQLException
+	{
+		_rs.moveToInsertRow ();
+	}
+
+
+    public void moveToCurrentRow ()
+		throws SQLException
+	{
+		_rs.moveToCurrentRow ();
+	}
+
+
+    public Statement getStatement ()
+		throws SQLException
+	{
+		return _stmnt;
+	}
+
+
+    public Object getObject (int a, Map b)
+		throws SQLException
+	{
+		return _rs.getObject (a, b);
+	}
+
+
+    public Ref getRef (int a)
+		throws SQLException
+	{
+		return _rs.getRef (a);
+	}
+
+
+    public Blob getBlob (int a)
+		throws SQLException
+	{
+		return _rs.getBlob (a);
+	}
+
+
+    public Clob getClob (int a)
+		throws SQLException
+	{
+		return _rs.getClob (a);
+	}
+
+
+    public Array getArray (int a)
+		throws SQLException
+	{
+		return _rs.getArray (a);
+	}
+
+
+    public Object getObject (String a, Map b)
+		throws SQLException
+	{
+		return _rs.getObject (a, b);
+	}
+
+
+    public Ref getRef (String a)
+		throws SQLException
+	{
+		return _rs.getRef (a);
+	}
+
+
+    public Blob getBlob (String a)
+		throws SQLException
+	{
+		return _rs.getBlob (a);
+	}
+
+
+    public Clob getClob (String a)
+		throws SQLException
+	{
+		return _rs.getClob (a);
+	}
+
+
+    public Array getArray (String a)
+		throws SQLException
+	{
+		return _rs.getArray (a);
+	}
+
+
+    public Date getDate (int a, Calendar b)
+		throws SQLException
+	{
+		return _rs.getDate (a, b);
+	}
+
+
+    public Date getDate (String a, Calendar b)
+		throws SQLException
+	{
+		return _rs.getDate (a, b);
+	}
+
+
+    public Time getTime (int a, Calendar b)
+		throws SQLException
+	{
+		return _rs.getTime (a, b);
+	}
+
+
+    public Time getTime (String a, Calendar b)
+		throws SQLException
+	{
+		return _rs.getTime (a, b);
+	}
+
+
+    public Timestamp getTimestamp (int a, Calendar b)
+		throws SQLException
+	{
+		return _rs.getTimestamp (a, b);
+	}
+
+
+    public Timestamp getTimestamp (String a, Calendar b)
+		throws SQLException
+	{
+		return _rs.getTimestamp (a, b);
+	}
+
+
+	// JDBC 3.0 (unsupported) method follow; these are required to be able 
+	// to compile against JDK 1.4
+
+
+	public URL getURL (int column)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public URL getURL (String columnName)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateRef (int column, Ref ref)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateRef (String columnName, Ref ref)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateBlob (int column, Blob blob)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateBlob (String columnName, Blob blob)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateClob (int column, Clob clob)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateClob (String columnName, Clob clob)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateArray (int column, Array array)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public void updateArray (String columnName, Array array)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+}
+

Propchange: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingResultSet.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingStatement.java
URL: http://svn.apache.org/viewcvs/incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingStatement.java?rev=406215&view=auto
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingStatement.java (added)
+++ incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingStatement.java Sat May 13 20:25:56 2006
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openjpa.lib.jdbc;
+
+
+import java.sql.*;
+
+import org.apache.openjpa.lib.util.*;
+
+
+/**
+ *	<p>Wrapper around an existing statement.  Subclasses can override the
+ *	methods whose behavior they mean to change.  The <code>equals</code> and 
+ *	<code>hashCode</code> methods pass through to the base underlying data 
+ *	store statement.</p>
+ *
+ *	@author		Abe White
+ */
+public class DelegatingStatement
+	implements Statement, Closeable
+{
+	private final Statement 			_stmnt;
+	private final DelegatingStatement	_del;
+	private final Connection			_conn;
+
+
+	public DelegatingStatement (Statement stmnt, Connection conn)
+	{
+		_conn = conn;
+		_stmnt = stmnt;
+		if (stmnt instanceof DelegatingStatement)
+			_del = (DelegatingStatement) stmnt;
+		else
+			_del = null;
+	}
+
+
+	protected ResultSet wrapResult (ResultSet rs, boolean wrap)
+	{
+		if (!wrap || rs == null)
+			return rs;
+		return new DelegatingResultSet (rs, this);
+	}
+
+
+	/**
+	 *	Return the wrapped statement.
+	 */
+	public Statement getDelegate ()
+	{
+		return _stmnt;
+	}
+
+
+	/**
+	 *	Return the base underlying data store statement.
+	 */
+	public Statement getInnermostDelegate ()
+	{
+		return (_del == null) ? _stmnt : _del.getInnermostDelegate ();
+	}
+
+
+	public int hashCode ()
+	{
+		return getInnermostDelegate ().hashCode ();
+	}
+
+
+	public boolean equals (Object other)
+	{
+		if (other == this)
+			return true;
+		if (other instanceof DelegatingStatement)
+			other = ((DelegatingStatement) other).getInnermostDelegate ();
+		return getInnermostDelegate ().equals (other);
+	}
+
+
+	public String toString ()
+	{
+		StringBuffer buf = new StringBuffer ("stmnt ").append (hashCode ());
+		appendInfo (buf);
+		return buf.toString ();
+	}
+
+
+	protected void appendInfo (StringBuffer buf)
+	{
+		if (_del != null)
+			_del.appendInfo (buf);
+	}
+
+
+    public ResultSet executeQuery (String str) 
+		throws SQLException
+	{
+		return executeQuery (str, true);
+	}
+
+
+	/**
+ 	 *	Execute the query, with the option of not wrapping it in a
+	 *	{@link DelegatingResultSet}, which is the default.
+	 */
+	protected ResultSet executeQuery (String sql, boolean wrap)
+		throws SQLException
+	{
+		ResultSet rs;
+		if (_del != null)
+			rs = _del.executeQuery (sql, false);
+		else
+			rs = _stmnt.executeQuery (sql);
+		return wrapResult (rs, wrap);
+	}
+
+
+    public int executeUpdate (String str) 
+		throws SQLException
+	{
+		return _stmnt.executeUpdate (str);
+	}
+
+
+    public boolean execute (String str) 
+		throws SQLException
+	{
+		return _stmnt.execute (str);
+	}
+
+
+    public void close () 
+		throws SQLException
+	{
+		_stmnt.close ();
+	}
+
+
+    public int getMaxFieldSize () 
+		throws SQLException
+	{
+		return _stmnt.getMaxFieldSize ();
+	}
+
+
+    public void setMaxFieldSize (int i) 
+		throws SQLException
+	{
+		_stmnt.setMaxFieldSize (i);
+	}
+
+
+    public int getMaxRows () 
+		throws SQLException
+	{
+		return _stmnt.getMaxRows ();
+	}
+
+
+    public void setMaxRows (int i) 
+		throws SQLException
+	{
+		_stmnt.setMaxRows (i);
+	}
+
+
+    public void setEscapeProcessing (boolean bool) 
+		throws SQLException
+	{
+		_stmnt.setEscapeProcessing (bool);
+	}
+
+
+    public int getQueryTimeout () 
+		throws SQLException
+	{
+		return _stmnt.getQueryTimeout ();
+	}
+
+
+    public void setQueryTimeout (int i) 
+		throws SQLException
+	{
+		_stmnt.setQueryTimeout (i);
+	}
+
+
+    public void cancel () 
+		throws SQLException
+	{
+		_stmnt.cancel ();
+	}
+
+
+    public SQLWarning getWarnings () 
+		throws SQLException
+	{
+		return _stmnt.getWarnings ();
+	}
+
+
+    public void clearWarnings () 
+		throws SQLException
+	{
+		_stmnt.clearWarnings ();
+	}
+
+
+    public void setCursorName (String str) 
+		throws SQLException
+	{
+		_stmnt.setCursorName (str);
+	}
+
+
+    public ResultSet getResultSet () 
+		throws SQLException
+	{
+		return getResultSet (true);
+	}
+
+
+	/**
+ 	 *	Get the last result set, with the option of not wrapping it in a
+	 *	{@link DelegatingResultSet}, which is the default.
+	 */
+	protected ResultSet getResultSet (boolean wrap)
+		throws SQLException
+	{
+		ResultSet rs;
+		if (_del != null)
+			rs = _del.getResultSet (false);
+		else
+			rs = _stmnt.getResultSet ();
+		return wrapResult (rs, wrap);
+	}
+
+
+    public int getUpdateCount () 
+		throws SQLException
+	{
+		return _stmnt.getUpdateCount ();
+	}
+
+
+    public boolean getMoreResults () 
+		throws SQLException
+	{
+		return _stmnt.getMoreResults ();
+	}
+
+
+    public void setFetchDirection (int i) 
+		throws SQLException
+	{
+		_stmnt.setFetchDirection (i);
+	}
+
+
+    public int getFetchDirection () 
+		throws SQLException
+	{
+		return _stmnt.getFetchDirection ();
+	}
+
+
+    public void setFetchSize (int i) 
+		throws SQLException
+	{
+		_stmnt.setFetchSize (i);
+	}
+
+
+    public int getFetchSize () 
+		throws SQLException
+	{
+		return _stmnt.getFetchSize ();
+	}
+
+
+    public int getResultSetConcurrency () 
+		throws SQLException
+	{
+		return _stmnt.getResultSetConcurrency ();
+	}
+
+
+    public int getResultSetType () 
+		throws SQLException
+	{
+		return _stmnt.getResultSetType ();
+	}
+
+
+    public void addBatch (String str) 
+		throws SQLException
+	{
+		_stmnt.addBatch (str);
+	}
+
+
+    public void clearBatch () 
+		throws SQLException
+	{
+		_stmnt.clearBatch ();
+	}
+
+
+    public int[] executeBatch ()
+		throws SQLException
+	{
+		return _stmnt.executeBatch ();
+	}
+
+
+    public Connection getConnection () 
+		throws SQLException
+	{
+		return _conn;
+	}
+
+
+	// JDBC 3.0 (unsupported) method follow; these are required to be able 
+	// to compile against JDK 1.4
+
+
+	public boolean getMoreResults (int i)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public ResultSet getGeneratedKeys ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int executeUpdate (String s, int i) 
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int executeUpdate (String s, int[] ia)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int executeUpdate (String s, String[] sa)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean execute (String s, int i)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean execute (String s, int[] ia)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public boolean execute (String s, String[] sa)
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+
+
+	public int getResultSetHoldability ()
+		throws SQLException
+	{
+		throw new UnsupportedOperationException ();
+	}
+}
+

Propchange: incubator/openjpa/trunk/openjpa-lib/java/org/apache/openjpa/lib/jdbc/DelegatingStatement.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message