[jboss-cvs] JBossAS SVN: r105137 - projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/metadata/processor.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 24 05:02:45 EDT 2010


Author: jaikiran
Date: 2010-05-24 05:02:44 -0400 (Mon, 24 May 2010)
New Revision: 105137

Modified:
   projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/metadata/processor/ContainerNameMetaDataProcessor.java
Log:
EJBTHREE-2098 Make sure that the container name creation doesn't rely on .ear files as top level unit

Modified: projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/metadata/processor/ContainerNameMetaDataProcessor.java
===================================================================
--- projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/metadata/processor/ContainerNameMetaDataProcessor.java	2010-05-24 08:13:25 UTC (rev 105136)
+++ projects/ejb3/trunk/deployers/src/main/java/org/jboss/ejb3/deployers/metadata/processor/ContainerNameMetaDataProcessor.java	2010-05-24 09:02:44 UTC (rev 105137)
@@ -26,7 +26,6 @@
 
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.logging.Logger;
-import org.jboss.metadata.ear.jboss.JBossAppMetaData;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
 import org.jboss.metadata.ejb.jboss.JBossMetaData;
@@ -113,18 +112,22 @@
       // a better way/place for this later
       StringBuilder containerName = new StringBuilder("jboss.j2ee:service=EJB3" + ",");
 
-      // Get the top level unit for this unit (ex: the top level might be an ear and this unit might be the jar
-      // in that ear
-      DeploymentUnit toplevelUnit = unit.getTopLevel();
-      if (toplevelUnit != null)
+      // If this unit is not a top level unit, then get the top level unit
+      // (whatever it is - .ear or .sar etc...) and use that name as part of the
+      // container name
+      if (unit.isTopLevel() == false)
       {
-         // if top level is an ear, then create the name with the ear reference
-         if (isEar(toplevelUnit))
+         DeploymentUnit toplevelUnit = unit.getTopLevel();
+         if (toplevelUnit != null)
          {
+            // Note, even if the top level may not be a .ear (ex: it maybe a .sar),
+            // we still use "ear=" in the container name. This is to make sure
+            // that we match up with what JavaEEComponentHelper.createObjectName()
+            // does. See https://jira.jboss.org/browse/EJBTHREE-2098 for more 
+            // details
             containerName.append("ear=");
             containerName.append(toplevelUnit.getSimpleName());
             containerName.append(",");
-
          }
       }
       // now work on the passed unit, to get the jar name
@@ -150,15 +153,15 @@
       return containerJMXName.getCanonicalName();
    }
 
-   /**
-   * Returns true if this <code>unit</code> represents an .ear deployment
-   *
-   * @param unit
-   * @return
-   */
-   private boolean isEar(DeploymentUnit unit)
-   {
-      return unit.getSimpleName().endsWith(".ear") || unit.getAttachment(JBossAppMetaData.class) != null;
-   }
+//   /**
+//   * Returns true if this <code>unit</code> represents an .ear deployment
+//   *
+//   * @param unit
+//   * @return
+//   */
+//   private boolean isEar(DeploymentUnit unit)
+//   {
+//      return unit.getSimpleName().endsWith(".ear") || unit.getAttachment(JBossAppMetaData.class) != null;
+//   }
 
 }




More information about the jboss-cvs-commits mailing list