Skip to content

Commit

Permalink
Support building with the 1.7 JDK. This is JDBC4.1, but it doesn't
Browse files Browse the repository at this point in the history
have any changes that require JDK 1.7, so we don't need a whole set
of jdbc41 files, we can just piggyback on the JDBC4 implementation.
  • Loading branch information
kjurka committed Mar 31, 2011
1 parent e0065ac commit 4ea5d01
Show file tree
Hide file tree
Showing 18 changed files with 332 additions and 44 deletions.
93 changes: 65 additions & 28 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
This file now requires Ant 1.4.1. 2002-04-18
$PostgreSQL: pgjdbc/build.xml,v 1.86 2009/03/12 03:52:13 jurka Exp $
$PostgreSQL: pgjdbc/build.xml,v 1.87 2009/07/01 05:00:39 jurka Exp $
-->

Expand Down Expand Up @@ -45,9 +45,15 @@
<equals arg1="${java.specification.version}" arg2="1.5"/>
</condition>
<condition property="jdbc4">
<or>
<equals arg1="${java.specification.version}" arg2="1.6"/>
</condition>
<condition property="jdbc41">
<equals arg1="${java.specification.version}" arg2="1.7"/>
</condition>
<condition property="jdbc4any">
<or>
<isset property="jdbc4" />
<isset property="jdbc41" />
</or>
</condition>
<condition property="jdbc3any">
Expand All @@ -58,9 +64,8 @@
</condition>
<condition property="jdbc3plus">
<or>
<isset property="jdbc3" />
<isset property="jdbc3g" />
<isset property="jdbc4" />
<isset property="jdbc3any" />
<isset property="jdbc4any" />
</or>
</condition>

Expand All @@ -69,7 +74,7 @@
<or>
<isset property="jdbc2" />
<isset property="jdbc3any" />
<isset property="jdbc4" />
<isset property="jdbc4any" />
</or>
</not>
</condition>
Expand All @@ -82,7 +87,7 @@

<condition property="jdbc4tests">
<and>
<isset property="jdbc4" />
<isset property="jdbc4any" />
<isset property="junit" />
</and>
</condition>
Expand Down Expand Up @@ -161,8 +166,8 @@
<exclude name="${package}/jdbc3g/Jdbc3g*.java" unless="jdbc3g" />

<!-- jdbc4 subpackage -->
<include name="${package}/jdbc4/*.java" if="jdbc4" />
<exclude name="${package}/jdcb4/Jdbc4*.java" unless="jdbc4" />
<include name="${package}/jdbc4/*.java" if="jdbc4any" />
<exclude name="${package}/jdcb4/Jdbc4*.java" unless="jdbc4any" />

<!-- ssl -->
<include name="${package}/ssl/*.java" />
Expand All @@ -178,10 +183,12 @@
<include name="${package}/ds/*.java" />
<include name="${package}/ds/common/*.java" />
<include name="${package}/ds/jdbc23/*.java" />
<include name="${package}/ds/jdbc4/*.java" if="jdbc4" />
<include name="${package}/ds/jdbc4/*.java" if="jdbc4any" />

<!-- XA stuff -->
<include name="${package}/xa/*.java" />
<include name="${package}/xa/jdbc3/*.java" />
<include name="${package}/xa/jdbc4/*.java" if="jdbc4any" />

</javac>
</target>
Expand All @@ -193,6 +200,8 @@
<include name="${package}/ds/PGSimpleDataSource.java.in"/>
<include name="${package}/ds/PGPoolingDataSource.java.in"/>
<include name="${package}/ds/PGPooledConnection.java.in"/>
<include name="${package}/ds/PGConnectionPoolDataSource.java.in" />
<include name="${package}/xa/PGXADataSource.java.in" />
<include name="build.properties"/>
<include name="build.local.properties" />
</srcfiles>
Expand All @@ -215,6 +224,9 @@
<condition property="edition" value="JDBC4">
<equals arg1="${jdbc4}" arg2="true" />
</condition>
<condition property="edition" value="JDBC4.1">
<equals arg1="${jdbc41}" arg2="true" />
</condition>

<!-- determine the connection class -->
<condition property="connectclass" value="org.postgresql.jdbc3.Jdbc3Connection">
Expand All @@ -224,47 +236,62 @@
<equals arg1="${jdbc3g}" arg2="true"/>
</condition>
<condition property="connectclass" value="org.postgresql.jdbc4.Jdbc4Connection">
<equals arg1="${jdbc4}" arg2="true" />
<equals arg1="${jdbc4any}" arg2="true" />
</condition>

<condition property="notimplementedexception" value="java.sql.SQLException">
<equals arg1="${jdbc3any}" arg2="true" />
</condition>
<condition property="notimplementedexception" value="java.sql.SQLFeatureNotSupportedException">
<equals arg1="${jdbc4any}" arg2="true" />
</condition>

<condition property="simpledsclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23SimpleDataSource">
<or>
<equals arg1="${jdbc3}" arg2="true" />
<equals arg1="${jdbc3g}" arg2="true" />
</or>
<equals arg1="${jdbc3any}" arg2="true" />
</condition>
<condition property="simpledsclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4SimpleDataSource">
<equals arg1="${jdbc4}" arg2="true" />
<equals arg1="${jdbc4any}" arg2="true" />
</condition>

