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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Nov 18 05:08:19 EST 2008


Author: dan.j.allen
Date: 2008-11-18 05:08:19 -0500 (Tue, 18 Nov 2008)
New Revision: 9587

Added:
   trunk/src/main/org/jboss/seam/deployment/HotDeploymentTimestampCheckStrategy.java
   trunk/src/main/org/jboss/seam/deployment/TimestampCheckStrategy.java
   trunk/src/main/org/jboss/seam/deployment/TimestampURLScanner.java
   trunk/src/main/org/jboss/seam/deployment/WarRootTimestampCheckStrategy.java
Modified:
   trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
   trunk/src/main/org/jboss/seam/deployment/AbstractScanner.java
   trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java
   trunk/src/main/org/jboss/seam/deployment/Scanner.java
   trunk/src/main/org/jboss/seam/deployment/URLScanner.java
   trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
   trunk/src/main/org/jboss/seam/init/Initialization.java
Log:
JBSEAM-3699
JBSEAM-3700
also cleaned up the init and redeploy routines


Modified: trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
===================================================================
--- trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java	2008-11-18 10:06:33 UTC (rev 9586)
+++ trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -36,17 +36,20 @@
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
             throws IOException, ServletException
    {
-      Init init = (Init) getServletContext().getAttribute( Seam.getComponentName(Init.class) );
-      if ( init!=null)
+      if (request instanceof HttpServletRequest)
       {
-         try
+         Init init = (Init) getServletContext().getAttribute(Seam.getComponentName(Init.class));
+         if (init != null)
          {
-            new Initialization( getServletContext() ).redeploy( (HttpServletRequest) request );
+            try
+            {
+               new Initialization(getServletContext()).redeploy((HttpServletRequest) request, init);
+            }
+            catch (InterruptedException e)
+            {
+               log.warn("Unable to redeploy, please try again");
+            }
          }
-         catch (InterruptedException e)
-         {
-            log.warn("Unable to redeploy, please try again");
-         }
       }
       chain.doFilter(request, response);
    }

Modified: trunk/src/main/org/jboss/seam/deployment/AbstractScanner.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/AbstractScanner.java	2008-11-18 10:06:33 UTC (rev 9586)
+++ trunk/src/main/org/jboss/seam/deployment/AbstractScanner.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -41,8 +41,12 @@
          this.classLoader = classLoader;
       }
       
-      protected void handle(DeploymentHandler deploymentHandler)
+      /**
+       * Return true if the file was handled (false if it was ignored)
+       */
+      protected boolean handle(DeploymentHandler deploymentHandler)
       {
+         boolean handled = false;
          if (deploymentHandler instanceof ClassDeploymentHandler) 
          {
             if (name.endsWith(".class"))
@@ -54,6 +58,7 @@
                   if (getClassDescriptor().getClazz() != null)
                   {
                      classDeploymentHandler.getClasses().add(getClassDescriptor());
+                     handled = true;
                   }
                }
             }
@@ -63,17 +68,22 @@
             if (name.endsWith(deploymentHandler.getMetadata().getFileNameSuffix()))
             {
                deploymentHandler.getResources().add(getFileDescriptor());
+               handled = true;
             }
          }
+         return handled;
       }
       
-      protected void handle()
+      protected boolean handle()
       {
          log.trace("found " + name);
+         boolean handled = false;
          for (Entry<String, DeploymentHandler> entry: deploymentHandlers)
          {
-            handle(entry.getValue());
+            // can handle() and if handle() returns false, take previous value of handled
+            handled = (handle(entry.getValue()) || handled);
          }
+         return handled;
       }
       
       private ClassFile getClassFile()
@@ -177,9 +187,9 @@
       return Long.MAX_VALUE;
    }
    
