[jboss-cvs] JBossAS SVN: r104395 - in trunk/server/src: etc/deployers and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 3 10:43:18 EDT 2010


Author: alesj
Date: 2010-05-03 10:43:17 -0400 (Mon, 03 May 2010)
New Revision: 104395

Modified:
   trunk/server/src/etc/conf/standard/ear-deployer-jboss-beans.xml
   trunk/server/src/etc/deployers/ear-deployer-jboss-beans.xml
   trunk/server/src/main/java/org/jboss/deployment/AppParsingDeployer.java
   trunk/server/src/main/java/org/jboss/deployment/EARContentsDeployer.java
   trunk/server/src/main/java/org/jboss/deployment/JBossAppParsingDeployer.java
Log:
[JBAS-7976]; fix JBossAppParsing deployer.

Modified: trunk/server/src/etc/conf/standard/ear-deployer-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/conf/standard/ear-deployer-jboss-beans.xml	2010-05-03 12:17:43 UTC (rev 104394)
+++ trunk/server/src/etc/conf/standard/ear-deployer-jboss-beans.xml	2010-05-03 14:43:17 UTC (rev 104395)
@@ -20,10 +20,6 @@
       an application.xml
     -->
    <bean name="EARContentsDeployer" class="org.jboss.deployment.EARContentsDeployer">
-      <constructor>
-         <parameter><inject bean="AppParsingDeployer" property="relativeOrder"/></parameter>
-      </constructor>
-
       <!-- Does the deployment have to end in .ear to process it -->
       <property name="requiresEarSuffix">true</property>
    </bean>

Modified: trunk/server/src/etc/deployers/ear-deployer-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/ear-deployer-jboss-beans.xml	2010-05-03 12:17:43 UTC (rev 104394)
+++ trunk/server/src/etc/deployers/ear-deployer-jboss-beans.xml	2010-05-03 14:43:17 UTC (rev 104395)
@@ -20,10 +20,6 @@
       an application.xml
     -->
    <bean name="EARContentsDeployer" class="org.jboss.deployment.EARContentsDeployer">
-      <constructor>
-         <parameter><inject bean="AppParsingDeployer" property="relativeOrder"/></parameter>
-      </constructor>
-
       <!-- Does the deployment have to end in .ear to process it -->
       <property name="requiresEarSuffix">true</property>
    </bean>

Modified: trunk/server/src/main/java/org/jboss/deployment/AppParsingDeployer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/deployment/AppParsingDeployer.java	2010-05-03 12:17:43 UTC (rev 104394)
+++ trunk/server/src/main/java/org/jboss/deployment/AppParsingDeployer.java	2010-05-03 14:43:17 UTC (rev 104395)
@@ -41,6 +41,7 @@
  * 
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
+ * @author ales.justin at jboss.org
  * @version $Revision$
  */
 public class AppParsingDeployer extends SchemaResolverDeployer<EarMetaData>
@@ -49,6 +50,7 @@
    {
       super(EarMetaData.class);
       setName("application.xml");
+      setTopLevelOnly(true);
    }
 
    /**

Modified: trunk/server/src/main/java/org/jboss/deployment/EARContentsDeployer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/deployment/EARContentsDeployer.java	2010-05-03 12:17:43 UTC (rev 104394)
+++ trunk/server/src/main/java/org/jboss/deployment/EARContentsDeployer.java	2010-05-03 14:43:17 UTC (rev 104395)
@@ -34,24 +34,19 @@
 import org.jboss.metadata.ear.jboss.JBoss50AppMetaData;
 import org.jboss.metadata.ear.jboss.JBossAppMetaData;
 import org.jboss.metadata.ear.jboss.ServiceModuleMetaData;
-import org.jboss.metadata.ear.spec.AbstractModule;
-import org.jboss.metadata.ear.spec.ConnectorModuleMetaData;
-import org.jboss.metadata.ear.spec.EjbModuleMetaData;
-import org.jboss.metadata.ear.spec.JavaModuleMetaData;
-import org.jboss.metadata.ear.spec.ModuleMetaData;
-import org.jboss.metadata.ear.spec.ModulesMetaData;
-import org.jboss.metadata.ear.spec.WebModuleMetaData;
+import org.jboss.metadata.ear.spec.*;
 import org.jboss.vfs.VFSUtils;
 import org.jboss.vfs.VirtualFile;
 
 /**
  * An implicit application.xml type of deployer. This deployer runs if
  * there is no META-INF/application.xml to identify 
- * {@link #scanEar(VirtualFile, JBossAppMetaData)}
+ * {@link #scanEar(VFSDeploymentUnit, VirtualFile, JBossAppMetaData)}
  *
  * @author Bill Burke
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
+ * @author ales.justin at jboss.org
  * @version $Revision$
  */
 public class EARContentsDeployer extends AbstractDeployer
@@ -62,15 +57,15 @@
    /**
     * Create the EARContentsDeployer and register as a DeploymentStage.PARSE
     * stage deployer with JBossAppMetaData output.
-    * 
-    * @param appParsingOrder - the AppParsingDeployer relative order
-    * used to ensure EARContentsDeployer runs after AppParsingDeployer.
+    *
+    * We need to run after AppParsingDeployer.
     */
-   public EARContentsDeployer(int appParsingOrder)
+   public EARContentsDeployer()
    {
       setStage(DeploymentStages.PARSE);
-      setRelativeOrder(appParsingOrder+1);
-      setOutput(JBossAppMetaData.class);
+      addInput(EarMetaData.class);
+      addOutput(JBossAppMetaData.class);
+      setTopLevelOnly(true);
    }
 
    public boolean isRequiresEarSuffix()
