[jboss-cvs] JBossAS SVN: r112206 - branches/JBPAPP_5_1/ejb3/src/main/org/jboss/as/javaee.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 6 23:53:48 EDT 2011
Author: dstephan
Date: 2011-09-06 23:53:47 -0400 (Tue, 06 Sep 2011)
New Revision: 112206
Modified:
branches/JBPAPP_5_1/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java
Log:
Backport JBAS-8392 to EAP 5. org.jboss.as.javaee.SimpleJavaEEModuleInformer#getModulePath returns incorrect module name for toplevel non-ear deployments
Modified: branches/JBPAPP_5_1/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java
===================================================================
--- branches/JBPAPP_5_1/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java 2011-09-06 18:23:51 UTC (rev 112205)
+++ branches/JBPAPP_5_1/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java 2011-09-07 03:53:47 UTC (rev 112206)
@@ -36,47 +36,58 @@
*/
public class SimpleJavaEEModuleInformer implements JavaEEModuleInformer
{
- public String getApplicationName(DeploymentUnit unit)
- {
- DeploymentUnit topLevel = unit.getTopLevel();
- if(topLevel.isAttachmentPresent(JBossAppMetaData.class))
- return topLevel.getSimpleName();
- return null;
- }
+ public String getApplicationName(DeploymentUnit unit)
+ {
+ DeploymentUnit topLevel = unit.getTopLevel();
+ if (topLevel.isAttachmentPresent(JBossAppMetaData.class))
+ return topLevel.getSimpleName();
+ return null;
+ }
- public String getModulePath(DeploymentUnit unit)
- {
- return unit.getRelativePath();
- }
+ public String getModulePath(DeploymentUnit unit)
+ {
+ // first check if this a JavaEE Application (i.e. if it's a .ear).
+ // If yes, then return the relative path (i.e. module name) of the unit
+ // relative to the .ear
+ DeploymentUnit topLevel = unit.getTopLevel();
+ if (topLevel.isAttachmentPresent(JBossAppMetaData.class))
+ {
+ return unit.getRelativePath();
+ }
+ // if it's not a JavaEE application (i.e. not a .ear), then
+ // return the simple name of the unit
+ return unit.getSimpleName();
+ }
- public ModuleType getModuleType(DeploymentUnit unit)
- {
- if(unit.isAttachmentPresent(JBossClientMetaData.class))
- return ModuleType.APP_CLIENT;
- if(unit.isAttachmentPresent(JBossMetaData.class) && isReallyAnEjbDeployment(unit))
- return ModuleType.EJB;
- if(unit.isAttachmentPresent(JBossWebMetaData.class))
- return ModuleType.WEB;
- return ModuleType.JAVA;
- }
+ public ModuleType getModuleType(DeploymentUnit unit)
+ {
+ if (unit.isAttachmentPresent(JBossClientMetaData.class))
+ return ModuleType.APP_CLIENT;
+ if (unit.isAttachmentPresent(JBossMetaData.class) && isReallyAnEjbDeployment(unit))
+ return ModuleType.EJB;
+ if (unit.isAttachmentPresent(JBossWebMetaData.class))
+ return ModuleType.WEB;
+ return ModuleType.JAVA;
+ }
- /*
- * Some hacks to counter problems.
- */
- private boolean isReallyAnEjbDeployment(DeploymentUnit unit)
- {
- JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
- // JBMETA-69
- if(metaData.getEnterpriseBeans() == null || metaData.getEnterpriseBeans().size() == 0)
- return false;
- // JBMETA-70
- // The chance of a persistence unit being defined with couple of EJB entity beans is
- // pretty slim.
- for(JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
- {
- if(!(bean instanceof JBossEntityBeanMetaData))
- return true;
- }
- return false;
- }
+ /*
+ * Some hacks to counter problems.
+ */
+ private boolean isReallyAnEjbDeployment(DeploymentUnit unit)
+ {
+ JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
+ // JBMETA-69
+ if (metaData.getEnterpriseBeans() == null || metaData.getEnterpriseBeans().size() == 0)
+ return false;
+ // JBMETA-70
+ // The chance of a persistence unit being defined with couple of EJB
+ // entity beans is
+ // pretty slim.
+ for (JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
+ {
+ if (!(bean instanceof JBossEntityBeanMetaData))
+ return true;
+ }
+ return false;
+ }
}
More information about the jboss-cvs-commits
mailing list