1 2 3 4 Previous Next 53 Replies Latest reply: Sep 17, 2009 3:45 PM by Emmanuel Bernard RSS

Deploying ValidatorFactory

Emmanuel Bernard Master

In EE6 ValidatorFactory and Validator are services available to:
- other services like JCA, JPA, JSF 2 (typically available before these)
- the user application via JNDI and @Resource injection

What's the way to get that integrated?
The typical use case is one VF per application deployed. But we are discussing with Sun and the idea of one VF per module could have to be implemented (ie like JSR-299 and beans.xml)

  • 1. Re: Deploying ValidatorFactory
    Stan Silvert Master

    I don't know how JSF-299 is done.

    Does application == module?

    I was thinking that you have a single ValidatorFactory per root deployment. ("Root deployment" meaning something you typically drop into /deploy) Is that what we want?

    Stan

  • 2. Re: Deploying ValidatorFactory
    Emmanuel Bernard Master

    no a module is like a war inside an ear etc.
    But we can start small and have one VF by root module, and build upon that.

  • 3. Re: Deploying ValidatorFactory
    Ales Justin Master

     

    "epbernard" wrote:

    What's the way to get that integrated?
    The typical use case is one VF per application deployed. But we are discussing with Sun and the idea of one VF per module could have to be implemented (ie like JSR-299 and beans.xml)

    This should be easy to do.

    1) MC beanfactory to create us VF
    2) VF Deployer that would push this properly into DeploymentUnit
    * what you do from here on is then up to other services, all they should care that this is available to them if the choose to use it

    If you point me to the location where you wanna impl this,
    I can have a crack at it, unless you are eager to do it yourself (as I know you haven't coded in 2years ;-)


  • 4. Re: Deploying ValidatorFactory
    Pete Muir Master

     

    "stan.silvert@jboss.com" wrote:
    I don't know how JSR-299 is done.


    We have attach Web Beans to the root manager and mimic the module structure inside Web Beans.

  • 5. Re: Deploying ValidatorFactory
    Emmanuel Bernard Master

     

    "alesj" wrote:
    "epbernard" wrote:

    What's the way to get that integrated?
    The typical use case is one VF per application deployed. But we are discussing with Sun and the idea of one VF per module could have to be implemented (ie like JSR-299 and beans.xml)

    This should be easy to do.

    1) MC beanfactory to create us VF
    2) VF Deployer that would push this properly into DeploymentUnit
    * what you do from here on is then up to other services, all they should care that this is available to them if the choose to use it


    Do you know how things are push to JNDI, is that the deployer's responsibility?


    If you point me to the location where you wanna impl this,
    I can have a crack at it, unless you are eager to do it yourself (as I know you haven't coded in 2years ;-)


    I don't know the AS structure, where should such a code live on?

  • 6. Re: Deploying ValidatorFactory
    Ales Justin Master

     

    "epbernard" wrote:

    Do you know how things are push to JNDI

    Sure. There is 1M ways to do it. ;-)

    "epbernard" wrote:

    is that the deployer's responsibility?

    Do you want it to be?

    Or we can leave it to services (its containers) to push it.
    Or what does the spec say? :-)

    "epbernard" wrote:

    I don't know the AS structure, where should such a code live on?

    It can be here:
    - http://anonsvn.jboss.org/repos/jbossas/projects/
    Or it can even live in your BV code, as a separate module.

    The only thing that is important is that it's properly pushed into our mvn repo.

  • 7. Re: Deploying ValidatorFactory
    Emmanuel Bernard Master

     

    "alesj" wrote:
    "epbernard" wrote:

    Do you know how things are push to JNDI

    Sure. There is 1M ways to do it. ;-)


    Dude I have 2 millions things to do, am juggling with 8+ code bases atm, need to finish the spec, help finish the EE6 integration, waste time in political BS and prepare my move all that under a very very tight schedule.
    Can you show me one way to do it (like an example, existing code or something)?

    "epbernard" wrote:

    is that the deployer's responsibility?

    Do you want it to be?

    Or we can leave it to services (its containers) to push it.
    Or what does the spec say? :-)

    I just want to do what's recommended in AS, what is the recommended approach?
    The way the specs are worded and the APIs are designed, the container needs to push a ValidatorFactory into JPA and JSF at their respective initialization time. The container also has to make VF available via JNDI and let it be injectable via @Resource.
    Aside from these constraints, we can do what we want.


    "epbernard" wrote:

    I don't know the AS structure, where should such a code live on?

    It can be here:
    - http://anonsvn.jboss.org/repos/jbossas/projects/
    Or it can even live in your BV code, as a separate module.

    The only thing that is important is that it's properly pushed into our mvn repo.



    got it, we'll put it in http://anonsvn.jboss.org/repos/jbossas/projects/

  • 8. Re: Deploying ValidatorFactory
    Ales Justin Master

     

    "epbernard" wrote:

    Can you show me one way to do it (like an example, existing code or something)?

    Let's wait to see what the service container implementors say.

    "epbernard" wrote:

    I just want to do what's recommended in AS, what is the recommended approach?
    The way the specs are worded and the APIs are designed, the container needs to push a ValidatorFactory into JPA and JSF at their respective initialization time. The container also has to make VF available via JNDI and let it be injectable via @Resource.
    Aside from these constraints, we can do what we want.

    What do you mean by container?

    If this is the task of EJB, JPA, JSF container, then we'll leave it to them to push it in.

    For us to push it in, it just means another simple deployer,
    that would take VF from DU, and put it into JNDI under specified name.

    If you already have a spec defined name (e.g. like for TransactionManager or UserTransaction),
    that I guess that's what we should do, and let others just grab it from there.

    "epbernard" wrote:

    got it, we'll put it in http://anonsvn.jboss.org/repos/jbossas/projects/ under a separate subproject then.

    Create a project + default mvn files crap and I'll hack something in quickly, OK?

  • 9. Re: Deploying ValidatorFactory
    Stan Silvert Master

     

    "alesj" wrote:

    What do you mean by container?

    If this is the task of EJB, JPA, JSF container, then we'll leave it to them to push it in.

    For us to push it in, it just means another simple deployer,
    that would take VF from DU, and put it into JNDI under specified name.

    If you already have a spec defined name (e.g. like for TransactionManager or UserTransaction),
    that I guess that's what we should do, and let others just grab it from there.

    Create a project + default mvn files crap and I'll hack something in quickly, OK?


    That's pretty much what I was thinking (if I understand you correctly). So some deployer puts it under JNDI. Then I can go into the JBoss JSF initialization and put a reference to the VF in the place where JSF expects to find it.

    So if you are going to do this Ales, please let me know where I can see what you did. I'd like to better understand how all this works. If you want me to do the JNDI part then I'll be glad to take a crack at it if you can give me a little guidance.

    Stan

  • 10. Re: Deploying ValidatorFactory
    Carlo de Wolf Master

    Most of this should be covered by the injection framework.

    Pushing it in JNDI is the easy bit, just think up a name and bind it. :-)

    The other end is a bit more rough. In the current implementation you should create a ValidatorFactoryResolver which implements the scoping rules for VFs (per app/per module, weird default rules etc). It should provide a MC bean name on which other services can literally depend. Secondly the JNDI name should be exposed, so other services (via the injection framework) can set up a LinkRef in java:comp/env to it.

    The last bit is easy. JavaEE specifies where an injection value can be found in JNDI, so the injection code can simply lookup java:comp/env/org.jboss.MyBean.value and set it.

  • 11. Re: Deploying ValidatorFactory
    Stan Silvert Master

    FYI. Created this jira to commit code against.

    https://jira.jboss.org/jira/browse/JBAS-7167

  • 13. Re: Deploying ValidatorFactory
    Ales Justin Master

     

    "epbernard" wrote:
    In EE6 ValidatorFactory and Validator are services available to:
    - other services like JCA, JPA, JSF 2 (typically available before these)

    Are there some rules for which deployments should we bind this?
    e.g. like you already list it - do it for jca, jpa, jsf2, ...; and if none of such "markers" is present, don't bind it

  • 14. Re: Deploying ValidatorFactory
    Stan Silvert Master

     

    "alesj" wrote:
    "epbernard" wrote:
    In EE6 ValidatorFactory and Validator are services available to:
    - other services like JCA, JPA, JSF 2 (typically available before these)

    Are there some rules for which deployments should we bind this?
    e.g. like you already list it - do it for jca, jpa, jsf2, ...; and if none of such "markers" is present, don't bind it


    Some questions:
    Does it hurt anything to go ahead and put a VF in JNDI for all deployments?
    If we did bind a VF for all, would there be much of a perf hit?
    If we did bind a VF for all, would finding the markers be more expensive than just creating and binding a VF?

    FYI, the marker for JSF is the presence of a FacesServlet declaration. This is complicated in Servlet 3.0 by the fact that this declaration could be in a web-fragment.xml inside WEB-INF/lib/*.jar. However, I assume that this declaration will be available in metadata anyway, so maybe it's not so bad.

    Stan

1 2 3 4 Previous Next