[hibernate-dev] OSGI manifests for hibernate-orm

Brett Meyer brett at 3riverdev.com
Wed Aug 15 20:30:51 EDT 2012


Martin makes good points.  I'd highly recommend moving this into JIRA.  
As frequently as Hibernate gets used within OSGi contexts, following 
some basic guidelines would be incredibly helpful.

+1 for enforcing package splits, as well as ensuring the manifests are 
generated correctly/automatically for ALL jars.  Having to rely on other 
communities (Apache ServiceMix, etc.) to produce wrapper-bundles is 
obnoxious and inconsistent.  It'd be awesome if all Hibernate projects 
supported it natively and tested the heck out of it.  Automated tests 
with Karaf or another OSGi runtime would be great.

Technically, OSGi bundles can get away with exporting the same package, 
but dependent manifests must use "require-bundle" and the symbolic name 
(rather than "import-package").  However, it's definitely best practice 
to avoid "require-bundle" as much as possible.  "import-package" reduces 
unforeseen symptoms in the dependency tree.

Brett E. Meyer
(the new guy on Hibernate...)



On 08/15/2012 06:12 PM, Steve Ebersole wrote:
> Brett, maybe you could help comment on this overall?
>
>
> -------- Original Message --------
> Subject: 	[hibernate-dev] OSGI manifests for hibernate-orm
> Date: 	Thu, 16 Aug 2012 00:08:39 +0200
> From: 	mailing at bibbernet.org <mailing at bibbernet.org>
> To: 	Hibernate hibernate-dev <hibernate-dev at lists.jboss.org>
>
>
>
> Hello,
>
> because I need clean OSGI bundles for Hibernate and especially Envers, I
> am working on some patches for the 4.1 branch of hibernate-orm to enable
> generation of OSGI compatible jar files.
>
> During the work I have found the following problems, and need some help
> and/or feedback. The problems are:
>
> - The package org.hibernate.engine.spi is exported by two jar files,
> hibernate-core and hibernate-entitymanager, which is not possible in
> OSGI. The Problem is the STYLES map in CascadeStyle in hibernate-core
> which prevent that the package in hibernate-entitymanager can be
> refactored from org.hibernate.engine.spi to
> org.hibernate.ejb.engine.spi, to solve the duplicate export.
> I think to fix this problem, the following steps should be done:
> - Add a setter method to CascadeStyle to allow subclasses to add
> CascadeStyles to the map STYLES
> - Refactor the package org.hibernate.engine.spi in hibernate-envers to
> org.hibernate.ejb.engine.spi
> - Use the setter method to add the new CascadeStyle in EJB3CascadeStyle
>
> - The package org.hibernate.tool.ant is exported by to jars,
> hibernate-tools (version: 3.2.0.ga) and hibernate-envers, which is also
> a duplicate export problem. The problem is that HibernateToolTask in
> hibernate-tools has no getters/setters for configurationTask and thus
> hibernate-envers is directly reading/modyifing the property
> configurationTask. I think to fix this problem, the following steps
> should be done:
> - hibernate-tools should add public getters/setters for
> configurationTask in class HibernateToolTask
> - the package org.hibernate.tool.ant in hibernate-envers should be
> refactored to org.hibernate.envers.tool.ant
> - the property configurationTask should be accessed sole thru the
> getters/setters .
>
> It would be nice if someone could check and comment my planned and
> already done  changes.
>
> I have already done the CascadeStyle fix, the configurationTask fix is
> outstanding because I need to know against which version of
> hibernate-tools I should create the fix.
>
> In generally the following tasks are done until now:
> - added configuration to gradle scripts to generate the osgi manifests
> for all jar files in hibernate-orm (needs maybe some cleanup) - right
> now the build files for hibernate-core, hibernate-entitymanager and
> hibernate-envers are modified.
> - added blueprint.xml to hibernate-entitymanager to announce the
> availabillity of a javax.persistence.provider
>
> Next steps:
> - add osgi manifests to the other jars of hibernate-orm
> - write integration tests with pax exam and karaf 2.2.x
> - finish refactoring of hibernate-tools
> - add patches for other needed dependencies
> (hibernate-commons-annotations and more)
> - more testing, more integration tests
>
> Help, reviews and comments are welcome, and if someone has already done
> the work or parts, please drop me a note.
>
> Attached find a patch against the branch 4.1 of hibernate-orm.
>
> regards
> Martin Neimeier
>
>
>    
>
>
>


More information about the hibernate-dev mailing list