[jboss-cvs] JBossAS SVN: r87683 - projects/jboss-deployers/branches/Branch_2_0/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
Wed Apr 22 14:16:18 EDT 2009


Author: alesj
Date: 2009-04-22 14:16:18 -0400 (Wed, 22 Apr 2009)
New Revision: 87683

Modified:
   projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
   projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
   projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java
Log:
Port changes from the trunk.

Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java	2009-04-22 18:10:28 UTC (rev 87682)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java	2009-04-22 18:16:18 UTC (rev 87683)
@@ -120,7 +120,14 @@
 
       // skip vfs deployment context lookup if archive or file
       if (root.isArchive() || root.isLeaf())
-         return root.hasBeenModified();
+      {
+         boolean result = hasRootBeenModified(root);
+         if (result)
+         {
+            getCache().invalidateCache(root.getPathName());
+         }
+         return result;
+      }
 
       VFSDeploymentContext deploymentContext;
       try
@@ -175,10 +182,19 @@
 
       VFSDeployment vfsDeployment = VFSDeployment.class.cast(deployment);
       VirtualFile root = vfsDeployment.getRoot();
+
+      boolean result = false;
+
       if (checkRoot && (root.isArchive() || root.isLeaf()))
-         return root.hasBeenModified();
+      {
+         result = hasRootBeenModified(root);
+      }
 
-      boolean result = hasStructureBeenModifed(root, deploymentContext);
+      if (result == false)
+      {
+         result = hasStructureBeenModifed(root, deploymentContext);
+      }
+
       if (result)
       {
          String pathName = root.getPathName();
@@ -188,6 +204,19 @@
    }
 
    /**
+    * Check the root for modification.
+    *
+    * @param root the root to check
+    * @return true if modified, false otherwise
+    * @throws IOException for any error
+    */
+   protected boolean hasRootBeenModified(VirtualFile root) throws IOException
+   {
+      // for back compatibility
+      return root.hasBeenModified();
+   }
+
+   /**
     * Has structure been modified.
     *
     * @param root the client root

Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java	2009-04-22 18:10:28 UTC (rev 87682)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java	2009-04-22 18:16:18 UTC (rev 87683)
@@ -61,6 +61,23 @@
       this.filter = filter;
    }
 
+   @Override
+   protected boolean hasRootBeenModified(VirtualFile root) throws IOException
+   {
+      String pathName = root.getPathName();
+      Long cachedValue = getCache().getCacheValue(pathName);
+      long lastModified = root.getLastModified();
+      if (cachedValue != null)
+      {
+         return (cachedValue < lastModified);            
+      }
+      else
+      {
+         getCache().putCacheValue(pathName, lastModified);
+         return false;
+      }
+   }
+
    protected boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException
    {
       StructureMetaData structureMetaData = deploymentContext.getTransientManagedObjects().getAttachment(StructureMetaData.class);

Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java	2009-04-22 18:10:28 UTC (rev 87682)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java	2009-04-22 18:16:18 UTC (rev 87683)
@@ -72,6 +72,12 @@
       return delegate.getMainDeployerStructure();
    }
 
+   @Override
+   protected boolean hasRootBeenModified(VirtualFile root) throws IOException
+   {
+      return delegate.hasRootBeenModified(root);
+   }
+
    protected boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException
    {
       boolean modified = delegate.hasStructureBeenModifed(root, deploymentContext);




More information about the jboss-cvs-commits mailing list