[seam-commits] Seam SVN: r9360 - in trunk/src/main/org/jboss/seam: init and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Oct 17 06:45:08 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-10-17 06:45:07 -0400 (Fri, 17 Oct 2008)
New Revision: 9360

Modified:
   trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
   trunk/src/main/org/jboss/seam/init/Initialization.java
   trunk/src/main/org/jboss/seam/navigation/Pages.java
Log:
JBSEAM-3577

Modified: trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java	2008-10-16 18:52:50 UTC (rev 9359)
+++ trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java	2008-10-17 10:45:07 UTC (rev 9360)
@@ -1,6 +1,7 @@
 package org.jboss.seam.deployment;
 
 import java.io.File;
+import java.util.Set;
 
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
@@ -25,6 +26,8 @@
    
    public static final String NAME = "warRootDeploymentStrategy";
    
+   private DotPageDotXmlDeploymentHandler dotPageDotXmlDeploymentHandler;
+   
    public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot)
    {
       this.classLoader = classLoader;
@@ -38,7 +41,8 @@
          log.warn("Unable to discover war root, .page.xml files won't be found");
          this.warRoot = new File[0];
       }
-      getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, new DotPageDotXmlDeploymentHandler());
+      dotPageDotXmlDeploymentHandler = new DotPageDotXmlDeploymentHandler();
+      getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, dotPageDotXmlDeploymentHandler);
    }
    
    @Override
@@ -67,5 +71,10 @@
    {
       getScanner().scanDirectories(warRoot);
    }
+   
+   public Set<String> getDotPageDotXmlFileNames()
+   {
+      return dotPageDotXmlDeploymentHandler.getFiles();
+   }
 
 }

Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java	2008-10-16 18:52:50 UTC (rev 9359)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java	2008-10-17 10:45:07 UTC (rev 9360)
@@ -736,16 +736,16 @@
       {
          try
          {
-            ServletLifecycle.beginReinitialization(request);
             hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
             if (hotDeploymentStrategy.isEnabled())
             {
                hotDeploymentStrategy.scan();
-               Init init = Init.instance();
+               Init init = (Init) ServletLifecycle.getServletContext().getAttribute( Seam.getComponentName(Init.class) );
                
                if (init.getTimestamp() < hotDeploymentStrategy.getTimestamp())
                {
                   log.info("redeploying");
+                  ServletLifecycle.beginReinitialization(request);
                   Seam.clearComponentNameCache();
                   for ( String name: init.getHotDeployableComponents() )
                   {
@@ -769,20 +769,19 @@
                   Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
                   init.setTimestamp( System.currentTimeMillis() );
                   installComponents(init);
+                  ServletLifecycle.endReinitialization();
                   log.info("done redeploying");
                }
                
                WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot);
                warRootDeploymentStrategy.scan();
-               Contexts.getEventContext().set(WarRootDeploymentStrategy.NAME, warRootDeploymentStrategy);
-               Pages pages = Pages.instance();
+               Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
                if (pages!= null) {
-                   pages.initialize();
+                   pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
                }
             
-               Contexts.getApplicationContext().remove(Seam.getComponentName(Exceptions.class));
+               ServletLifecycle.getServletContext().removeAttribute( Seam.getComponentName(Exceptions.class) );                 
             }
-            ServletLifecycle.endReinitialization();
          }
          finally
          {

Modified: trunk/src/main/org/jboss/seam/navigation/Pages.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Pages.java	2008-10-16 18:52:50 UTC (rev 9359)
+++ trunk/src/main/org/jboss/seam/navigation/Pages.java	2008-10-17 10:45:07 UTC (rev 9360)
@@ -104,11 +104,25 @@
    @Create
    public void create()
    {
-      initialize();
+      if (DotPageDotXmlDeploymentHandler.instance() != null)
+      {
+          initialize(DotPageDotXmlDeploymentHandler.instance().getFiles());
+      }
+      else
+      {
+          initialize();
+      }
    }
    
+   
+   
    public void initialize()
    {
+       initialize(null);
+   }
+   
+   public void initialize(Set<String> fileNames)
+   {
       pagesByViewId = Collections.synchronizedMap(new HashMap<String, Page>());   
       pageStacksByViewId = Collections.synchronizedMap(new HashMap<String, List<Page>>());   
       conversations = Collections.synchronizedMap(new HashMap<String, ConversationIdParameter>());
@@ -129,9 +143,9 @@
          }
       }
       
-      if (DotPageDotXmlDeploymentHandler.instance() != null)
+      if (fileNames != null)
       {
-         parsePages(DotPageDotXmlDeploymentHandler.instance().getFiles());
+          parsePages(fileNames);
       }
    }
    




More information about the seam-commits mailing list