<condition property="poolingdsclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23PoolingDataSource">
<or>
<equals arg1="${jdbc3}" arg2="true" />
<equals arg1="${jdbc3g}" arg2="true" />
</or>
<equals arg1="${jdbc3any}" arg2="true" />
</condition>
<condition property="poolingdsclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4PoolingDataSource">
<equals arg1="${jdbc4}" arg2="true" />
<equals arg1="${jdbc4any}" arg2="true" />
</condition>

<condition property="pooledconnclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection">
<or>
<equals arg1="${jdbc3}" arg2="true" />
<equals arg1="${jdbc3g}" arg2="true" />
</or>
<equals arg1="${jdbc3any}" arg2="true" />
</condition>
<condition property="pooledconnclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4PooledConnection">
<equals arg1="${jdbc4}" arg2="true" />
<equals arg1="${jdbc4any}" arg2="true" />
</condition>

<condition property="connpooldsclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23ConnectionPoolDataSource">
<equals arg1="${jdbc3any}" arg2="true" />
</condition>
<condition property="connpooldsclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4ConnectionPoolDataSource">
<equals arg1="${jdbc4any}" arg2="true" />
</condition>

<condition property="xadsclass" value="org.postgresql.xa.jdbc3.AbstractJdbc3XADataSource">
<equals arg1="${jdbc3any}" arg2="true" />
</condition>
<condition property="xadsclass" value="org.postgresql.xa.jdbc4.AbstractJdbc4XADataSource">
<equals arg1="${jdbc4any}" arg2="true" />
</condition>

<!-- Some defaults -->
<filter token="MAJORVERSION" value="${major}" />
<filter token="MINORVERSION" value="${minor}" />
<filter token="VERSION" value="PostgreSQL ${fullversion} ${edition}" />
<filter token="JDBCCONNECTCLASS" value="${connectclass}" />
<filter token="NOTIMPLEMENTEDEXCEPTION" value="${notimplementedexception}" />
<filter token="XA_DS_CLASS" value="${xadsclass}" />
<filter token="POOLING_DS_CLASS" value="${poolingdsclass}" />
<filter token="SIMPLE_DS_CLASS" value="${simpledsclass}" />
<filter token="POOLED_CONN_CLASS" value="${pooledconnclass}" />
<filter token="CONN_POOL_DS_CLASS" value="${connpooldsclass}" />
<filter token="DEF_PGPORT" value="${def_pgport}" />

<fail unless="major" message="'major' undefined. Please follow the directions in README."/>
Expand Down Expand Up @@ -292,6 +319,14 @@
overwrite="true"
tofile="${package}/ds/PGPooledConnection.java"
filtering="yes" />
<copy file="${package}/ds/PGConnectionPoolDataSource.java.in"
overwrite="true"
tofile="${package}/ds/PGConnectionPoolDataSource.java"
filtering="yes" />
<copy file="${package}/xa/PGXADataSource.java.in"
overwrite="true"
tofile="${package}/xa/PGXADataSource.java"
filtering="yes" />

<echo message="Configured build for the ${edition} edition driver." />
</target>
Expand All @@ -318,6 +353,8 @@
<delete quiet="true" file="${package}/ds/PGPoolingDataSource.java" />
<delete quiet="true" file="${package}/ds/PGSimpleDataSource.java" />
<delete quiet="true" file="${package}/ds/PGPooledConnection.java" />
<delete quiet="true" file="${package}/ds/PGConnectionPoolDataSource.java" />
<delete quiet="true" file="${package}/xa/PGXADataSource.java" />
</target>

<!-- This compiles and executes the JUnit tests -->
Expand Down Expand Up @@ -429,8 +466,8 @@
<include name="**/*.java"/>
<exclude name="jdbc3/Jdbc3*.java" unless="jdbc3" />
<exclude name="jdbc3g/Jdbc3g*.java" unless="jdbc3g" />
<exclude name="jdbc4/*.java" unless="jdbc4" />
<exclude name="ds/jdbc4/*.java" unless="jdbc4" />
<exclude name="jdbc4/*.java" unless="jdbc4any" />
<exclude name="ds/jdbc4/*.java" unless="jdbc4any" />
<exclude name="test/**/*.java"/>
</fileset>
</javadoc>
Expand Down
13 changes: 9 additions & 4 deletions org/postgresql/Driver.java.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2003-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgjdbc/org/postgresql/Driver.java.in,v 1.77 2008/11/29 07:40:30 jurka Exp $
* $PostgreSQL: pgjdbc/org/postgresql/Driver.java.in,v 1.78 2009/06/02 00:22:58 jurka Exp $
*
*-------------------------------------------------------------------------
*/
Expand Down Expand Up @@ -748,10 +748,10 @@ public class Driver implements java.sql.Driver
* @return PSQLException with a localized message giving the complete
* description of the unimplemeted function
*/
public static SQLException notImplemented(Class callClass, String functionName)
public static @NOTIMPLEMENTEDEXCEPTION@ notImplemented(Class callClass, String functionName)
{
return new PSQLException(GT.tr("Method {0} is not yet implemented.", callClass.getName() + "." + functionName),
PSQLState.NOT_IMPLEMENTED);
return new @NOTIMPLEMENTEDEXCEPTION@(GT.tr("Method {0} is not yet implemented.", callClass.getName() + "." + functionName),
PSQLState.NOT_IMPLEMENTED.getState());
}