-   protected void handleItem(String name)
+   protected boolean handleItem(String name)
    {
-      new Handler(name, deploymentStrategy.getDeploymentHandlers().entrySet(), deploymentStrategy.getClassLoader()).handle();
+      return new Handler(name, deploymentStrategy.getDeploymentHandlers().entrySet(), deploymentStrategy.getClassLoader()).handle();
    }
 
 }

Modified: trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java	2008-11-18 10:06:33 UTC (rev 9586)
+++ trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -72,7 +72,6 @@
             annotationDeploymentHandler = new AnnotationDeploymentHandler(new SeamDeploymentProperties(classLoader).getPropertyValues(AnnotationDeploymentHandler.ANNOTATIONS_KEY), classLoader);
             getDeploymentHandlers().put(AnnotationDeploymentHandler.NAME, annotationDeploymentHandler);
          }
-         getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, new DotPageDotXmlDeploymentHandler());
       }
    }
    
@@ -91,6 +90,15 @@
       }
    }
    
+   /**
+    * It is both enabled and the classpath was detected. Admittedly,
+    * this seems like a redundant confirmation.
+    */
+   public boolean available()
+   {
+      return isEnabled() && isHotDeployClassLoaderEnabled();
+   }
+   
    public boolean isEnabled()
    {
       return classLoader != null;

Added: trunk/src/main/org/jboss/seam/deployment/HotDeploymentTimestampCheckStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/HotDeploymentTimestampCheckStrategy.java	                        (rev 0)
+++ trunk/src/main/org/jboss/seam/deployment/HotDeploymentTimestampCheckStrategy.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -0,0 +1,33 @@
+package org.jboss.seam.deployment;
+
+import java.io.File;
+
+/**
+ * An accelerated version of the HotDeploymentStrategy that uses the SimpleURLScanner
+ * to determine the timestamp of the latest file.
+ * 
+ * @author Dan Allen
+ */
+public class HotDeploymentTimestampCheckStrategy extends TimestampCheckStrategy
+{
+   private HotDeploymentStrategy delegateStrategy;
+   
+   public HotDeploymentTimestampCheckStrategy(HotDeploymentStrategy hotDeploymentStrategy)
+   {
+      delegateStrategy = hotDeploymentStrategy;
+      getDeploymentHandlers().putAll(delegateStrategy.getDeploymentHandlers());
+   }
+   
+   @Override
+   public DeploymentStrategy getDelegateStrategy()
+   {
+      return delegateStrategy;
+   }
+   
+   @Override
+   public void scan()
+   {
+      getScanner().scanDirectories(delegateStrategy.getFiles().toArray(new File[0]));
+   }
+   
+}

Modified: trunk/src/main/org/jboss/seam/deployment/Scanner.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/Scanner.java	2008-11-18 10:06:33 UTC (rev 9586)
+++ trunk/src/main/org/jboss/seam/deployment/Scanner.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -20,6 +20,14 @@
    public void scanDirectories(File[] directories);
    
    /**
+    * Recursively scan directories, skipping directories in the exclusion list.
+    * 
+    * @param directories An array of the roots of the directory trees to scan
+    * @param excludedDirectories Directories to skip over during the recursive scan
+    */
+   public void scanDirectories(File[] directories, File[] excludedDirectories);
+   
+   /**
     * Scan for structures which contain any of the given resources in their root
     * 
     * @param resources The resources to scan for

Added: trunk/src/main/org/jboss/seam/deployment/TimestampCheckStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/TimestampCheckStrategy.java	                        (rev 0)
+++ trunk/src/main/org/jboss/seam/deployment/TimestampCheckStrategy.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -0,0 +1,48 @@
+package org.jboss.seam.deployment;
+
+/**
+ * An accelerated version of the underlying strategy that uses the SimpleURLScanner
+ * to determine the timestamp of the latest file.
+ * 
+ * @author Dan Allen
+ */
+public abstract class TimestampCheckStrategy extends DeploymentStrategy
+{
+   private Scanner scanner;
+
+   @Override
+   public ClassLoader getClassLoader()
+   {
+      return getDelegateStrategy().getClassLoader();
+   }
+
+   @Override
+   protected String getDeploymentHandlersKey()
+   {
+      return getDelegateStrategy().getDeploymentHandlersKey();
+   }
+   
+   public abstract DeploymentStrategy getDelegateStrategy();
+
+   public boolean changedSince(long mark)
+   {
+      scan();
+      return getTimestamp() > mark;
+   }
+
+   @Override
+   public Scanner getScanner()
+   {
+      if (scanner == null)
+      {
+         initScanner();
+      }
+      return scanner;
+   }
+
+   protected void initScanner()
+   {
+      scanner = new TimestampURLScanner(this);
+   }
+
+}
\ No newline at end of file

Added: trunk/src/main/org/jboss/seam/deployment/TimestampURLScanner.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/TimestampURLScanner.java	                        (rev 0)
+++ trunk/src/main/org/jboss/seam/deployment/TimestampURLScanner.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -0,0 +1,40 @@
+package org.jboss.seam.deployment;
+
+/**
+ * A no-op version of the URLScanner that merely returns whether the deployment
+ * handler would in fact handle this file. It does not process the file
+ * in any way. This allows us to use this scanner for timestamp checking.
+ * 
+ * @author Dan Allen
+ */
+public class TimestampURLScanner extends URLScanner
+{
+   public TimestampURLScanner(DeploymentStrategy deploymentStrategy)
+   {
+      super(deploymentStrategy);
+   }
+
+   @Override
+   protected boolean handleItem(String name)
+   {
+      for (DeploymentHandler handler : getDeploymentStrategy().getDeploymentHandlers().values())
+      {
+         if (handler instanceof ClassDeploymentHandler)
+         {
+            if (name.endsWith(".class"))
+            {
+               return true;
+            }
+         }
+         else
+         {
+            if (name.endsWith(handler.getMetadata().getFileNameSuffix()))
+            {
+               return true;
+            }
+         }
+      }
+      return false;
+   }
+  
+}

Modified: trunk/src/main/org/jboss/seam/deployment/URLScanner.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/URLScanner.java	2008-11-18 10:06:33 UTC (rev 9586)
+++ trunk/src/main/org/jboss/seam/deployment/URLScanner.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -37,9 +37,14 @@
    
    public void scanDirectories(File[] directories)
    {
+      scanDirectories(directories, new File[0]);
+   }
+   
+   public void scanDirectories(File[] directories, File[] excludedDirectories)
+   {
       for (File directory : directories)
       {
-         handleDirectory(directory, null);
+         handleDirectory(directory, null, excludedDirectories);
       }
    }
    
@@ -131,18 +136,35 @@
 
    private void handleDirectory(File file, String path)
    {
-      log.trace("directory: " + file);
+      handleDirectory(file, path, new File[0]);
+   }
+   
+   private void handleDirectory(File file, String path, File[] excludedDirectories)
+   {
+      for (File excludedDirectory : excludedDirectories)
+      {
+         if (file.equals(excludedDirectory))
+         {
+            log.trace("skipping excluded directory: " + file);
+            return;
+         }
+      } 
+      
+      log.trace("handling directory: " + file);
       for ( File child: file.listFiles() )
       {
          String newPath = path==null ? child.getName() : path + '/' + child.getName();
          if ( child.isDirectory() )
          {
-            handleDirectory(child, newPath);
+            handleDirectory(child, newPath, excludedDirectories);
          }
          else
          {
-            touchTimestamp(child);
-            handleItem(newPath);
+            if (handleItem(newPath))
+            {
+               // only try to update the timestamp on this scanner if the file was actually handled
+               touchTimestamp(child);
+            }
          }
       }
    }

Modified: trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java	2008-11-18 10:06:33 UTC (rev 9586)
+++ trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -22,6 +22,8 @@
    
    private File[] warRoot;
    
+   private File[] excludedDirectories;
+   
    public static final String HANDLERS_KEY = "org.jboss.seam.deployment.deploymentHandlers";
    
    public static final String NAME = "warRootDeploymentStrategy";
@@ -30,11 +32,18 @@
    
    public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot)
    {
+      this(classLoader, warRoot, new File[0]);
+   }
+   
+   public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot, File[] excludedDirectories)
+   {
       this.classLoader = classLoader;
       this.warRoot = new File[1];
+      this.excludedDirectories = excludedDirectories;
       if (warRoot != null)
       {
          this.warRoot[0] = warRoot;
+         getFiles().add(warRoot);
       }
       else
       {
@@ -60,10 +69,15 @@
    @Override
    public void scan()
    {
-      getScanner().scanDirectories(warRoot);
+      getScanner().scanDirectories(warRoot, excludedDirectories);
       postScan();
    }
    
+   public File[] getExcludedDirectories()
+   {
+      return excludedDirectories;
+   }
+   
    public Set<FileDescriptor> getDotPageDotXmlFileNames()
    {
       return dotPageDotXmlDeploymentHandler.getResources();

Added: trunk/src/main/org/jboss/seam/deployment/WarRootTimestampCheckStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/WarRootTimestampCheckStrategy.java	                        (rev 0)
+++ trunk/src/main/org/jboss/seam/deployment/WarRootTimestampCheckStrategy.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -0,0 +1,34 @@
+package org.jboss.seam.deployment;
+
+import java.io.File;
+
+
+/**
+ * An accelerated version of the WarRootDeploymentStrategy that uses the SimpleURLScanner
+ * to determine the timestamp of the latest file.
+ * 
+ * @author Dan Allen
+ */
+public class WarRootTimestampCheckStrategy extends TimestampCheckStrategy
+{
+   private WarRootDeploymentStrategy delegateStrategy;
+   
+   public WarRootTimestampCheckStrategy(WarRootDeploymentStrategy warRootDeploymentStrategy)
+   {
+      delegateStrategy = warRootDeploymentStrategy;
+      getDeploymentHandlers().putAll(delegateStrategy.getDeploymentHandlers());
+   }
+
+   @Override
+   public DeploymentStrategy getDelegateStrategy()
+   {
+      return delegateStrategy;
+   }
+
+   @Override
+   public void scan()
+   {
+      getScanner().scanDirectories(delegateStrategy.getFiles().toArray(new File[0]), delegateStrategy.getExcludedDirectories());
+   }
+
+}

Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java	2008-11-18 10:06:33 UTC (rev 9586)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java	2008-11-18 10:08:19 UTC (rev 9587)
@@ -51,9 +51,11 @@
 import org.jboss.seam.deployment.ClassDescriptor;
 import org.jboss.seam.deployment.FileDescriptor;
 import org.jboss.seam.deployment.HotDeploymentStrategy;
+import org.jboss.seam.deployment.HotDeploymentTimestampCheckStrategy;
 import org.jboss.seam.deployment.SeamDeploymentProperties;
 import org.jboss.seam.deployment.StandardDeploymentStrategy;
 import org.jboss.seam.deployment.WarRootDeploymentStrategy;
+import org.jboss.seam.deployment.WarRootTimestampCheckStrategy;
 import org.jboss.seam.exception.Exceptions;
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
@@ -95,6 +97,8 @@
    private HotDeploymentStrategy hotDeploymentStrategy;
    private WarRootDeploymentStrategy warRootDeploymentStrategy;
    
+   private File warClassesDirectory;
+   private File warLibDirectory;
    private File hotDeployDirectory;
    private File warRoot;
    
@@ -116,6 +120,8 @@
    {
       this.servletContext = servletContext;
       this.warRoot = getRealFile(servletContext, "/");
+      this.warClassesDirectory = getRealFile(servletContext, "/WEB-INF/classes");
+      this.warLibDirectory = getRealFile(servletContext, "/WEB-INF/lib");
       this.hotDeployDirectory = getRealFile(servletContext, HotDeploymentStrategy.DEFAULT_HOT_DEPLOYMENT_DIRECTORY_PATH);
    }
    
@@ -686,38 +692,36 @@
       }
       ServletLifecycle.beginInitialization();
       Contexts.getApplicationContext().set(Component.PROPERTIES, properties);
-      hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
-      scanForComponents();
       addComponent( new ComponentDescriptor(Init.class), Contexts.getApplicationContext());
       Init init = (Init) Component.getInstance(Init.class, ScopeType.APPLICATION);
-      init.setHotDeployPaths( hotDeploymentStrategy.getHotDeploymentPaths() );
+      // Make the deployment strategies available in the contexts. This gives
+      // access to custom deployment handlers for processing custom annotations
+      Contexts.getEventContext().set(StandardDeploymentStrategy.NAME, standardDeploymentStrategy);
+      scanForComponents();
       ComponentDescriptor desc = findDescriptor(Jbpm.class);
       if (desc != null && desc.isInstalled())
       {
          init.setJbpmInstalled(true);
       }
       init.checkDefaultInterceptors();
-      init.setTimestamp( System.currentTimeMillis() );
+      init.setTimestamp(System.currentTimeMillis());
       addSpecialComponents(init);
       
       // Add the war root deployment
-      warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot);
+      warRootDeploymentStrategy = new WarRootDeploymentStrategy(
+            Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
+      Contexts.getEventContext().set(WarRootDeploymentStrategy.NAME, warRootDeploymentStrategy);
       warRootDeploymentStrategy.scan();
+      init.setWarTimestamp(System.currentTimeMillis());
       
-      // Make the deployment strategies available in the contexts. This gives 
-      // access to custom deployment handlers for processing custom annotations
-      // etc.
-      Contexts.getEventContext().set(StandardDeploymentStrategy.NAME, standardDeploymentStrategy);
+      hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader(), isHotDeployEnabled(init));
       Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
-      Contexts.getEventContext().set(WarRootDeploymentStrategy.NAME, warRootDeploymentStrategy);
+      init.setHotDeployPaths( hotDeploymentStrategy.getHotDeploymentPaths() );
       
-      if (hotDeploymentStrategy.isEnabled())
+      if (hotDeploymentStrategy.available())
       {
          hotDeploymentStrategy.scan();
-         if (hotDeploymentStrategy.isHotDeployClassLoaderEnabled())
-         {
-            installHotDeployableComponents();
-         }
+         installHotDeployableComponents();
       }
       
       installComponents(init);
@@ -734,21 +738,33 @@
 
    public void redeploy(HttpServletRequest request) throws InterruptedException
    {
+      redeploy(request, (Init) ServletLifecycle.getServletContext().getAttribute( Seam.getComponentName(Init.class) ));
+   }
+   
+   public void redeploy(HttpServletRequest request, Init init) throws InterruptedException
+   {
+      // It's possible to have the HotDeployFilter installed but disabled
+      if (!isHotDeployEnabled(init))
+      {
+         return;
+      }
+      
       ReentrantLock lock = new ReentrantLock();
       if (lock.tryLock(500, TimeUnit.MILLISECONDS))
       {
          try
          {
-            hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
-            if (hotDeploymentStrategy.isEnabled())
+            hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader(), isHotDeployEnabled(init));
+            
+            if (hotDeploymentStrategy.available() && new HotDeploymentTimestampCheckStrategy(hotDeploymentStrategy).changedSince(init.getTimestamp()))
             {
+               ServletLifecycle.beginReinitialization(request);
+               Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
                hotDeploymentStrategy.scan();
-               Init init = (Init) ServletLifecycle.getServletContext().getAttribute( Seam.getComponentName(Init.class) );
                
-               if (init.getTimestamp() < hotDeploymentStrategy.getTimestamp())
+               if (hotDeploymentStrategy.getTimestamp() > init.getTimestamp())
                {
-                  log.info("redeploying");
-                  ServletLifecycle.beginReinitialization(request);
+                  log.info("redeploying components");
                   Seam.clearComponentNameCache();
                   for ( String name: init.getHotDeployableComponents() )
                   {
@@ -765,30 +781,33 @@
                      Contexts.getApplicationContext().remove(name + COMPONENT_SUFFIX);
                   }
                
-                  if (hotDeploymentStrategy.isHotDeployClassLoaderEnabled())
-                  {
-                     installHotDeployableComponents();
-                  }
-                  Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
-                  init.setTimestamp( System.currentTimeMillis() );
+                  init.getHotDeployableComponents().clear();
+                  installHotDeployableComponents();
                   installComponents(init);
-                  ServletLifecycle.endReinitialization();
-                  log.info("done redeploying");
+                  log.info("done redeploying components");
                }
+               // update the timestamp outside of the second timestamp check to be sure we don't cause an unnecessary scan
+               // the second scan checks annotations (the slow part) which might happen to exclude the most recent file
+               init.setTimestamp(System.currentTimeMillis());
+               ServletLifecycle.endReinitialization();
+            }
                
-               WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot);
+            WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(
+                  Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
+            if (new WarRootTimestampCheckStrategy(warRootDeploymentStrategy).changedSince(init.getWarTimestamp()))
+            {
                warRootDeploymentStrategy.scan();
-               if (init.getWarTimestamp() < warRootDeploymentStrategy.getTimestamp())
+               if (warRootDeploymentStrategy.getTimestamp() > init.getWarTimestamp())
                {
+                  log.info("redeploying page descriptors...");
                   Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
-                  if (pages!= null) {
+                  if (pages != null) {
                       pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
                   }
-                  ServletLifecycle.getServletContext().removeAttribute( Seam.getComponentName(Exceptions.class) );
+                  ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class));
                   init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp());
+                  log.info("done redeploying page descriptors");
                }
-            
-                                
             }
          }
          finally
