[seam-commits] Seam SVN: r11263 - in branches/community/Seam_2_2/src/main/org/jboss/seam: deployment and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jul 8 13:59:56 EDT 2009


Author: norman.richards at jboss.com
Date: 2009-07-08 13:59:56 -0400 (Wed, 08 Jul 2009)
New Revision: 11263

Added:
   branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java
Modified:
   branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
Log:
JBSEAM-4121

Added: branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java	                        (rev 0)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java	2009-07-08 17:59:56 UTC (rev 11263)
@@ -0,0 +1,61 @@
+package org.jboss.seam.deployment;
+
+import org.jboss.seam.contexts.Contexts;
+
+/**
+ * The {@link PagesDotXmlDeploymentHandler} process pages.xml files
+ * Its only purpose is to make sure pages.xml gets updated by hot deploy
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+public class PagesDotXmlDeploymentHandler extends AbstractDeploymentHandler
+{
+   
+   private static DeploymentMetadata PAGESDOTXML_SUFFIX_FILE_METADATA = new DeploymentMetadata()
+   {
+      
+      public String getFileNameSuffix()
+      {
+         return "WEB-INF/pages.xml";
+      }
+      
+   };
+   
+   /**
+    * Name under which this {@link DeploymentHandler} is registered
+    */
+   public static final String NAME = "org.jboss.seam.deployment.PagesDotXmlDeploymentHandler";
+   
+   public String getName()
+   {
+      return NAME;
+   }
+   
+   public static PagesDotXmlDeploymentHandler instance()
+   {
+      if (Contexts.isEventContextActive())
+      {
+         if (Contexts.getEventContext().isSet(WarRootDeploymentStrategy.NAME))
+         {
+            DeploymentStrategy deploymentStrategy = (DeploymentStrategy) Contexts.getEventContext().get(WarRootDeploymentStrategy.NAME);
+            Object deploymentHandler = deploymentStrategy.getDeploymentHandlers().get(NAME);
+            if (deploymentHandler != null)
+            {
+               return (PagesDotXmlDeploymentHandler) deploymentHandler;
+            }
+         }
+         return null;
+      }
+      else
+      {
+         throw new IllegalStateException("Event context not active");
+      }
+   }
+   
+   public DeploymentMetadata getMetadata()
+   {
+      return PAGESDOTXML_SUFFIX_FILE_METADATA;
+   }
+   
+}

Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java	2009-07-08 14:44:47 UTC (rev 11262)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java	2009-07-08 17:59:56 UTC (rev 11263)
@@ -29,6 +29,8 @@
    public static final String NAME = "warRootDeploymentStrategy";
    
    private DotPageDotXmlDeploymentHandler dotPageDotXmlDeploymentHandler;
+
+   private PagesDotXmlDeploymentHandler pagesDotXmlDeploymentHandler;
    
    public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot)
    {
@@ -51,7 +53,10 @@
          this.warRoot = new File[0];
       }
       dotPageDotXmlDeploymentHandler = new DotPageDotXmlDeploymentHandler();
+      pagesDotXmlDeploymentHandler = new PagesDotXmlDeploymentHandler();
       getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, dotPageDotXmlDeploymentHandler);
+      getDeploymentHandlers().put(PagesDotXmlDeploymentHandler.NAME, pagesDotXmlDeploymentHandler);
+      
    }
    
    @Override




More information about the seam-commits mailing list