5 Replies Latest reply on Jan 2, 2007 5:57 AM by Carlo de Wolf

    Parse jar to detect ejb3 beans

    Anil Saldanha Master

      Is there any code in jboss5 which basically scans the jar file to detect if there are ejb3 beans?

      I would like to know whether a jar file can be termed as an ejb3 deployment. For ejb2, the presence of a metadata file (ejb-jar.xml) is sufficient to tell me that it is a ejb deployment.

        • 1. Re: Parse jar to detect ejb3 beans
          Scott Stark Master

          There is a org.jboss.ejb3.EJB3Deployer.has30EjbJarXml(InputStream) method that determines whether an ejb-jar.xml is an ejb3 descriptor. org.jboss.ejb3.EJB3Util has some helper methods given the javassit ClassFile AnnotationsAttribute.

          • 2. Re: Parse jar to detect ejb3 beans
            Anil Saldanha Master

            Thanks Scott for the answer. This is needed if the ejb3 jacc layer is to be aligned(not immediate). My usecase is given a jar file, I should be able to tell whether it is an ejb deployment (do not care whether it is ejb2 or ejb3 or both). For ejb2, it is simple - existence of metadata files is sufficient.

            For ejb3, is there something that determines whether a jar file (that does not have any metadata files) may contain ejb3 beans?

            The two options you listed do not solve this.

            • 3. Re: Parse jar to detect ejb3 beans
              Bill Burke Master

              I wouldn't suggest doing it this way....

              What you should do is have your JACC deployer come after the EJB3 deployers and look for:

              
               public void deploy(DeploymentUnit unit) throws DeploymentException
               {
               Ejb3Deployment deployment = unit.getAttachment(Ejb3Deployment.class);
               if (deployment == null) return; // there is no EJB3 deployment in this file
              



              Scanning is time consuming. We don't want 50 deployers doing scanning.






              • 4. Re: Parse jar to detect ejb3 beans
                Anil Saldanha Master

                As long as I am able to register the policy configuration for the EJB3 deployment before getting active, it should be fine. Not sure about this.

                The issue is that the policy configuration for embedded deployments in a top level deployment cannot be linked to the top-level PC if has been committed. So the crux is one cannot commit the top-level pc until all the PCs that need to be linked to it are linked.

                • 5. Re: Parse jar to detect ejb3 beans
                  Carlo de Wolf Master

                  With the EJB3 deployer rewrite you should fit snuggly in between the annation scanner deployer and the component deployer.

                  Something like:
                  - EJB3ParsingDeployer
                  - EJB3JBossParsingDeployer
                  - EJB3ScanningDeployer (after class loader)
                  - JACCDeployer
                  - EJB3Deployer

                  http://jira.jboss.com/jira/browse/EJBTHREE-811