You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by kw...@apache.org on 2011/12/15 23:28:30 UTC

svn commit: r1214975 [2/2] - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ openjpa-slice/src/main/java/org...

Modified: openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedResultSet.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedResultSet.java?rev=1214975&r1=1214974&r2=1214975&view=diff
==============================================================================
--- openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedResultSet.java (original)
+++ openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedResultSet.java Thu Dec 15 22:28:29 2011
@@ -20,18 +20,20 @@ package org.apache.openjpa.slice.jdbc;
 
 import java.io.InputStream;
 import java.io.Reader;
-import java.lang.reflect.Constructor;
 import java.math.BigDecimal;
 import java.net.URL;
 import java.sql.Array;
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Date;
+import java.sql.NClob;
 import java.sql.Ref;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
+import java.sql.RowId;
 import java.sql.SQLException;
 import java.sql.SQLWarning;
+import java.sql.SQLXML;
 import java.sql.Statement;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -39,8 +41,6 @@ import java.util.Calendar;
 import java.util.LinkedList;
 import java.util.Map;
 
-import org.apache.openjpa.lib.util.ConcreteClassGenerator;
-
 /**
  * A chain of ResultSet.
  * Assumes added ResultSet are identical in structure and fetches forward.
@@ -49,24 +49,12 @@ import org.apache.openjpa.lib.util.Concr
  * @author Pinaki Poddar 
  *
  */
