Hi Benson,

ServiceMix could be a host for such kind of service/API.

I'm OK to add this (we already have servicemix-spec around that), let see what the others think.

Regards
JB

On 12/13/2015 05:33 PM, Benson Margulies wrote:
https://github.com/apache/cxf/pull/102

contains a Rube Goldberg machine that I built to use Hibernate Bean
Validation inside of a CXF web service inside of pax web inside of
Apache Karaf.

I wonder how much of this might be replaced by something that exists,
or could exist, in ServiceMix.

Step 1: javax.validation has an SPI. Everything I've read pointed to
using an explicit provider that knows how to get a Hibernate provider,
rather than any attempt to make the SPI mechanism work in OSGi. Does
anyone here have any contrary view that the SPI could be made to
function via a sufficiency of Dynamic-ImportPackage? On the other
hand, would it make sense to put the Helper class that uses the
provider API to avoid the SPI into ServiceMix?

Step 2: Using the SPI, you obtain a ValidatorFactory. Using the
ValidatiorFactory, you obtain a Validator.

When you _call_ the Hibernate Validator, it in turn uses the javax.el
SPI to obtain an implementation of the expression language. To get
around this, I wrapped a proxy around the Validator that sets the
Thread context classloader to a class loader from a bundle with an
import of 'com.sun.el', the package containing the implementation of
EL that I have in the container.

Does, or could, Servicemix provide a wrapper around the EL API that
would avoid this?


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to