6 Replies Latest reply on Jul 24, 2008 3:36 PM by Andrew Rubinger

    [jboss-metadata] Determine packaging structure from JBossEnt

    Andrew Rubinger Master

      Simple question.

      For JBMETA-81 I need to determine if an EjbDeploymentSummary is from an EAR. How can I get at this, if possible, from JBossEnterpriseBeanMetadata? Something that ties JBossAppMetadata into the Object graph?

      S,
      ALR

        • 1. Re: [jboss-metadata] Determine packaging structure from JBos
          Scott Stark Master

          No, that is part of the DeploymentUnit information which holds the metadata. The only thing that exists is the DeploymentSummary associated with the ejb jar. This would have to be extended to provide such info. Right now all you can check is whether or not the getDeploymentScopeBaseName is null/empty, not a very good contract.

          What exactly do you need to know?

          • 2. Re: [jboss-metadata] Determine packaging structure from JBos
            Andrew Rubinger Master

            OK, will have to expand upon DeploymentSummary, then.

            The root issue:

            (appName/)ejbName/remote

            ...is defined by the EJB3 JNDI Binding contract. Right now BasicJndiBindingPolicy is prepending the "appName/" portion from the deploymentScopeBaseName, which is also present in a JAR. So I'll just have to add a piece that adds this only in presence of an EAR.

            S,
            ALR

            • 3. Re: [jboss-metadata] Determine packaging structure from JBos
              Andrew Rubinger Master

              I've got fixes in place, which add to DeploymentSummary the notion of a PackagingType:

              public enum PackagingType {
              
               EAR, JAR, STANDALONE_FILE
              
              }


              r76188.

              S,
              ALR

              • 4. Re: [jboss-metadata] Determine packaging structure from JBos
                Andrew Rubinger Master

                As a matter of design, where would setting the packaging type on the deployment summary be most appropriate?

                1) MappedReferenceMetadataResolverDeployer.mapEjbs, where DeploymentSummary is constructed
                2) EJBRegistrationDeployer, where the deployment scope is determined and set?
                3) A new deployer which depends on DeploymentScope output from EJBRegistrationDeployer, setting the packaging type based upon the after the fact?

                S,
                ALR

                • 5. Re: [jboss-metadata] Determine packaging structure from JBos
                  Scott Stark Master

                  The EJBRegistrationDeployer is obsolete, no longer used. It should be where the DeploymentSummary is constructed.

                  • 6. Re: [jboss-metadata] Determine packaging structure from JBos
                    Andrew Rubinger Master

                    After we release jboss-metadata 1.0.0.Beta31, I'll put the following patch into AS. This doesn't account for WARs at the moment, but should keep things moving forward.

                    Index: server/src/main/org/jboss/deployment/MappedReferenceMetaDataResolverDeployer.java
                    ===================================================================
                    --- server/src/main/org/jboss/deployment/MappedReferenceMetaDataResolverDeployer.java (revision 76161)
                    +++ server/src/main/org/jboss/deployment/MappedReferenceMetaDataResolverDeployer.java (working copy)
                    @@ -49,6 +49,7 @@
                     import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
                     import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
                     import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces;
                    +import org.jboss.metadata.ejb.jboss.jndipolicy.spi.PackagingType;
                     import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
                     import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
                     import org.jboss.metadata.javaee.spec.AnnotatedEJBReferenceMetaData;
                    @@ -1160,6 +1161,25 @@
                     }
                     dSummary.setDeploymentScopeBaseName(baseName);
                    
                    + /*
                    + * Determine the packaging type (JAR or EAR, Standalone File not
                    + * supported by this deployer)
                    + */
                    +
                    + // Initialize to JAR
                    + PackagingType packagingType = PackagingType.JAR;
                    +
                    + // Determine if EAR
                    + boolean isEar = unit != unit.getTopLevel();
                    + if(isEar)
                    + {
                    + packagingType = PackagingType.EAR;
                    + }
                    +
                    + // Set type
                    + dSummary.setPackagingType(packagingType);
                    +
                    + // Return
                     return dSummary;
                     }
                    


                    S,
                    ALR