You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Rniamo <rn...@gmail.com> on 2011/03/30 15:00:04 UTC

openejb jndi management

Hi all,

i would like to help Jean-Louis to implement bean validation in openejb but
i have some difficulties to understand how the jndi tree of openejb is
built.
What i saw:
1) JndiEncBuilder create a "virtual binding" (a map)
2) AutoConfig processes resources ignoring some of them
3) Assembler does real bindings... on same resources than JndiEncBuilder fro
some of them (comp/UserTransaction for example)

What i am looking for (to be a bit more explicit ;)):
1) i want to add Validator and ValidatorFactory into the jndi tree by
deployed module, where do i have to do it into openejb (to be coherent)?
1 bis) if it is in the JndiEncBuilder: how do i know the module type (i need
to detect it is a webapp or not)
2) i saw geronimo already implements bval as a plugin, will it need to be
removed from geronimo (i don't see how to put it "correctly" in another
artifact than openejb-core)

- Rniamo

Re: openejb jndi management

Posted by David Blevins <da...@gmail.com>.
On Mar 30, 2011, at 6:00 AM, Rniamo wrote:

> Hi all,
> 
> i would like to help Jean-Louis to implement bean validation in openejb but
> i have some difficulties to understand how the jndi tree of openejb is
> built.
> What i saw:
> 1) JndiEncBuilder create a "virtual binding" (a map)
> 2) AutoConfig processes resources ignoring some of them
> 3) Assembler does real bindings... on same resources than JndiEncBuilder fro
> some of them (comp/UserTransaction for example)
> 
> What i am looking for (to be a bit more explicit ;)):
> 1) i want to add Validator and ValidatorFactory into the jndi tree by
> deployed module, where do i have to do it into openejb (to be coherent)?
> 1 bis) if it is in the JndiEncBuilder: how do i know the module type (i need
> to detect it is a webapp or not)

You should be able to get the validation.xml in a generic way like so:

  deploymentModule.getAltDDs().get("validation.xml");

> 2) i saw geronimo already implements bval as a plugin, will it need to be
> removed from geronimo (i don't see how to put it "correctly" in another
> artifact than openejb-core)

Right we would just do it in the core.  Perhaps the best model to use is JPA EntityManager/EntityManagerFactory, etc.  Maybe take the PersistenceBuilder and use it as an influence to make a ValidationBuilder.

One tricky thing is the validation.xml file.  For the beans.xml file we have BeansInfo.  For the persistence.xml we have the PersistenceUnitInfo objects.  We might need to do the same for the validation.xml.

-David