From: Atri Sharma <atri.jiit@gmail.com>
To: 'Sebastian Hennebrueder' <usenet@laliluna.de>
To: pgsql-jdbc@postgresql.org
Subject: Re: Maven based build and refactoring
Date: Sun, 25 Mar 2012 23:02:20 +0530
Message-ID: <4f6f56ae.8706440a.6252.ffffb855@mx.google.com> (raw)
In-Reply-To: <CADD181A-426A-4134-95E0-A1C25C154993@laliluna.de>
References: <CADD181A-426A-4134-95E0-A1C25C154993@laliluna.de>
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Sebastian Hennebrueder
Sent: 25 March 2012 21:47
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Maven based build and refactoring
Hello to all,
actually I only wanted to have a look which JDBC 4 methods had been missing
and provide a helping hand to implement those.
The reason is that Hibernate requires now JDBC 4 and Hibernate is the
underlying JPA provider in the JBoss application server as well. I prefer
PostgreSQL over other open source database server, so JDBC 4 is an absolute
requirement.
I found the building mechanism a little bit special and played with
refactoring the code such that a Maven build could work.
I split the code into common and jdbc version specific versions and found
clean ways to solve the version, minor and major version infos, exception
factories and logger control but reached now a point where the refactoring
would require deeper code changes.
Before I spent time doing this, I would like to know if there is any
interest in this.
Here is my plan:
separation of the projects into
common (all which is not in the other packages)
jdbc3 (contains generated classes)
jdbc3g (contains generated classes)
jdbc4 (contains generated classes + jdbc4 only code)
common-test (all tests)
Version information are loaded from property files which can be replaced
during build time. The Driver delegates to a DriverVersion class in the
common module which provides the version information.
An exceptionFactory in the common module provides the "unimplemented"
factory method for exceptions.
As there are classes in common which references classes in jdbc(3 | 3G | 4)
the code needs to be decoupled using interfaces. The lack of interfaces and
the wildly use of inheritance instead of composition is the biggest obstacle
to decouple modules.
This is the bigger change, I am about to do.
I would introduce a Service registry, which can create providers for various
interfaces. The driver could register on start up (static block) . Here is a
conceptual piece of code:
class ServiceRegistry{
static Map<Class,Provider> interfaceProviderMap
…
public static Provider getProvider(Class aClass){ … }
}
The code in the class PGObjectFactory in the method could then be changed
from
private Object loadSimpleDataSource(Reference ref)
{
PGSimpleDataSource ds = new PGSimpleDataSource();
return loadBaseDataSource(ds, ref);
}
to
private Object loadSimpleDataSource(Reference ref)
{
Provider provider =
ServiceRegistry.getProvider(PGSimpleDataSourceInterface.class);
PGSimpleDataSourceInterface ds = provider.create();
return loadBaseDataSource(ds, ref);
}
--
Best Regards / Viele Grüße
Sebastian Hennebrueder
----------------------
Hi Sebastian,
I am a student and I am planning to work on implementing the missing parts
of JDBC 4 as my GSoc 2012 project.I have already started discussing with
Dave Krammer for this.
It would be really helpful for me if senior hackers like yourself can assist
me in this ambitious project of mine.
Regards,
Atri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: atri.jiit@gmail.com, usenet@laliluna.de
Subject: Re: Maven based build and refactoring
In-Reply-To: <4f6f56ae.8706440a.6252.ffffb855@mx.google.com>
References: <CADD181A-426A-4134-95E0-A1C25C154993@laliluna.de> <4f6f56ae.8706440a.6252.ffffb855@mx.google.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox