[jboss-cvs] JBossAS SVN: r110801 - projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 28 06:46:42 EST 2011


Author: alesj
Date: 2011-02-28 06:46:42 -0500 (Mon, 28 Feb 2011)
New Revision: 110801

Modified:
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
Log:
[JBAS-8864]; check missing deployments as well.


Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java	2011-02-28 02:26:21 UTC (rev 110800)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java	2011-02-28 11:46:42 UTC (rev 110801)
@@ -23,9 +23,12 @@
 
 import java.io.IOException;
 import java.net.URISyntaxException;
+import java.util.Collection;
 
+import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.deployers.structure.spi.main.MainDeployerInternals;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
 import org.jboss.logging.Logger;
 import org.jboss.vfs.VirtualFile;
@@ -50,6 +53,9 @@
    /** The structure cache */
    private volatile StructureCache<T> cache;
 
+   /** The missing deployments check */
+   private boolean checkMissingDeployments = true;
+
    protected AbstractStructureModificationChecker()
    {
    }
@@ -171,7 +177,8 @@
    {
       if (root == null)
          throw new IllegalArgumentException("Null root");
-      if (deploymentContext == null)
+
+      if (deploymentContext == null && checkMissingDeployments == false)
          return false;
 
       // skip vfs deployment context lookup accepted by filter
@@ -186,7 +193,31 @@
             return result;
          }
       }
-      
+
+      if (deploymentContext == null && checkMissingDeployments)
+      {
+         Collection<Deployment> missing = getMainDeployerInternals().getMissingDeployer();
+         if (missing != null && missing.isEmpty() == false)
+         {
+            for (Deployment deployment : missing)
+            {
+               if (deployment instanceof VFSDeployment)
+               {
+                  VFSDeployment vfsd = (VFSDeployment) deployment;
+                  VirtualFile deploymentRoot = vfsd.getRoot();
+                  if (root.equals(deploymentRoot))
+                  {
+                     boolean modified = hasRootBeenModified(root);
+                     if (modified)
+                        getCache().invalidateCache(root);
+                     return modified;
+                  }
+               }
+            }
+         }
+         return false;
+      }
+
       boolean result = hasDeploymentContextBeenModified(root, deploymentContext);
       if (result)
       {
@@ -232,13 +263,23 @@
    }
 
    /**
+    * Set missing deployments check flag.
+    *
+    * @param checkMissingDeployments the missing deployments check flag
+    */
+   public void setCheckMissingDeployments(boolean checkMissingDeployments)
+   {
+      this.checkMissingDeployments = checkMissingDeployments;
+   }
+
+   /**
     * Default root check constraints.
     */
    private static class DefaultRootFilter implements ModificationCheckerFilter
    {
       public boolean accepts(VirtualFile file)
       {
-         return ! file.isDirectory();
+         return file.isDirectory() == false;
       }
 
       public boolean checkRootOnly(VirtualFile root)



More information about the jboss-cvs-commits mailing list