@@ -84,41 +79,35 @@
 
    public void deploy(DeploymentUnit unit) throws DeploymentException
    {
-      // Ignore non-parent deployments
-      if (unit.getParent() != null)
+      /* If there is a META-INF/application.xml we don't process this. */
+      if (unit.isAttachmentPresent(EarMetaData.class))
       {
+         log.tracef("Ignoring ear with META-INF/application.xml: %1s", unit.getSimpleName());
          return;
       }
+
       // Ignore non-vfs deployments
       if (unit instanceof VFSDeploymentUnit == false)
       {
-         log.trace("Not a vfs deployment: " + unit.getName());
+         log.tracef("Not a vfs deployment: %1s", unit.getName());
          return;
       }
       // See if the suffix matches the .ear requirement
       if (requiresEarSuffix && unit.getSimpleName().endsWith(".ear") == false)
       {
-         log.trace("Unit name does not end in .ear: " + unit.getSimpleName());
+         log.tracef("Unit name does not end in .ear: %1s", unit.getSimpleName());
          return;
       }
-      VFSDeploymentUnit vfsunit = VFSDeploymentUnit.class.cast(unit);
-      /* If there is a META-INF/application.xml we don't process this.
-       * This is probably unnecessary?
-       */
-      VirtualFile appXml = vfsunit.getMetaDataFile("application.xml");
-      if( appXml != null )
-      {
-         log.trace("Ignoring ear with META-INF/application.xml: " + unit.getSimpleName());
-         return;
-      }
 
+      VFSDeploymentUnit vfsunit = VFSDeploymentUnit.class.cast(unit);
       deploy(vfsunit);
    }
 
    /**
-    * Entry point for handling a VFSDeploymentUnit
-    * @param unit
-    * @throws DeploymentException
+    * Entry point for handling a VFSDeploymentUnit.
+    *
+    * @param unit the current deployment unit
+    * @throws DeploymentException for any error
     */
    public void deploy(VFSDeploymentUnit unit) throws DeploymentException
    {

Modified: trunk/server/src/main/java/org/jboss/deployment/JBossAppParsingDeployer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/deployment/JBossAppParsingDeployer.java	2010-05-03 12:17:43 UTC (rev 104394)
+++ trunk/server/src/main/java/org/jboss/deployment/JBossAppParsingDeployer.java	2010-05-03 14:43:17 UTC (rev 104395)
@@ -27,6 +27,7 @@
 import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
 import org.jboss.metadata.ear.jboss.JBossAppMetaData;
 import org.jboss.metadata.ear.spec.EarMetaData;
+import org.jboss.metadata.ear.spec.ModulesMetaData;
 
 /**
  * An ObjectModelFactoryDeployer for translating jboss-app.xml descriptors into
@@ -35,6 +36,7 @@
  * @author Scott.Stark at jboss.org
  * @author Anil.Saldhana at redhat.com
  * @author adrian at jboss.org
+ * @author ales.justin at jboss.org
  * @version $Revision$
  */
 @JMX(name="jboss.j2ee:service=EARDeployer", exposedInterface=JBossAppParsingDeployerMBean.class)
@@ -50,10 +52,18 @@
    public JBossAppParsingDeployer()
    {
       super(JBossAppMetaData.class);
-      //setInput(JBoss50Aporg.jboss.metadata.ear.spec.EarMetaDatapMetaData.class);
+      addInput(EarMetaData.class);
+      addInput(JBossAppMetaData.class); // EarContentsDeployer can produce it
       setName("jboss-app.xml");
+      setTopLevelOnly(true);
    }
 
+   @Override
+   protected boolean allowsReparse()
+   {
+      return true; // EarContentsDeployer can produce it already
+   }
+
    /**
     * Get the virtual file path for the application descriptor in the
     * DeploymentContext.getMetaDataPath.
@@ -104,21 +114,41 @@
 
    /**
     * Specify an unauthenticated identity
-    * @param unauthenticatedIdentity
+    * @param unauthenticatedIdentity ui flag
     */
    public void setUnauthenticatedIdentity(String unauthenticatedIdentity)
    {
       this.unauthenticatedIdentity = unauthenticatedIdentity;
    }
 
-   
    // FIXME This should all be in a seperate deployer
    @Override
    protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
    {
+      EarMetaData specMetaData = unit.getAttachment(EarMetaData.class);
+      JBossAppMetaData metaData = unit.getAttachment(JBossAppMetaData.class); // from ear contents deployer
+
+      // do parse
       super.createMetaData(unit, name, suffix);
-      EarMetaData specMetaData = unit.getAttachment(EarMetaData.class);
-      JBossAppMetaData metaData = unit.getAttachment(JBossAppMetaData.class);
+      // new parsed metadata
+      JBossAppMetaData parsed = unit.getAttachment(JBossAppMetaData.class);
+      if (metaData != null && parsed != null)
+      {
+         ModulesMetaData mmd = metaData.getModules();
+         if (mmd != null && mmd.isEmpty() == false)
+         {
+            ModulesMetaData parsedMMD = parsed.getModules();
+            if (parsedMMD == null)
+            {
+               parsedMMD = new ModulesMetaData();
+               parsed.setModules(parsedMMD);
+            }
+            parsedMMD.merge(parsedMMD, mmd);
+         }
+      }
+      // parsed is the one we use after merged modules
+      metaData = parsed;
+
       if(specMetaData == null && metaData == null)
          return;
 




More information about the jboss-cvs-commits mailing list