Version 1



    This document outlines the issues encountered while trying to implement merging of EJB3 deployment descriptor and annotations for AS 7.0.0.Beta2




    Pre-AS7 deployers and metdata merging:


    Typically the way we used to create a merged view of deployment descriptor (DD) values with annotation values involved the following:


    • 2 separate views were maintained during deployment processing. One view corresponding to DD values and the other for annotations
    • After a certain point, the 2 views would be merged into one
    • After that point, the deployers which required to work on the metadata, would start using the merged view of the metadata


    AS7 Deployment Unit Processors (DUPs):


    The previous mentioned steps would ideally have worked out in the current AS7 DUP framework. However, most (all?) of the EE specific DUPs which work on annotations expect the metadata (== *ComponentDescription) to be available. For example, see the ResourceInjectionAnnotationParsingProcessor. It gets hold of a AbstractComponentDescription and starts looking for annotations on that component class. The AbstractComponentDescription is fetched from the EEModuleDescription and leads to a chicken and egg problem. For example, while working on EJB3 DD + annotation merging, this is what I initially tried:


    1. Various (ordered) EJB DD processing DUPs running first and creating the EJBComponentDescription(s).
    2. Various (ordered) annotation DUPs running after the DD based DUPs and creating a parallel EJBComponentDescription(s).
    3. A merging DUP which merges the EJBComponentDescription(s) created in #1 and #2 and then attaching each of these EJBComponentDescriptions to EEModuleDescription.
    4. Rest of the DUPs then working off the merged EJBComponentDescription(s) by fetching them from the EEModuleDescription.


    The problem with this approach is that the DUPs like ResourceInjectionAnnotationParsingProcessor which scan for annotations require the EJBComponentDescription to be available in EEModuleDescription for it to fire. Effectively, until #3 is done (the merging of DD + annotations), such DUPs can't fire. However, for #3 (a.k.a merging) to be successfully completed we need the ResourceInjectionAnnotationParsingProcessor and such DUPs to fire. Effectively this leads to a chicken and egg issue.


    There's one other approach which I tried out (with issues of its own), the one which is currently implemented (and broken) in upstream, for merging DD + annotations. That approach was more of a workaround for this main issue and isn't really relevant at this point. However, I can outline that approach here if required (just need to recap some finer details on why it is broken)