@@ -807,26 +826,27 @@
       }
    }
    
-   private HotDeploymentStrategy createHotDeployment(ClassLoader classLoader)
+   private HotDeploymentStrategy createHotDeployment(ClassLoader classLoader, boolean hotDeployEnabled)
    {
       if (isGroovyPresent())
       {
          log.debug("Using Java + Groovy hot deploy");
-         return HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory, isDebugEnabled());
+         return HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory, hotDeployEnabled);
       }
       else 
       {
          log.debug("Using Java hot deploy");
-         return new HotDeploymentStrategy(classLoader, hotDeployDirectory, isDebugEnabled());
+         return new HotDeploymentStrategy(classLoader, hotDeployDirectory, hotDeployEnabled);
       }
    }
    
-   private static boolean isDebugEnabled()
+   private boolean isHotDeployEnabled(Init init)
    {
       return Resources.getResource("META-INF/debug.xhtml", null) != null;
+      //return init.isDebug();
    }
    
-   private static boolean isGroovyPresent()
+   private boolean isGroovyPresent()
    {
       try 
       {
@@ -1033,7 +1053,8 @@
    }
 
    private void addSpecialComponents(Init init)
-   {}
+   {
+   }
 
    private void installComponents(Init init)
    {
@@ -1126,7 +1147,7 @@
                descriptor.getJndiName()
             );
          context.set(componentName, component);
-         if ( hotDeploymentStrategy.isEnabled() && hotDeploymentStrategy.isFromHotDeployClassLoader( descriptor.getComponentClass() ) )
+         if ( hotDeploymentStrategy != null && hotDeploymentStrategy.isEnabled() && hotDeploymentStrategy.isFromHotDeployClassLoader( descriptor.getComponentClass() ) )
          {
             Init.instance().addHotDeployableComponent( component.getName() );
          }




More information about the seam-commits mailing list