[jboss-cvs] JBossAS SVN: r100996 - in branches/Branch_6_0_0_M2: server/src/main/java/org/jboss/web/deployers and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 15 16:49:35 EST 2010


Author: bstansberry at jboss.com
Date: 2010-02-15 16:49:34 -0500 (Mon, 15 Feb 2010)
New Revision: 100996

Added:
   branches/Branch_6_0_0_M2/varia/src/resources/console/
   branches/Branch_6_0_0_M2/varia/src/resources/console/WEB-INF/
   branches/Branch_6_0_0_M2/varia/src/resources/console/WEB-INF/jboss-scanning.xml
Modified:
   branches/Branch_6_0_0_M2/build/build.xml
   branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/ServletContainerInitializerDeployer.java
   branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/WarAnnotationMetaDataDeployer.java
Log:
[JBAS-7647] Eliminate some scanning during admin-console deployment

Modified: branches/Branch_6_0_0_M2/build/build.xml
===================================================================
--- branches/Branch_6_0_0_M2/build/build.xml	2010-02-15 21:18:31 UTC (rev 100995)
+++ branches/Branch_6_0_0_M2/build/build.xml	2010-02-15 21:49:34 UTC (rev 100996)
@@ -211,6 +211,10 @@
   -->
   <target name="partition-build" depends="init">
 
+    <!-- FIXME remove this huge hack and get a jboss-scanning.xml in the console itself -->
+    <copy todir="${install.common.deploy}/admin-console.war/WEB-INF"
+          file="${install.common.deploy}/jmx-console.war/WEB-INF/jboss-scanning.xml"/>
+       
     <!-- Copy server/all to server/default and then remove the services 
          outside of the scope of the default config
     -->

Modified: branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/ServletContainerInitializerDeployer.java
===================================================================
--- branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/ServletContainerInitializerDeployer.java	2010-02-15 21:18:31 UTC (rev 100995)
+++ branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/ServletContainerInitializerDeployer.java	2010-02-15 21:49:34 UTC (rev 100996)
@@ -37,6 +37,7 @@
 import javax.servlet.annotation.HandlesTypes;
 
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.annotations.ScanningMetaData;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -76,6 +77,7 @@
    {
       setStage(DeploymentStages.POST_CLASSLOADER);
       setInput(JBossWebMetaData.class);
+      addInput(ScanningMetaData.class);
       addInput(MergedJBossWebMetaDataDeployer.WEB_ORDER_ATTACHMENT_NAME);
       addInput(MergedJBossWebMetaDataDeployer.WEB_SCIS_ATTACHMENT_NAME);
       addOutput(SCI_ATTACHMENT_NAME);
@@ -171,6 +173,7 @@
          }
       }
       
+      ScanningMetaData scanningMetaData = unit.getAttachment(ScanningMetaData.class);
       Class<?>[] typesArray = typesMap.keySet().toArray(new Class<?>[0]);
       // Find classes which extend, implement, or are annotated by HandlesTypes
       if (typesArray.length > 0 && unit instanceof VFSDeploymentUnit)
@@ -181,9 +184,14 @@
          {
             for (VirtualFile classpathItem : classpath)
             {
-               HandlesTypesClassFilter classVisitor = new HandlesTypesClassFilter(vfsUnit, unit.getClassLoader(), 
-                     classpathItem, typesArray, typesMap, handlesTypes);
-               classpathItem.visit(classVisitor);
+               if (scanningMetaData == null 
+                     || !(scanningMetaData.getPaths() == null 
+                           || !scanningMetaData.getPaths().contains(classpathItem.getName())))
+               {
+                  HandlesTypesClassFilter classVisitor = new HandlesTypesClassFilter(vfsUnit, unit.getClassLoader(), 
+                        classpathItem, typesArray, typesMap, handlesTypes);
+                  classpathItem.visit(classVisitor);
+               }
             }
          }
          catch (Exception e)

Modified: branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/WarAnnotationMetaDataDeployer.java
===================================================================
--- branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/WarAnnotationMetaDataDeployer.java	2010-02-15 21:18:31 UTC (rev 100995)
+++ branches/Branch_6_0_0_M2/server/src/main/java/org/jboss/web/deployers/WarAnnotationMetaDataDeployer.java	2010-02-15 21:49:34 UTC (rev 100996)
@@ -29,6 +29,7 @@
 import java.util.Map;
 
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.annotations.ScanningMetaData;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -57,6 +58,7 @@
    {
       setStage(DeploymentStages.POST_CLASSLOADER);
       addInput(WebMetaData.class);
+      addInput(ScanningMetaData.class);
       addOutput(WEB_ANNOTATED_ATTACHMENT_NAME);
    }
 
@@ -139,15 +141,21 @@
     */
    protected void processMetaData(VFSDeploymentUnit unit, List<VirtualFile> classpath) throws Exception
    {
+      ScanningMetaData scanningMetaData = unit.getAttachment(ScanningMetaData.class);
       Map<VirtualFile, Collection<Class<?>>> classesPerJar = new HashMap<VirtualFile, Collection<Class<?>>>();
       boolean foundAnnotations = false;
       for (VirtualFile path : classpath)
       {
-         Collection<Class<?>> currentClasses = getClasses(unit, path);
-         classesPerJar.put(path, currentClasses);
-         if (currentClasses.size() > 0)
+         if (scanningMetaData == null 
+               || !(scanningMetaData.getPaths() == null 
+                     || !scanningMetaData.getPaths().contains(path.getName())))
          {
-            foundAnnotations = true;
+            Collection<Class<?>> currentClasses = getClasses(unit, path);
+            classesPerJar.put(path, currentClasses);
+            if (currentClasses.size() > 0)
+            {
+               foundAnnotations = true;
+            }
          }
       }
       if (foundAnnotations)

Added: branches/Branch_6_0_0_M2/varia/src/resources/console/WEB-INF/jboss-scanning.xml
===================================================================
--- branches/Branch_6_0_0_M2/varia/src/resources/console/WEB-INF/jboss-scanning.xml	                        (rev 0)
+++ branches/Branch_6_0_0_M2/varia/src/resources/console/WEB-INF/jboss-scanning.xml	2010-02-15 21:49:34 UTC (rev 100996)
@@ -0,0 +1,3 @@
+<scanning xmlns="urn:jboss:scanning:1.0">
+<!-- Purpose:  Disable scanning for annotations in contained deployment. -->
+</scanning>


Property changes on: branches/Branch_6_0_0_M2/varia/src/resources/console/WEB-INF/jboss-scanning.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision




More information about the jboss-cvs-commits mailing list