Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C69349FB30D for ; Mon, 26 Feb 2007 14:31:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 04161-03 for ; Mon, 26 Feb 2007 14:31:01 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) by postgresql.org (Postfix) with ESMTP id 127C29FB291 for ; Mon, 26 Feb 2007 14:31:00 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so748067ugf for ; Mon, 26 Feb 2007 10:30:59 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:sender; b=jnrXn0v/j34nvGaY62yIRergEucc96FpjeGP/5HETjsOSu94MPSjnUg5eVQotMyQHWNVXOs3j7PPFO8HMVr8DSRURybkCDoAJRph6Os+aMDliTT5zBNXT99gl/HhosrMYR8LSupD9unre6ZOZBZOViMhsJFe+jChHp1QaNsDPIA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:sender; b=TbdGjLt2vxgwEHIC0N9ktoQnMwcdiVLmnYtxybHSnNhzMvJo79vhtF1bbuYzg21cfuCrYDJ1+G3XQ9lZsRzexIf2gqfMidx0TtdyPv0APnyrz7E83I0UlVLQWyWJkKQhxgkVvHOo9/a1rdlY/h4l1La/IjVCsGrOkeyDdLTSvrU= Received: by 10.67.103.7 with SMTP id f7mr6821197ugm.1172514659910; Mon, 26 Feb 2007 10:30:59 -0800 (PST) Received: from ?172.24.32.68? ( [62.232.55.118]) by mx.google.com with ESMTP id 55sm6233254ugq.2007.02.26.10.30.56; Mon, 26 Feb 2007 10:30:57 -0800 (PST) Message-ID: <45E3274D.2070201@enterprisedb.com> Date: Mon, 26 Feb 2007 18:30:37 +0000 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.8 (X11/20061116) MIME-Version: 1.0 To: Kris Jurka CC: Jonathan Halliday , pgsql-jdbc@postgresql.org Subject: Re: bug with PGXADataSource in JNDI References: <45DF5511.1040601@redhat.com> <45E30891.1070102@enterprisedb.com> <45E312B2.2090809@enterprisedb.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------090706050100070607000906" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/135 X-Sequence-Number: 16691 This is a multi-part message in MIME format. --------------090706050100070607000906 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Kris Jurka wrote: > On Mon, 26 Feb 2007, Heikki Linnakangas wrote: > >> Here's the patch against CVS head. It should apply cleanly to 8.1 >> branch as well. >> > > This fails to compile for the JDBC2-EE driver because it supports > datasources, but not XA. Oh, I see. Here's another patch that introduces a new PGXADataSourceFactory instead of modifying the existing PGObjectFactory. It's a bit inconsistent that XADataSources have a factory of their own while others use the plain PGObjectFactory, but I can't get too excited about this.. How do you test the different builds? Do you need a separate, older JDK to build each edition? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com --------------090706050100070607000906 Content-Type: text/x-patch; name="xa-PGObjectFactory-fix-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xa-PGObjectFactory-fix-2.patch" ? build.local.properties ? xa-PGObjectFactory-fix-2.patch ? xa-PGObjectFactory-fix.patch ? xa-endthenjoin-2.diff ? xa-endthenjoin.diff Index: org/postgresql/xa/PGXADataSource.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/xa/PGXADataSource.java,v retrieving revision 1.2 diff -c -r1.2 PGXADataSource.java *** org/postgresql/xa/PGXADataSource.java 29 Oct 2005 18:59:39 -0000 1.2 --- org/postgresql/xa/PGXADataSource.java 26 Feb 2007 18:24:52 -0000 *************** *** 4,9 **** --- 4,10 ---- import java.sql.SQLException; import javax.naming.Referenceable; + import javax.naming.Reference; import javax.sql.XAConnection; import javax.sql.XADataSource; *************** *** 50,53 **** --- 51,64 ---- public String getDescription() { return "JDBC3 XA-enabled DataSource from " + org.postgresql.Driver.getVersion(); } + + /** + * Generates a reference using the appropriate object factory. + */ + protected Reference createReference() { + return new Reference( + getClass().getName(), + PGXADataSourceFactory.class.getName(), + null); + } } Index: org/postgresql/xa/PGXADataSourceFactory.java =================================================================== RCS file: org/postgresql/xa/PGXADataSourceFactory.java diff -N org/postgresql/xa/PGXADataSourceFactory.java *** /dev/null 1 Jan 1970 00:00:00 -0000 --- org/postgresql/xa/PGXADataSourceFactory.java 26 Feb 2007 18:24:53 -0000 *************** *** 0 **** --- 1,47 ---- + /*------------------------------------------------------------------------- + * + * Copyright (c) 2007, PostgreSQL Global Development Group + * + * IDENTIFICATION + * $PostgreSQL$ + * + *------------------------------------------------------------------------- + */ + package org.postgresql.xa; + + import org.postgresql.ds.common.*; + + import javax.naming.*; + import java.util.Hashtable; + + /** + * An ObjectFactory implementation for PGXADataSource-objects. + */ + + public class PGXADataSourceFactory extends PGObjectFactory + { + /* All the other PostgreSQL DataSource use PGObjectFactory directly, but we + * can't do that with PGXADataSource because referencing PGXADataSource + * from PGObjectFactory would break "JDBC2 Enterprise" edition build which + * doesn't include PGXADataSource. + */ + + public Object getObjectInstance(Object obj, Name name, Context nameCtx, + Hashtable environment) throws Exception + { + Reference ref = (Reference)obj; + String className = ref.getClassName(); + if (className.equals("org.postgresql.xa.PGXADataSource")) + { + return loadXADataSource(ref); + } + else + return null; + } + + private Object loadXADataSource(Reference ref) + { + PGXADataSource ds = new PGXADataSource(); + return loadBaseDataSource(ds, ref); + } + } --------------090706050100070607000906--