Make hibernate-validator-cdi OSGI compliant

Description

In order to be OSGI compliant hibernate-validator-cdi must contains OSGI mandatory headers (Bundle-SymbolicName, ...) and declare providing Capabilities (for example see Pax-CDI declaration here: https://ops4j1.jira.com/wiki/display/PAXCDI/Requirements+and+Capabilities).

I think there should be a little refactor to do on hibernate-validator as some validator-cdi depends on 'private' classes.

And maybe some split-packages (HibernateValidator class is present on the two bundles at the same place).

Environment

None

Activity

Show:
Gunnar Morling
January 7, 2014, 4:56 PM

Adding the headers is no problem but I'm not so sure about the suggested refactoring.

The HV engine module and the CDI module are developed as part of one code base and I would not like to have redundancies between the two just to satisfy some technology. Not sure, maybe it would help to make the CDI module could be a fragment bundle of the engine bundle? I think Equinox has some concept of "friend" bundles, I don't know though whether OSGi has something comparable.

Regarding the split package I'm not sure I'm following. Indeed here are two types named HibernateValidator, but they are in different packages?

CharlieM
January 8, 2014, 6:22 PM
Edited

Hi,

Yes, making the CDI bundle a fragment of the other would make the trick, otherwise the cdi bundle would not see some of the engine internal classes.

There are no split package (I would have smoked some bad thing while writing).

I tested it (making a super bundles of the two) and it worked, but we're constrained to

On the client bundle , however HV engine does not find the validator.

CharlieM
January 25, 2014, 10:31 AM

Hi,

I made a little wrapper in order to make things just work (a little ugly but).
You can have the wrapper here: https://github.com/Tcharl/net.osgiliath.helpers.parent/tree/master/net.osgiliath.helpers.hibernate.cdi.osgi,
and an integration test here: https://github.com/Tcharl/net.osgiliath.features.karaf-features/tree/master/net.osgiliath.features.karaf-features.itests/net.osgiliath.features.karaf-features.itests.validation

A nice thing, as an OSGI user would be to not be constrained to declare the interceptor (as it is an HV internal class), to not import the interceptor package and to not declare the HibernateValidator implementation export on the client bundle (so making it working transparently ).

Gunnar Morling
April 24, 2015, 6:57 PM

Added the required headers (export, fragment host etc.) for now. , any chance you could give this a spin and let us know whether it does the right thing for you? You could either build yourself from source or wait till early next week when we've published the CR1 release. Thanks a lot!

Assignee

Hardy Ferentschik

Reporter

CharlieM

Labels

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Minor
Configure