-public abstract class DistributedResultSet implements ResultSet {
-    static final Constructor<DistributedResultSet> concreteImpl;
-
-    static {
-        try {
-            concreteImpl = ConcreteClassGenerator.getConcreteConstructor(DistributedResultSet.class);
-        } catch (Exception e) {
-            throw new ExceptionInInitializerError(e);
-        }
-    }
+public class DistributedResultSet implements ResultSet {
     
 	private LinkedList<ResultSet> comps = new LinkedList<ResultSet>();
 	private ResultSet current;
 	private int cursor = -1;
 	
-    public static DistributedResultSet newInstance()  {
-        return ConcreteClassGenerator.newInstance(concreteImpl);
-    }
 	/**
 	 * Adds the ResultSet only if it has rows.
 	 */
@@ -699,4 +687,226 @@ public abstract class DistributedResultS
 	public boolean wasNull() throws SQLException {
 		return current.wasNull();
 	}
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public int getHoldability() throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public Reader getNCharacterStream(int arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public Reader getNCharacterStream(String arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public NClob getNClob(int arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public NClob getNClob(String arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public String getNString(int arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public String getNString(String arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public RowId getRowId(int arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public RowId getRowId(String arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public SQLXML getSQLXML(int arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public SQLXML getSQLXML(String arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public boolean isClosed() throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateAsciiStream(int arg0, InputStream arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateAsciiStream(String arg0, InputStream arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateAsciiStream(int arg0, InputStream arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateAsciiStream(String arg0, InputStream arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBinaryStream(int arg0, InputStream arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBinaryStream(String arg0, InputStream arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBinaryStream(int arg0, InputStream arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBinaryStream(String arg0, InputStream arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBlob(int arg0, InputStream arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBlob(String arg0, InputStream arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBlob(int arg0, InputStream arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateBlob(String arg0, InputStream arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateCharacterStream(int arg0, Reader arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateCharacterStream(String arg0, Reader arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateCharacterStream(int arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateCharacterStream(String arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateClob(int arg0, Reader arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateClob(String arg0, Reader arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateClob(int arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateClob(String arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNCharacterStream(int arg0, Reader arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNCharacterStream(String arg0, Reader arg1)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNCharacterStream(int arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNCharacterStream(String arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNClob(int arg0, NClob arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNClob(String arg0, NClob arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNClob(int arg0, Reader arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNClob(String arg0, Reader arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNClob(int arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNClob(String arg0, Reader arg1, long arg2)
+        throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNString(int arg0, String arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateNString(String arg0, String arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateRowId(int arg0, RowId arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateRowId(String arg0, RowId arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStatement.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStatement.java?rev=1214975&r1=1214974&r2=1214975&view=diff
==============================================================================
--- openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStatement.java (original)
+++ openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStatement.java Thu Dec 15 22:28:29 2011
@@ -18,35 +18,18 @@
  */
 package org.apache.openjpa.slice.jdbc;
 
-import java.lang.reflect.Constructor;
 import java.sql.Statement;
 
-import org.apache.openjpa.lib.util.ConcreteClassGenerator;
-
 /**
  * A virtual Statement that delegates to many actual Statements.
  * 
  * @author Pinaki Poddar
  * 
  */
-public abstract class DistributedStatement extends
+public class DistributedStatement extends
     DistributedTemplate<Statement> {
-    static final Constructor<DistributedStatement> concreteImpl;
-
-    static {
-        try {
-            concreteImpl = ConcreteClassGenerator.getConcreteConstructor(DistributedStatement.class, 
-                DistributedConnection.class);
-        } catch (Exception e) {
-            throw new ExceptionInInitializerError(e);
-        }
-    }
 
     public DistributedStatement(DistributedConnection c) {
         super(c);
     }
-
-    public static DistributedStatement newInstance(DistributedConnection conn) {
-        return ConcreteClassGenerator.newInstance(concreteImpl, conn);
-    }
 }

Modified: openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedTemplate.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedTemplate.java?rev=1214975&r1=1214974&r2=1214975&view=diff
==============================================================================
--- openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedTemplate.java (original)
+++ openjpa/trunk/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedTemplate.java Thu Dec 15 22:28:29 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.openjpa.slice.jdbc;
 
-import java.lang.reflect.Constructor;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -28,27 +27,16 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.openjpa.lib.util.ConcreteClassGenerator;
-
 /**
  * A template for multiple Statements being executed by multiple connections.
  * 
  * @author Pinaki Poddar 
  *
  */
-public abstract class DistributedTemplate<T extends Statement> 
+public class DistributedTemplate<T extends Statement> 
 	implements Statement, Iterable<T> {
-    static final Constructor<DistributedTemplate> concreteImpl;
-
-    static {
-        try {
-            concreteImpl = ConcreteClassGenerator.getConcreteConstructor(DistributedTemplate.class, 
-                DistributedConnection.class);
-        } catch (Exception e) {
-            throw new ExceptionInInitializerError(e);
-        }
-    }
 
+    
     protected List<T> stmts = new ArrayList<T>();
 	protected final DistributedConnection con;
 	protected T master;
@@ -57,10 +45,6 @@ public abstract class DistributedTemplat
 		con = c;
 	}
 	
-    public static DistributedTemplate newInstance(DistributedConnection conn) {
-        return ConcreteClassGenerator.newInstance(concreteImpl, conn);
-    }
-    
 	public Iterator<T> iterator() {
 		return stmts.iterator();
 	}
@@ -142,14 +126,14 @@ public abstract class DistributedTemplat
 	}
 
 	public ResultSet executeQuery() throws SQLException {
-		DistributedResultSet rs = DistributedResultSet.newInstance();
+		DistributedResultSet rs = new DistributedResultSet();
 		for (T s:this)
 			rs.add(s.executeQuery(null));
 		return rs;
 	}
 
 	public ResultSet executeQuery(String arg0) throws SQLException {
-		DistributedResultSet rs = DistributedResultSet.newInstance();
+		DistributedResultSet rs = new DistributedResultSet();
 		for (T s:this)
 			rs.add(s.executeQuery(arg0));
 		return rs;
@@ -196,7 +180,7 @@ public abstract class DistributedTemplat
 	}
 
 	public ResultSet getGeneratedKeys() throws SQLException {
-		DistributedResultSet mrs = DistributedResultSet.newInstance();
+		DistributedResultSet mrs = new DistributedResultSet();
 		for (T s:this)
 			mrs.add(s.getGeneratedKeys());
 		return mrs;
@@ -229,7 +213,7 @@ public abstract class DistributedTemplat
 	}
 
 	public ResultSet getResultSet() throws SQLException {
-		DistributedResultSet rs = DistributedResultSet.newInstance();
+		DistributedResultSet rs = new DistributedResultSet();
 		for (T s:this)
 			rs.add(s.getResultSet());
 		return rs;
@@ -289,4 +273,29 @@ public abstract class DistributedTemplat
 		for (T s:this)
 			s.setQueryTimeout(n);
 	}
+
+    @Override
+    public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isPoolable() throws SQLException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setPoolable(boolean arg0) throws SQLException {
+        throw new UnsupportedOperationException();
+    }
 }