Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 0D824673D6B for ; Sun, 25 Mar 2012 14:32:50 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SBrJ7-0001yk-Tm for pgsql-jdbc@postgresql.org; Sun, 25 Mar 2012 17:32:49 +0000 Received: by pbcun15 with SMTP id un15so4895317pbc.19 for ; Sun, 25 Mar 2012 10:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:references:in-reply-to:subject:date:message-id:mime-version :content-type:x-mailer:thread-index:content-language; bh=b8FeoNk9meUEgTrwCQQbgXte1yOndc1H16CiYlYRLZo=; b=RHavT3b9MQtdVBqC997NF2Z77a9yNmC0mfl9f0ZxbHqM9kTx7vjcT5xlcQ8kNBY7ln Csxutg03qQeDer/Sv7QkxYhtAAqz1nrueoIZnjjslulphgf2HIuNYMlBgUy9nhSLgwtC YKxpZc0baFY1zifrChLGsiUhRLn34faBBSGUk9K7ur+RYWnorxnnrNLszWHHG79oe0Jl VoXEkmXs/bosqmLJ6O1GGiZet4vBCE6eDzc5ZLuln/U/omjU/h+3XNL8ggHUQqhxvdyf tWbyM6Wted5FIXA7FuVwJ405zTaHEq2/bURibYkedxO/Y3y9gMeoS/42gHRLnsBGpMhd fQSg== Received: by 10.68.218.134 with SMTP id pg6mr46262223pbc.111.1332696751580; Sun, 25 Mar 2012 10:32:31 -0700 (PDT) Received: from GITCPC ([122.177.201.105]) by mx.google.com with ESMTPS id b7sm10610588pba.2.2012.03.25.10.32.28 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Mar 2012 10:32:30 -0700 (PDT) From: "Atri Sharma" To: "'Sebastian Hennebrueder'" , References: In-Reply-To: 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> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_004B_01CD0ADB.596550A0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac0KorfnQOuHedcPRBiphdRktvbp4wAChz+g Content-Language: en-in X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201203/48 X-Sequence-Number: 22787 This is a multi-part message in MIME format. ------=_NextPart_000_004B_01CD0ADB.596550A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 =20 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 =20 Hello to all, =20 actually I only wanted to have a look which JDBC 4 methods had been = missing and provide a helping hand to implement those. =20 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. =20 I found the building mechanism a little bit special and played with refactoring the code such that a Maven build could work. =20 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.=20 =20 Before I spent time doing this, I would like to know if there is any interest in this. =20 Here is my plan: =20 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) =20 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. =20 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.=20 =20 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: =20 class ServiceRegistry{ static Map interfaceProviderMap =85 public static Provider getProvider(Class aClass){ =85 } } =20 The code in the class PGObjectFactory in the method could then be = changed from =20 private Object loadSimpleDataSource(Reference ref) { PGSimpleDataSource ds =3D new PGSimpleDataSource(); return loadBaseDataSource(ds, ref); } =20 to private Object loadSimpleDataSource(Reference ref) { Provider provider =3D ServiceRegistry.getProvider(PGSimpleDataSourceInterface.class); PGSimpleDataSourceInterface ds =3D provider.create(); return loadBaseDataSource(ds, ref); } =20 =20 --=20 Best Regards / Viele Gr=FC=DFe Sebastian Hennebrueder ---------------------- Hi Sebastian, =20 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. =20 It would be really helpful for me if senior hackers like yourself can = assist me in this ambitious project of mine. =20 Regards, =20 Atri =20 ------=_NextPart_000_004B_01CD0ADB.596550A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

 

 

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 =3D new = PGSimpleDataSource();

        return = loadBaseDataSource(ds, ref);

    }

 

to

private Object loadSimpleDataSource(Reference = ref)

    = {

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Provider = provider =3D = ServiceRegistry.getProvider(PGSimpleDataSourceInterface.class);

        = PGSimpleDataSourceInterface ds =3D = provider.create();

  =       return loadBaseDataSource(ds, = ref);

    = }

 

 

-- 
Best Regards / Viele = Gr=FC=DFe

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

 

------=_NextPart_000_004B_01CD0ADB.596550A0--