[jboss-cvs] JBossAS SVN: r83994 - in projects/jboss-deployers/trunk: deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 9 07:50:11 EST 2009


Author: alesj
Date: 2009-02-09 07:50:11 -0500 (Mon, 09 Feb 2009)
New Revision: 83994

Added:
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/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/DefaultStructureCache.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java
Modified:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java
Log:
[JBDEPLOY-157]; move isModified logic from jbossas.
Fix the client/server assumption.

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java	2009-02-09 09:55:55 UTC (rev 83993)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -58,7 +58,8 @@
 
    protected void assertUnpacked(VirtualFile file) throws Exception
    {
-      assertSame(file, VFSUtils.unpack(file));
+      VirtualFile modified = VFSUtils.unpack(file);
+      assertTrue(VFSUtils.isTemporaryFile(modified));
    }
 
    protected void assertNoChildContexts(VFSDeploymentContext context)

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java	2009-02-09 09:55:55 UTC (rev 83993)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -27,6 +27,8 @@
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
 import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
 import org.jboss.test.deployers.vfs.structure.support.WarUnpackStructure;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * WARUnpackUnitTestCase.
@@ -53,6 +55,7 @@
    public void testWarDeployerUnpack() throws Throwable
    {
       VFSDeploymentContext root = assertDeploy("/structure/war/simple", "simple.war");
-      assertUnpacked(root.getRoot());
+      VirtualFile file = root.getRoot();
+      assertSame(file, VFSUtils.unpack(file));
    }
 }
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -0,0 +1,200 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.vfs.spi.structure.modified;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * AbstractStructureModificationChecker.
+ *
+ * @param <T> exact cache value type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractStructureModificationChecker<T> implements StructureModificationChecker
+{
+   /** The log */
+   protected Logger log = Logger.getLogger(getClass());
+
+   /** The main deployer structure */
+   private MainDeployerStructure mainDeployer;
+
+   /** The structure cache */
+   private StructureCache<T> cache;
+
+   protected AbstractStructureModificationChecker(MainDeployerStructure mainDeployer)
+   {
+      if (mainDeployer == null)
+         throw new IllegalArgumentException("Null main deployer");
+      
+      this.mainDeployer = mainDeployer;
+   }
+
+   /**
+    * Get the structure cache.
+    *
+    * @return the structure cache
+    */
+   protected StructureCache<T> getCache()
+   {
+      if (cache == null)
+         cache = new DefaultStructureCache<T>();
+
+      return cache;
+   }
+
+   /**
+    * Set the structure cache.
+    *
+    * @param cache the structure cache
+    */
+   public void setCache(StructureCache<T> cache)
+   {
+      this.cache = cache;
+   }
+
+   /**
+    * Get deployment context.
+    *
+    * @param name the deployment context name
+    * @return vfs deployment context or null if doesn't exist or not vfs based
+    */
+   @SuppressWarnings("deprecation")
+   protected VFSDeploymentContext getDeploymentContext(String name)
+   {
+      DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
+      if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
+         return null;
+
+      return (VFSDeploymentContext) deploymentContext;
+   }
+
+   public boolean hasStructureBeenModified(VirtualFile root) throws IOException
+   {
+      if (root == null)
+         throw new IllegalArgumentException("Null root");
+
+      // skip vfs deployment context lookup if archive or file
+      if (root.isArchive() || root.isLeaf())
+         return root.hasBeenModified();
+
+      VFSDeploymentContext deploymentContext;
+      try
+      {
+         String name = root.toURI().toString();
+         deploymentContext = getDeploymentContext(name);
+         if (deploymentContext != null)
+            return hasStructureBeenModified(deploymentContext, false);
+      }
+      catch (URISyntaxException ignore)
+      {
+      }
+
+      log.trace("Falling back to root name: " + root);
+      deploymentContext = getDeploymentContext(root.getName());
+      if (deploymentContext != null)
+         return hasStructureBeenModified(deploymentContext, false);
+
+      return false;
+   }
+
+   public boolean hasStructureBeenModified(VFSDeployment deployment) throws IOException
+   {
+      if (deployment == null)
+         throw new IllegalArgumentException("Null deployment");
+
+      VFSDeploymentContext deploymentContext = getDeploymentContext(deployment.getName());
+      return deploymentContext != null && hasStructureBeenModified(deploymentContext);
+   }
+
+   public boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext) throws IOException
+   {
+      return hasStructureBeenModified(deploymentContext, true);
+   }
+
+   /**
+    * Has structure been modified.
+    *
+    * @param deploymentContext the deployment context
+    * @param checkRoot should we check root
+    * @return true if modifed, false otherwise
+    * @throws IOException for any error
+    */
+   protected boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext, boolean checkRoot) throws IOException
+   {
+      Deployment deployment = deploymentContext.getDeployment();
+      if (deployment == null || deployment instanceof VFSDeployment == false)
+      {
+         log.warn("Deployment is not VFS or not top level.");
+         return false;
+      }
+
+      VFSDeployment vfsDeployment = VFSDeployment.class.cast(deployment);
+      VirtualFile root = vfsDeployment.getRoot();
+      if (checkRoot && (root.isArchive() || root.isLeaf()))
+         return root.hasBeenModified();
+
+      boolean result = hasStructureBeenModifed(root, deploymentContext);
+      if (result)
+      {
+         String pathName = root.getPathName();
+         getCache().invalidateCache(pathName);
+      }
+      return result;
+   }
+
+   /**
+    * Has structure been modified.
+    *
+    * @param root the client root
+    * @param deploymentContext the deployment context
+    * @return true if modifed, false otherwise
+    * @throws IOException for any error
+    */
+   protected abstract boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException;
+
+   public void addStructureRoot(VirtualFile root)
+   {
+      if (root == null)
+         throw new IllegalArgumentException("Null root");
+
+      String pathName = root.getPathName();
+      getCache().initializeCache(pathName);
+   }
+
+   public void removeStructureRoot(VirtualFile root)
+   {
+      if (root == null)
+         throw new IllegalArgumentException("Null root");
+
+      String pathName = root.getPathName();
+      getCache().removeCache(pathName);
+   }
+}

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.vfs.spi.structure.modified;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Default structure cache.
+ *
+ * @param <T> exact cache value type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class DefaultStructureCache<T> implements StructureCache<T>
+{
+   private Map<String, T> map = new ConcurrentHashMap<String, T>();
+
+   public void initializeCache(String pathName)
+   {
+   }
+
+   public T putCacheValue(String pathName, T value)
+   {
+      return map.put(pathName, value);
+   }
+
+   public T getCacheValue(String pathName)
+   {
+      return map.get(pathName);
+   }
+
+   public void invalidateCache(String pathName)
+   {
+      removeCache(pathName);
+   }
+
+   public void removeCache(String pathName)
+   {
+      Iterator<Map.Entry<String, T>> iter = map.entrySet().iterator();
+      while (iter.hasNext())
+      {
+         Map.Entry<String, T> entry = iter.next();
+         if (entry.getKey().startsWith(pathName))
+         {
+            iter.remove();
+         }
+      }
+   }
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.vfs.spi.structure.modified;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * MetaDataStructureModificationChecker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MetaDataStructureModificationChecker extends AbstractStructureModificationChecker<Long>
+{
+   /** The metadata filter */
+   private VirtualFileFilter filter;
+
+   public MetaDataStructureModificationChecker(MainDeployerStructure mainDeployer)
+   {
+      super(mainDeployer);
+   }
+
+   /**
+    * Set the metadata filter.
+    *
+    * @param filter the metadata filter
+    */
+   public void setFilter(VirtualFileFilter filter)
+   {
+      this.filter = filter;
+   }
+
+   protected boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException
+   {
+      StructureMetaData structureMetaData = deploymentContext.getTransientManagedObjects().getAttachment(StructureMetaData.class);
+      return hasStructureBeenModified(root, structureMetaData);
+   }
+
+   /**
+    * Has structure been modified.
+    *
+    * @param root the root
+    * @param structureMetaData the structure metadata
+    * @return true if modifed, false otherwise
+    * @throws IOException for any error
+    */
+   protected boolean hasStructureBeenModified(VirtualFile root, StructureMetaData structureMetaData) throws IOException
+   {
+      if (structureMetaData == null)
+         return false;
+
+      List<ContextInfo> contexts = structureMetaData.getContexts();
+      if (contexts != null && contexts.isEmpty() == false)
+      {
+         for (ContextInfo contextInfo : contexts)
+         {
+            boolean result = hasStructureBeenModifed(root, contextInfo);
+            if (result)
+               return true;
+         }
+      }
+      return false;
+   }
+
+   /**
+    * Has structure been modifed.
+    *
+    * @param root the root
+    * @param contextInfo the context info
+    * @return true if modifed, false otherwise
+    * @throws IOException for any error
+    */
+   protected boolean hasStructureBeenModifed(VirtualFile root, ContextInfo contextInfo) throws IOException
+   {
+      String path = contextInfo.getPath();
+      VirtualFile contextRoot = root.getChild(path);
+      if (contextRoot != null)
+      {
+         List<String> metadataPaths = contextInfo.getMetaDataPath();
+         if (metadataPaths != null && metadataPaths.isEmpty() == false)
+         {
+            for (String metaDataPath : metadataPaths)
+            {
+               VirtualFile mdpVF = contextRoot.getChild(metaDataPath);
+               if (mdpVF != null)
+               {
+                  List<VirtualFile> children = mdpVF.getChildren(filter);
+                  if (children != null && children.isEmpty() == false)
+                  {
+                     for (VirtualFile child : children)
+                     {
+                        String pathName = child.getPathName();
+                        Long timestamp = getCache().getCacheValue(pathName);
+                        long lastModified = child.getLastModified();
+                        getCache().putCacheValue(pathName, lastModified);
+                        if (timestamp != null && timestamp < lastModified)
+                        {
+                           if (log.isTraceEnabled())
+                              log.trace("Metadata location modified: " + child);
+                           return true;
+                        }
+                     }
+                  }
+               }
+            }
+         }
+         if ("".equals(path) == false)
+         {
+            StructureMetaData structureMetaData = contextInfo.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class);
+            return hasStructureBeenModified(contextRoot, structureMetaData);
+         }
+      }
+      return false;
+   }
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.vfs.spi.structure.modified;
+
+/**
+ * Simple structure cache.
+ *
+ * @param <T> exact cache value type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface StructureCache<T>
+{
+   /**
+    * Initialize cache.
+    *
+    * @param pathName the path name
+    */
+   void initializeCache(String pathName);
+
+   /**
+    * Put cache value.
+    *
+    * @param pathName the path name
+    * @param value the value
+    * @return previous value
+    */
+   T putCacheValue(String pathName, T value);
+
+   /**
+    * Get cache value.
+    *
+    * @param pathName the path name
+    * @return the cache value
+    */
+   T getCacheValue(String pathName);
+
+   /**
+    * Invalidate cache for path name.
+    *
+    * @param pathName the path name
+    */
+   void invalidateCache(String pathName);
+
+   /**
+    * Remove cache for path name.
+    *
+    * @param pathName the path name
+    */
+   void removeCache(String pathName);
+}

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.vfs.spi.structure.modified;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * StructureListener.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface StructureListener
+{
+   /**
+    * Add structure root.
+    *
+    * @param root the structure root
+    */
+   void addStructureRoot(VirtualFile root);
+
+   /**
+    * Remove structure root.
+    *
+    * @param root the structure root
+    */
+   void removeStructureRoot(VirtualFile root);
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java	2009-02-09 12:50:11 UTC (rev 83994)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.vfs.spi.structure.modified;
+
+import java.io.IOException;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Simple structure modification checker interface.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface StructureModificationChecker extends StructureListener
+{
+   /**
+    * Has structure been modified.
+    *
+    * @param root the structure's root
+    * @return true if structure has been modified, false otherwise
+    * @throws IOException for any error
+    */
+   boolean hasStructureBeenModified(VirtualFile root) throws IOException;
+
+   /**
+    * Has structure been modified.
+    *
+    * @param deployment the vfs deployment
+    * @return true if structure has been modified, false otherwise
+    * @throws IOException for any error
+    */
+   boolean hasStructureBeenModified(VFSDeployment deployment) throws IOException;
+
+   /**
+    * Has structure been modified.
+    *
+    * @param deploymentContext the vfs deployment context
+    * @return true if structure has been modified, false otherwise
+    * @throws IOException for any error
+    */
+   boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext) throws IOException;
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list