[seam-commits] Seam SVN: r7712 - trunk/src/main/org/jboss/seam/deployment.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Mar 26 14:01:34 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-03-26 14:01:34 -0400 (Wed, 26 Mar 2008)
New Revision: 7712

Added:
   trunk/src/main/org/jboss/seam/deployment/ComponentsXmlDeploymentHandler.java
Modified:
   trunk/src/main/org/jboss/seam/deployment/ComponentDeploymentHandler.java
   trunk/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java
Log:
Split components.xml deployment out into another handler

Modified: trunk/src/main/org/jboss/seam/deployment/ComponentDeploymentHandler.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/ComponentDeploymentHandler.java	2008-03-26 17:51:39 UTC (rev 7711)
+++ trunk/src/main/org/jboss/seam/deployment/ComponentDeploymentHandler.java	2008-03-26 18:01:34 UTC (rev 7712)
@@ -13,10 +13,9 @@
 import org.jboss.seam.log.Logging;
 
 /**
- * The {@link ComponentDeploymentHandler} process Seam components, both 
- * annotated with {@link org.jboss.seam.annotations.Name} and specified in
- * components.xml 
- * 
+ * The {@link ComponentDeploymentHandler} process Seam's component annotated 
+ * with {@link org.jboss.seam.annotations.Name} 
+ *  
  * @author Pete Muir
  *
  */
@@ -30,13 +29,10 @@
    private static final LogProvider log = Logging.getLogProvider(ComponentDeploymentHandler.class);
 
    protected Set<Class<Object>> classes;
-
-   private Set<String> resources;
    
    public ComponentDeploymentHandler()
    {
       classes = new HashSet<Class<Object>>();
-      resources = new HashSet<String>();
    }
 
    /**
@@ -46,14 +42,6 @@
    {
       return Collections.unmodifiableSet(classes);
    }
-   
-   /**
-    * Get paths to components.xml files
-    */
-   public Set<String> getResources() 
-   {
-       return Collections.unmodifiableSet(resources);
-   }
 
    /**
     * @see DeploymentHandler#handle(String, ClassLoader)
@@ -74,7 +62,6 @@
                log.trace("found component class: " + name);
                classes.add( (Class<Object>) classLoader.loadClass(classname) );
             }
-            
          }
          catch (ClassNotFoundException cnfe) 
          {
@@ -88,16 +75,7 @@
          {
             log.debug("could not load classfile: " + classname, ioe);
          }
-      }
-      else if (name.endsWith(".component.xml") || name.endsWith("/components.xml")) 
-      {
-          // we want to skip over known meta-directories since Seam will auto-load these without a scan
-          if (!name.startsWith("WEB-INF/") && !name.startsWith("META-INF/")) 
-          {
-              resources.add(name);
-          }           
-      }
-           
+      }    
    }
   
    private static String componentFilename(String name)

Added: trunk/src/main/org/jboss/seam/deployment/ComponentsXmlDeploymentHandler.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/ComponentsXmlDeploymentHandler.java	                        (rev 0)
+++ trunk/src/main/org/jboss/seam/deployment/ComponentsXmlDeploymentHandler.java	2008-03-26 18:01:34 UTC (rev 7712)
@@ -0,0 +1,56 @@
+package org.jboss.seam.deployment;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * The {@link ComponentsXmlDeploymentHandler} components.xml and .component.xml files 
+ * 
+ * @author Pete Muir
+ *
+ */
+public class ComponentsXmlDeploymentHandler extends AbstractDeploymentHandler
+{
+   /**
+    * Name under which this {@link DeploymentHandler} is registered
+    */
+   public static final String NAME = "org.jboss.seam.deployment.ComponentsXmlDeploymentHandler";
+
+   private Set<String> resources;
+   
+   public ComponentsXmlDeploymentHandler()
+   {
+      resources = new HashSet<String>();
+   }
+   
+   /**
+    * Get paths to components.xml files
+    */
+   public Set<String> getResources() 
+   {
+       return Collections.unmodifiableSet(resources);
+   }
+
+   /**
+    * @see DeploymentHandler#handle(String, ClassLoader)
+    */
+   public void handle(String name, ClassLoader classLoader)
+   {
+      if (name.endsWith(".component.xml") || name.endsWith("/components.xml")) 
+      {
+          // we want to skip over known meta-directories since Seam will auto-load these without a scan
+          if (!name.startsWith("WEB-INF/") && !name.startsWith("META-INF/")) 
+          {
+              resources.add(name);
+          }           
+      }
+           
+   }
+   
+   public String getName()
+   {
+      return NAME;
+   }
+   
+}


Property changes on: trunk/src/main/org/jboss/seam/deployment/ComponentsXmlDeploymentHandler.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java	2008-03-26 17:51:39 UTC (rev 7711)
+++ trunk/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java	2008-03-26 18:01:34 UTC (rev 7712)
@@ -37,6 +37,7 @@
    public static final String HANDLERS_KEY = "org.jboss.seam.deployment.deploymentHandlers";
 
    private ComponentDeploymentHandler componentDeploymentHandler;
+   private ComponentsXmlDeploymentHandler componentsXmlDeploymentHandler;
    private NamespaceDeploymentHandler namespaceDeploymentHandler;
    private AnnotationDeploymentHandler annotationDeploymentHandler;
    
@@ -48,6 +49,8 @@
       this.classLoader = Thread.currentThread().getContextClassLoader();
       componentDeploymentHandler = new ComponentDeploymentHandler();
       getDeploymentHandlers().put(ComponentDeploymentHandler.NAME, componentDeploymentHandler);
+      componentsXmlDeploymentHandler = new ComponentsXmlDeploymentHandler();
+      getDeploymentHandlers().put(ComponentsXmlDeploymentHandler.NAME, componentsXmlDeploymentHandler);
       namespaceDeploymentHandler = new NamespaceDeploymentHandler();
       getDeploymentHandlers().put(NamespaceDeploymentHandler.NAME, namespaceDeploymentHandler);
       annotationDeploymentHandler = new AnnotationDeploymentHandler(getPropertyValues(AnnotationDeploymentHandler.ANNOTATIONS_KEY), classLoader);
@@ -79,7 +82,7 @@
     */
    public Set<String> getScannedComponentResources()
    {
-      return componentDeploymentHandler.getResources();
+      return componentsXmlDeploymentHandler.getResources();
    }
    
    /**




More information about the seam-commits mailing list