/**
Expand All @@ -776,4 +776,9 @@ public class Driver implements java.sql.Driver
}
}

public java.util.logging.Logger getParentLogger() throws @NOTIMPLEMENTEDEXCEPTION@
{
throw notImplemented(this.getClass(), "getParentLogger()");
}

}
1 change: 1 addition & 0 deletions org/postgresql/ds/.cvsignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PGPooledConnection.java
PGPoolingDataSource.java
PGSimpleDataSource.java
PGConnectionPoolDataSource.java
39 changes: 39 additions & 0 deletions org/postgresql/ds/PGConnectionPoolDataSource.java.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*-------------------------------------------------------------------------
*
* Copyright (c) 2004-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgjdbc/org/postgresql/ds/PGConnectionPoolDataSource.java,v 1.5 2008/01/08 06:56:27 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.ds;

import javax.sql.ConnectionPoolDataSource;

import org.postgresql.ds.common.*;

/**
* PostgreSQL implementation of ConnectionPoolDataSource. The app server or
* middleware vendor should provide a DataSource implementation that takes advantage
* of this ConnectionPoolDataSource. If not, you can use the PostgreSQL implementation
* known as PoolingDataSource, but that should only be used if your server or middleware
* vendor does not provide their own. Why? The server may want to reuse the same
* Connection across all EJBs requesting a Connection within the same Transaction, or
* provide other similar advanced features.
*
* <p>In any case, in order to use this ConnectionPoolDataSource, you must set the property
* databaseName. The settings for serverName, portNumber, user, and password are
* optional. Note: these properties are declared in the superclass.</p>
*
* <p>This implementation supports JDK 1.3 and higher.</p>
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
*/
public class PGConnectionPoolDataSource
extends @CONN_POOL_DS_CLASS@
implements ConnectionPoolDataSource
{

}

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
* Copyright (c) 2004-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgjdbc/org/postgresql/ds/PGConnectionPoolDataSource.java,v 1.4 2006/11/29 04:00:15 jurka Exp $
* $PostgreSQL: pgjdbc/org/postgresql/ds/PGConnectionPoolDataSource.java,v 1.5 2008/01/08 06:56:27 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.ds;
package org.postgresql.ds.jdbc23;

import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
import java.sql.SQLException;
import java.io.Serializable;
Expand All @@ -18,6 +17,7 @@
import java.io.IOException;

import org.postgresql.ds.common.*;
import org.postgresql.ds.PGPooledConnection;

/**
* PostgreSQL implementation of ConnectionPoolDataSource. The app server or
Expand All @@ -36,7 +36,7 @@
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
*/
public class PGConnectionPoolDataSource extends BaseDataSource implements Serializable, ConnectionPoolDataSource
public class AbstractJdbc23ConnectionPoolDataSource extends BaseDataSource implements Serializable
{
private boolean defaultAutoCommit = true;

Expand Down Expand Up @@ -103,4 +103,5 @@ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundE
readBaseObject(in);
defaultAutoCommit = in.readBoolean();
}

}
17 changes: 17 additions & 0 deletions org/postgresql/ds/jdbc4/AbstractJdbc4ConnectionPoolDataSource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.postgresql.ds.jdbc4;

import java.sql.SQLFeatureNotSupportedException;

import org.postgresql.ds.jdbc23.AbstractJdbc23ConnectionPoolDataSource;

public class AbstractJdbc4ConnectionPoolDataSource
extends AbstractJdbc23ConnectionPoolDataSource
{

public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
{
throw org.postgresql.Driver.notImplemented(this.getClass(), "getParentLogger()");
}

}

9 changes: 8 additions & 1 deletion org/postgresql/ds/jdbc4/AbstractJdbc4PooledConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
* Copyright (c) 2004-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgjdbc/org/postgresql/ds/jdbc4/AbstractJdbc4PooledConnection.java,v 1.1 2006/11/29 04:00:27 jurka Exp $
* $PostgreSQL: pgjdbc/org/postgresql/ds/jdbc4/AbstractJdbc4PooledConnection.java,v 1.2 2008/01/08 06:56:28 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.ds.jdbc4;

import java.sql.Connection;
import java.sql.SQLFeatureNotSupportedException;
import javax.sql.StatementEventListener;

import org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection;

public abstract class AbstractJdbc4PooledConnection extends AbstractJdbc23PooledConnection
Expand All @@ -29,4 +31,9 @@ public void addStatementEventListener(StatementEventListener listener)
{
}

public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException
{
throw org.postgresql.Driver.notImplemented(this.getClass(), "getParentLogger()");
}

}

0 comments on commit 4ea5d01

Please sign in to comment.