[jboss-cvs] JBossAS SVN: r83777 - in projects/vfs/trunk/src: main/java/org/jboss/virtual/plugins/cache and 11 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 2 08:25:10 EST 2009


Author: alesj
Date: 2009-02-02 08:25:09 -0500 (Mon, 02 Feb 2009)
New Revision: 83777

Added:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSRegistryTest.java
Removed:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSContextFinder.java
Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/AbstractVFSCache.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableTimedVFSCache.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableVFSCache.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/PathMatchingVFSCache.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/AbstractCopyMechanism.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/TempContext.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/AbstractVFSHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/VFSCache.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/helpers/NoopVFSCache.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTestCase.java
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSCacheTest.java
Log:
Old tests are all working.
Todo on new temp cleanup logic.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -125,10 +125,10 @@
       {
          VirtualFileHandler fileHandler = file.getHandler();
          VFSContext context = fileHandler.getVFSContext();
-         context.cleanupTempHandlers(fileHandler.getPathName());
+         context.cleanupTempInfo(fileHandler.getPathName());
          
          VirtualFileHandler contextHandler = context.getRoot();
-         // the file is the context root, hence possible cache candidate
+         // the file is the context root, hence possible registry candidate
          if (fileHandler.equals(contextHandler))
          {
             VFSRegistry registry = VFSRegistry.getInstance();

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -1083,7 +1083,7 @@
     * @param uri the uri
     * @return uri's path string
     */
-   protected static String stripProtocol(URI uri)
+   public static String stripProtocol(URI uri)
    {
       String path = uri.getPath();
       if (path != null && path.length() > 0)
@@ -1111,7 +1111,7 @@
     * @param context the vfs context
     * @return contex's root path w/o protocol
     */
-   protected static String getKey(VFSContext context)
+   public static String getKey(VFSContext context)
    {
       URI uri = context.getRootURI();
       return stripProtocol(uri);

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/AbstractVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/AbstractVFSCache.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/AbstractVFSCache.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -21,8 +21,6 @@
 */
 package org.jboss.virtual.plugins.cache;
 
-import java.io.IOException;
-import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Arrays;
@@ -30,10 +28,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
 import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.virtual.spi.registry.VFSContextFinder;
 import org.jboss.virtual.spi.cache.CacheStatistics;
 import org.jboss.virtual.spi.cache.VFSCache;
 
@@ -42,10 +37,10 @@
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public abstract class AbstractVFSCache implements VFSCache, CacheStatistics, VFSContextFinder
+public abstract class AbstractVFSCache implements VFSCache, CacheStatistics
 {
    protected Logger log = Logger.getLogger(getClass());
-   
+
    private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
    private long timestamp;
 
@@ -59,89 +54,19 @@
     */
    protected abstract void check();
 
-   public VirtualFile getFile(URI uri) throws IOException
+   public VFSContext findContext(URL url)
    {
-      if (uri == null)
-         throw new IllegalArgumentException("Null uri.");
-
-      check();
-
-      VFSContext context = findContext(uri);
-      if (context != null)
-      {
-         VirtualFileHandler root = context.getRoot();
-         String relativePath = getRelativePath(context, uri);
-         VirtualFileHandler child = root.getChild(relativePath);
-         if (child == null)
-            throw new IOException("Cannot find child, root=" + root + ", relativePath=" + relativePath);
-         
-         return child.getVirtualFile();
-      }
-      return null;
-   }
-
-   /**
-    * Get relative path.
-    *
-    * @param context the vfs context
-    * @param uri the uri
-    * @return uri's relative path to context's root
-    */
-   protected String getRelativePath(VFSContext context, URI uri)
-   {
-      String uriPath = stripProtocol(uri);
-      String contextKey = getKey(context);
-      return uriPath.substring(contextKey.length());
-   }
-
-   public VirtualFile getFile(URL url) throws IOException
-   {
-      if (url == null)
-         throw new IllegalArgumentException("Null url.");
-
-      check();
-
       try
       {
-         return getFile(VFSUtils.toURI(url));
+         return findContext(VFSUtils.toURI(url));
       }
       catch (URISyntaxException e)
       {
-         IOException ioe = new IOException();
-         ioe.initCause(e);
-         throw ioe;
+         throw new RuntimeException(e);
       }
    }
 
    /**
-    * Strip protocol from url string.
-    *
-    * @param uri the uri
-    * @return uri's path string
-    */
-   protected static String stripProtocol(URI uri)
-   {
-      String path = uri.getPath();
-      if (path != null && path.length() > 0)
-      {
-         StringBuilder sb = new StringBuilder(path);
-
-         if (sb.charAt(0) != '/')
-            sb.insert(0, '/');
-         if (sb.charAt(sb.length() - 1) != '/')
-            sb.append('/');
-
-         path = sb.toString();
-      }
-      else
-      {
-         path = "/";
-      }
-
-      return path;
-   }
-
-   /**
     * Get the cached context.
     *
     * @param path the path to match
@@ -149,18 +74,6 @@
     */
    protected abstract VFSContext getContext(String path);
 
-   /**
-    * Get path key.
-    *
-    * @param context the vfs context
-    * @return contex's root path w/o protocol
-    */
-   protected static String getKey(VFSContext context)
-   {
-      URI uri = context.getRootURI();
-      return stripProtocol(uri);
-   }
-
    public void putContext(VFSContext context)
    {
       if (context == null)
@@ -174,7 +87,7 @@
          log.trace("VFSContext: " + context + ", Stack-trace:\n" + Arrays.toString(stackTraceElements));
       }
 
-      String path = getKey(context);
+      String path = VFSUtils.getKey(context);
       writeLock();
       try
       {
@@ -190,7 +103,7 @@
    /**
     * Put vfs context and its path key into cache.
     *
-    * @param path the context's path
+    * @param path    the context's path
     * @param context the vfs context
     */
    protected abstract void putContext(String path, VFSContext context);
@@ -202,7 +115,7 @@
 
       check();
 
-      String path = getKey(context);
+      String path = VFSUtils.getKey(context);
       writeLock();
       try
       {
@@ -217,7 +130,7 @@
    /**
     * Remove vfs context and its path key from cache.
     *
-    * @param path the context's path
+    * @param path    the context's path
     * @param context the vfs context
     */
    protected abstract void removeContext(String path, VFSContext context);

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -31,9 +31,9 @@
 import java.util.TreeMap;
 
 import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.VFSUtils;
 import org.jboss.virtual.spi.ExceptionHandler;
+import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.cache.CacheStatistics;
 import org.jboss.virtual.spi.cache.VFSCache;
 import org.jboss.virtual.spi.cache.helpers.NoopVFSCache;
@@ -107,27 +107,24 @@
          realCache = new NoopVFSCache();
    }
 
-   public VirtualFile getFile(URI uri) throws IOException
+   public VFSContext findContext(URI uri)
    {
-      VirtualFile file = permanentCache.getFile(uri);
-      if (file != null)
-         return file;
+      VFSContext context = permanentCache.findContext(uri);
+      if (context != null)
+         return context;
 
-      check();
-      return realCache.getFile(uri);
+      return realCache.findContext(uri);
    }
 
-   public VirtualFile getFile(URL url) throws IOException
+   public VFSContext findContext(URL url)
    {
       try
       {
-         return getFile(url.toURI());
+         return findContext(VFSUtils.toURI(url));
       }
       catch (URISyntaxException e)
       {
-         IOException ioe = new IOException();
-         ioe.initCause(e);
-         throw ioe;
+         throw new RuntimeException(e);
       }
    }
 

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableTimedVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableTimedVFSCache.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableTimedVFSCache.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -21,14 +21,15 @@
 */
 package org.jboss.virtual.plugins.cache;
 
+import java.net.URI;
+import java.util.List;
 import java.util.Map;
-import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
-import java.net.URI;
 
+import org.jboss.util.TimedCachePolicy;
+import org.jboss.virtual.VFSUtils;
 import org.jboss.virtual.spi.VFSContext;
-import org.jboss.util.TimedCachePolicy;
 
 /**
  * Iterable timed cache policy vfs cache.
@@ -59,7 +60,7 @@
    @SuppressWarnings("unchecked")
    public VFSContext findContext(URI uri)
    {
-      String uriString = stripProtocol(uri);
+      String uriString = VFSUtils.stripProtocol(uri);
       TimedCachePolicy tcp = getPolicy();
       List validKeys = tcp.getValidKeys();
       Set<String> keys = new TreeSet<String>(validKeys);

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableVFSCache.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/IterableVFSCache.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -23,6 +23,7 @@
 
 import java.net.URI;
 
+import org.jboss.virtual.VFSUtils;
 import org.jboss.virtual.spi.VFSContext;
 
 /**
@@ -44,7 +45,7 @@
 
    public VFSContext findContext(URI uri)
    {
-      String uriString = stripProtocol(uri);
+      String uriString = VFSUtils.stripProtocol(uri);
       Iterable<String> keys = getKeys();
       readLock();
       try

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/PathMatchingVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/PathMatchingVFSCache.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/PathMatchingVFSCache.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -24,8 +24,9 @@
 import java.net.URI;
 import java.util.List;
 
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
 import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
 
 /**
  * Iterable vfs cache.
@@ -42,7 +43,7 @@
     */
    public VFSContext findContext(URI uri)
    {
-      String uriString = stripProtocol(uri);
+      String uriString = VFSUtils.stripProtocol(uri);
       List<String> tokens = PathTokenizer.getTokens(uriString);
       StringBuilder sb = new StringBuilder("/");
       readLock();

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -26,10 +26,11 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.TreeMap;
 
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VFS;
@@ -38,6 +39,7 @@
 import org.jboss.virtual.VirtualFileFilter;
 import org.jboss.virtual.VisitorAttributes;
 import org.jboss.virtual.spi.ExceptionHandler;
+import org.jboss.virtual.spi.TempInfo;
 import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VirtualFileHandler;
 import org.jboss.virtual.spi.VirtualFileHandlerVisitor;
@@ -68,7 +70,7 @@
    private VirtualFileHandler rootPeer;
 
    /** The temp handlers */
-   private Map<String, VirtualFileHandler> tempHandlers = new ConcurrentHashMap<String, VirtualFileHandler>();
+   private Map<String, TempInfo> tempInfos = Collections.synchronizedSortedMap(new TreeMap<String, TempInfo>());
 
    /** The exception handler */
    private ExceptionHandler exceptionHandler;
@@ -341,32 +343,27 @@
       }
    }
 
-   public void addTempHandler(String path, VirtualFileHandler handler)
+   public void addTempInfo(TempInfo tempInfo)
    {
-      tempHandlers.put(path, handler);
+      tempInfos.put(tempInfo.getPath(), tempInfo);
    }
 
-   public VirtualFileHandler findTempHandler(URI uri) throws IOException
+   public TempInfo getTempInfo(String path)
    {
-      String relativePath = VFSUtils.getRelativePath(this, uri);
-      for (Map.Entry<String, VirtualFileHandler> entry : tempHandlers.entrySet())
-      {
-         if (relativePath.startsWith(entry.getKey()))
-         {
-            VirtualFileHandler handler = entry.getValue();
-            String path = relativePath.substring(handler.getPathName().length());
-            return handler.getChild(path);
-         }
-      }
-      return null;
+      return tempInfos.get(path);
    }
 
-   public void cleanupTempHandlers(String path)
+   public Iterable<TempInfo> getTempInfos()
    {
-      Iterator<Map.Entry<String, VirtualFileHandler>> iter = tempHandlers.entrySet().iterator();
+      return tempInfos.values();
+   }
+
+   public void cleanupTempInfo(String path)
+   {
+      Iterator<Map.Entry<String, TempInfo>> iter = tempInfos.entrySet().iterator();
       while (iter.hasNext())
       {
-         Map.Entry<String, VirtualFileHandler> entry = iter.next();
+         Map.Entry<String, TempInfo> entry = iter.next();
          if (entry.getKey().startsWith(path))
          {
             try

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -40,6 +40,7 @@
  * under a different parent and name.
  * 
  * @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
  * @version $Revision:$
  */
 public class DelegatingHandler extends AbstractVirtualFileHandler

Copied: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java (from rev 83684, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java)
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java	                        (rev 0)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.virtual.plugins.context.temp;
+
+import java.io.File;
+
+import org.jboss.util.file.Files;
+import org.jboss.virtual.spi.TempInfo;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractTempInfo
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BasicTempInfo implements TempInfo
+{
+   private String path;
+   private File file;
+   private VirtualFileHandler handler;
+
+   public BasicTempInfo(String path, File file, VirtualFileHandler handler)
+   {
+      this.path = path;
+      this.file = file;
+      this.handler = handler;
+   }
+
+   public String getPath()
+   {
+      return path;
+   }
+
+   public File getTempFile()
+   {
+      return file;
+   }
+
+   public void cleanup()
+   {
+      if (handler != null)
+         handler.cleanup();
+      else if (file != null && file.exists())
+         Files.delete(file);
+   }
+
+   public VirtualFileHandler getHandler()
+   {
+      return handler;
+   }
+
+   public void setHandler(VirtualFileHandler handler)
+   {
+      this.handler = handler;
+   }
+}
\ No newline at end of file


Property changes on: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -32,6 +32,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.AccessController;
@@ -46,7 +47,6 @@
 import java.util.TreeMap;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
@@ -57,8 +57,10 @@
 import org.jboss.virtual.plugins.context.DelegatingHandler;
 import org.jboss.virtual.plugins.context.ReplacementHandler;
 import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.plugins.context.temp.BasicTempInfo;
 import org.jboss.virtual.plugins.copy.AbstractCopyMechanism;
 import org.jboss.virtual.spi.ExceptionHandler;
+import org.jboss.virtual.spi.TempInfo;
 import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VirtualFileHandler;
 
@@ -132,9 +134,6 @@
    /** RealURL of this context */
    private URL realURL;
 
-   /** Nested handlers */
-   private List<VirtualFileHandler> nestedHandlers = new CopyOnWriteArrayList<VirtualFileHandler>();
-
    /**
     * Create a new ZipEntryContext
     *
@@ -511,19 +510,38 @@
 
                if (useCopyMode)
                {
-                  // extract it to temp dir
-                  File dest = new File(getTempDir() + "/" + getTempFileName(ent.getName()));
-                  dest.deleteOnExit();
+                  File dest = null;
+                  String entryName = ent.getName();
+                  String path = null;
 
-                  // ensure parent exists
-                  dest.getParentFile().mkdirs();
+                  VFSContext context = getPeerContext();
+                  if (context != null)
+                  {
+                     path = getPath(context, entryName);
+                     TempInfo ti = context.getTempInfo(path);
+                     if (ti != null)
+                        dest = ti.getTempFile();
+                  }
 
-                  InputStream is = zipSource.openStream(ent);
-                  OutputStream os = new BufferedOutputStream(new FileOutputStream(dest));
-                  VFSUtils.copyStreamAndClose(is, os);
+                  if (dest == null)
+                  {
+                     // extract it to temp dir
+                     dest = new File(getTempDir() + "/" + getTempFileName(entryName));
+                     dest.deleteOnExit();
 
+                     // ensure parent exists
+                     dest.getParentFile().mkdirs();
+
+                     InputStream is = zipSource.openStream(ent);
+                     OutputStream os = new BufferedOutputStream(new FileOutputStream(dest));
+                     VFSUtils.copyStreamAndClose(is, os);
+                  }
+
                   // mount another instance of ZipEntryContext
                   delegator = mountZipFile(parent, name, dest);
+
+                  if (context != null && path != null)
+                     context.addTempInfo(new BasicTempInfo(path, dest, delegator));
                }
                else
                {
@@ -533,7 +551,6 @@
 
                entries.put(delegator.getLocalPathName(), new EntryInfo(delegator, ent));
                addChild(parent, delegator);
-               nestedHandlers.add(delegator); // add nested delegator
             }
             else
             {
@@ -549,6 +566,21 @@
    }
 
    /**
+    * Get temp path.
+    *
+    * @param peer the peer vfs context
+    * @param entryName the zip entry name
+    * @return full temp path
+    */
+   protected String getPath(VFSContext peer, String entryName)
+   {
+      URI peerURI = peer.getRootURI();
+      String peerString = VFSUtils.stripProtocol(peerURI);
+      String thisString = VFSUtils.stripProtocol(getRootURI());
+      return thisString.substring(peerString.length()) + entryName;
+   }
+   
+   /**
     * Perform initialization only if it hasn't been done yet
     */
    private synchronized void ensureEntries()
@@ -809,11 +841,6 @@
       VirtualFileHandler rootHandler = getRoot();
       if (rootHandler.equals(handler))
       {
-         // only cleanup nested - as they might be temp files we want to delete
-         for (VirtualFileHandler vfh : nestedHandlers)
-         {
-            vfh.cleanup();
-         }
          getZipSource().close(); // close == cleanup in zip source impl
       }
    }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/AbstractCopyMechanism.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/AbstractCopyMechanism.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/AbstractCopyMechanism.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -37,6 +37,7 @@
 import org.jboss.virtual.VirtualFile;
 import org.jboss.virtual.VFSUtils;
 import org.jboss.virtual.plugins.context.DelegatingHandler;
+import org.jboss.virtual.plugins.context.temp.BasicTempInfo;
 import org.jboss.virtual.plugins.context.file.FileSystemContext;
 import org.jboss.virtual.spi.ExceptionHandler;
 import org.jboss.virtual.spi.VFSContext;
@@ -151,6 +152,8 @@
          fileSystemContext.setExceptionHandler(eh);
 
       VirtualFileHandler newHandler = fileSystemContext.getRoot();
+      oldVFSContext.addTempInfo(new BasicTempInfo(handler.getPathName(), copy, newHandler));
+
       VirtualFileHandler parent = handler.getParent();
       if (parent != null && replaceOldHandler(parent, handler, newHandler))
          parent.replaceChild(handler, newHandler);

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/TempContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/TempContext.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/copy/TempContext.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -49,10 +49,10 @@
    }
 
    @Override
-   public void cleanupTempHandlers(String path)
+   public void cleanupTempInfo(String path)
    {
       // this path should be ""?
-      super.cleanupTempHandlers(path);
-      oldContext.cleanupTempHandlers(relativePath + path);      
+      super.cleanupTempInfo(path);
+      oldContext.cleanupTempInfo(relativePath + path);
    }
 }
\ No newline at end of file

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -30,9 +30,9 @@
 import org.jboss.virtual.VFSUtils;
 import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VirtualFileHandler;
+import org.jboss.virtual.spi.TempInfo;
 import org.jboss.virtual.spi.cache.VFSCache;
 import org.jboss.virtual.spi.cache.VFSCacheFactory;
-import org.jboss.virtual.spi.registry.VFSContextFinder;
 import org.jboss.virtual.spi.registry.VFSRegistry;
 
 /**
@@ -43,7 +43,6 @@
 public class DefaultVFSRegistry extends VFSRegistry
 {
    private VFSCache cache;
-   private VFSContextFinder finder;
 
    protected VFSCache getCache()
    {
@@ -53,27 +52,6 @@
       return cache;
    }
 
-   protected VFSContextFinder getContextFinder()
-   {
-      if (finder == null)
-         finder = createContextFinder();
-
-      return finder;
-   }
-
-   protected VFSContextFinder createContextFinder()
-   {
-      VFSCache cache = getCache();
-      if (cache instanceof VFSContextFinder)
-      {
-         return VFSContextFinder.class.cast(cache);
-      }
-      else
-      {
-         return new DummyVFSContextFinder();
-      }
-   }
-
    public void addContext(VFSContext context)
    {
       getCache().putContext(context);
@@ -89,14 +67,29 @@
       if (uri == null)
          throw new IllegalArgumentException("Null uri");
 
-      VFSContext context = getContextFinder().findContext(uri);
+      VFSContext context = getCache().findContext(uri);
       if (context != null)
       {
-         VirtualFileHandler handler = context.findTempHandler(uri);
-         if (handler != null)
-            return handler.getVirtualFile();
+         String relativePath = VFSUtils.getRelativePath(context, uri);
+         for (TempInfo ti : context.getTempInfos())
+         {
+            String path = ti.getPath();
+            if (relativePath.startsWith(path))
+            {
+               VirtualFileHandler handler = ti.getHandler();
+               VirtualFileHandler child = handler.getChild(relativePath.substring(path.length()));
+               return child.getVirtualFile();
+            }
+         }
+
+         VirtualFileHandler root = context.getRoot();
+         VirtualFileHandler child = root.getChild(relativePath);
+         if (child == null)
+            throw new IOException("Cannot find child, root=" + root + ", relativePath=" + relativePath);
+
+         return child.getVirtualFile();
       }
-      return getCache().getFile(uri);
+      return null;
    }
 
    public VirtualFile getFile(URL url) throws IOException
@@ -115,12 +108,4 @@
          throw ioe;
       }
    }
-
-   private static class DummyVFSContextFinder implements VFSContextFinder
-   {
-      public VFSContext findContext(URI uri)
-      {
-         return null;
-      }
-   }
 }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/AbstractVFSHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/AbstractVFSHandler.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/AbstractVFSHandler.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -32,8 +32,7 @@
 
 import org.jboss.virtual.VirtualFile;
 import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
-import org.jboss.virtual.spi.cache.VFSCache;
-import org.jboss.virtual.spi.cache.VFSCacheFactory;
+import org.jboss.virtual.spi.registry.VFSRegistry;
 
 /**
  * VFS's file URL handler.
@@ -68,8 +67,8 @@
 
    protected URLConnection openConnection(URL url) throws IOException
    {
-      VFSCache cache = VFSCacheFactory.getInstance();
-      VirtualFile vf = cache.getFile(url);
+      VFSRegistry registry = VFSRegistry.getInstance();
+      VirtualFile vf = registry.getFile(url);
       if (vf != null)
          return new VirtualFileURLConnection(url, vf);
 

Copied: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java (from rev 83684, projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java)
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java	                        (rev 0)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -0,0 +1,40 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.virtual.spi;
+
+import java.io.File;
+
+/**
+ * The temp info
+ *
+ * @author ales.justin at jboss.org
+ */
+public interface TempInfo
+{
+   String getPath();
+
+   File getTempFile();
+
+   void cleanup();
+
+   VirtualFileHandler getHandler();
+}
\ No newline at end of file


Property changes on: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -128,9 +128,11 @@
     */
    void setExceptionHandler(ExceptionHandler exceptionHandler);
 
-   void addTempHandler(String path, VirtualFileHandler handler);
+   void addTempInfo(TempInfo tempInfo);
 
-   VirtualFileHandler findTempHandler(URI uri) throws IOException;
+   TempInfo getTempInfo(String path);
 
-   void cleanupTempHandlers(String path);
+   Iterable<TempInfo> getTempInfos();
+
+   void cleanupTempInfo(String path);
 }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/VFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/VFSCache.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/VFSCache.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -21,11 +21,9 @@
 */
 package org.jboss.virtual.spi.cache;
 
-import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
 
-import org.jboss.virtual.VirtualFile;
 import org.jboss.virtual.spi.VFSContext;
 
 /**
@@ -36,26 +34,20 @@
 public interface VFSCache
 {
    /**
-    * Get the file.
-    * Check the cache for cached entry,
-    * return null if no matching entry exists.
+    * Find the context based on uri.
     *
-    * @param uri the file's uri
-    * @return virtual file instance or null if it doesn't exist in cache
-    * @throws IOException for any error
+    * @param uri the uri
+    * @return found context or null
     */
-   VirtualFile getFile(URI uri) throws IOException;
+   VFSContext findContext(URI uri);
 
    /**
-    * Get the file.
-    * Check the cache for cached entry,
-    * return null if no matching entry exists.
+    * Find the context based on url.
     *
-    * @param url the file's url
-    * @return virtual file instance or null if it doesn't exist in cache
-    * @throws IOException for any error
+    * @param url the url
+    * @return found context or null
     */
-   VirtualFile getFile(URL url) throws IOException;
+   VFSContext findContext(URL url);
 
    /**
     * Put vfs context to cache.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/helpers/NoopVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/helpers/NoopVFSCache.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/cache/helpers/NoopVFSCache.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -21,11 +21,9 @@
 */
 package org.jboss.virtual.spi.cache.helpers;
 
-import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
 
-import org.jboss.virtual.VirtualFile;
 import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.cache.VFSCache;
 
@@ -37,12 +35,12 @@
  */
 public class NoopVFSCache implements VFSCache
 {
-   public VirtualFile getFile(URI uri) throws IOException
+   public VFSContext findContext(URI uri)
    {
       return null;
    }
 
-   public VirtualFile getFile(URL url) throws IOException
+   public VFSContext findContext(URL url)
    {
       return null;
    }

Deleted: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSContextFinder.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSContextFinder.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSContextFinder.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -1,42 +0,0 @@
-/*
- * 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.virtual.spi.registry;
-
-import java.net.URI;
-
-import org.jboss.virtual.spi.VFSContext;
-
-/**
- * VFS Context finder.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface VFSContextFinder
-{
-   /**
-    * Find the vfs context.
-    *
-    * @param uri the uri
-    * @return vfs context or null if not found
-    */
-   VFSContext findContext(URI uri);
-}

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -40,11 +40,39 @@
       return VFSRegistryBuilder.getInstance();
    }
 
+   /**
+    * Add new vfs context.
+    *
+    * @param context the context
+    */
    public abstract void addContext(VFSContext context);
 
+   /**
+    * Remove the context.
+    *
+    * @param context the context
+    */
    public abstract void removeContext(VFSContext context);
 
+   /**
+    * Get the file.
+    * Check the cache for cached entry,
+    * return null if no matching entry exists.
+    *
+    * @param uri the file's uri
+    * @return virtual file instance or null if it doesn't exist in cache
+    * @throws IOException for any error
+    */
    public abstract VirtualFile getFile(URI uri) throws IOException;
 
+   /**
+    * Get the file.
+    * Check the cache for cached entry,
+    * return null if no matching entry exists.
+    *
+    * @param url the file's url
+    * @return virtual file instance or null if it doesn't exist in cache
+    * @throws IOException for any error
+    */
    public abstract VirtualFile getFile(URL url) throws IOException;
 }

Copied: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSRegistryTest.java (from rev 83684, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTestCase.java)
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSRegistryTest.java	                        (rev 0)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSRegistryTest.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.virtual.test;
+
+import java.lang.reflect.Field;
+
+import org.jboss.virtual.spi.registry.VFSRegistryBuilder;
+
+/**
+ * Test vfs registry
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractVFSRegistryTest extends AbstractVFSTest
+{
+   public AbstractVFSRegistryTest(String name)
+   {
+      super(name, true, true);
+   }
+
+   protected AbstractVFSRegistryTest(String name, boolean forceCopy, boolean forceNoReaper)
+   {
+      super(name, forceCopy, forceNoReaper);
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      // nullify the registry
+      Class<?> clazz = VFSRegistryBuilder.class;
+      Field field = clazz.getDeclaredField("singleton");
+      field.setAccessible(true);
+      field.set(null, null);
+   }
+}
\ No newline at end of file

Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTestCase.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTestCase.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -36,14 +36,14 @@
 import org.jboss.virtual.plugins.copy.AbstractCopyMechanism;
 import org.jboss.virtual.spi.cache.VFSCache;
 import org.jboss.virtual.spi.cache.VFSCacheFactory;
-import org.jboss.virtual.spi.registry.VFSRegistryBuilder;
+import org.jboss.virtual.spi.registry.VFSRegistry;
 
 /**
  * Test file closing
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public class FileCleanupUnitTestCase extends AbstractVFSTest
+public class FileCleanupUnitTestCase extends AbstractVFSRegistryTest
 {
    private File tempDir;
 
@@ -74,12 +74,6 @@
       field.setAccessible(true);
       field.set(null, null);
 
-      // nullify the registry
-      clazz = VFSRegistryBuilder.class;
-      field = clazz.getDeclaredField("singleton");
-      field.setAccessible(true);
-      field.set(null, null);
-
       String tempDirKey = System.getProperty("vfs.temp.dir", "jboss.server.temp.dir");
       String tempDirString = System.getProperty(tempDirKey, System.getProperty("java.io.tmpdir")) + GUID.asString();
 
@@ -110,7 +104,7 @@
 
          System.clearProperty("jboss.server.temp.dir");
       }
-      catch (Throwable t)
+      catch (Throwable ignored)
       {
       }
       finally
@@ -147,17 +141,17 @@
       assertEquals(size, counter);
    }
 
-   protected void assertCacheExists(URI uri) throws Exception
+   protected void assertRegistryEntryExists(URI uri) throws Exception
    {
-      VFSCache cache = VFSCacheFactory.getInstance();
-      VirtualFile file = cache.getFile(uri);
+      VFSRegistry registry = VFSRegistry.getInstance();
+      VirtualFile file = registry.getFile(uri);
       assertNotNull(file);
    }
 
-   protected void assertNoCache(URI uri) throws Exception
+   protected void assertNoRegistryEntry(URI uri) throws Exception
    {
-      VFSCache cache = VFSCacheFactory.getInstance();
-      VirtualFile file = cache.getFile(uri);
+      VFSRegistry registry = VFSRegistry.getInstance();
+      VirtualFile file = registry.getFile(uri);
       assertNull("" + uri, file);
    }
 
@@ -174,12 +168,12 @@
       assertTempFiles(1);
 
       nestedChild.cleanup();
-      assertCacheExists(nestedChild.toURI());
+      assertRegistryEntryExists(nestedChild.toURI());
 
       root.cleanup();
 
       assertTempFiles(0);
-      assertNoCache(root.toURI());
+      assertNoRegistryEntry(root.toURI());
    }
 
    public void testExplicitCopyCleanup() throws Exception
@@ -199,6 +193,6 @@
       assertCopyMechanismFiles(0);
 
       root.cleanup();
-      assertNoCache(root.toURI());
+      assertNoRegistryEntry(root.toURI());
    }
 }
\ No newline at end of file

Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSCacheTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSCacheTest.java	2009-02-02 12:36:14 UTC (rev 83776)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSCacheTest.java	2009-02-02 13:25:09 UTC (rev 83777)
@@ -21,7 +21,6 @@
 */
 package org.jboss.test.virtual.test;
 
-import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
 import java.util.Collections;
@@ -40,7 +39,7 @@
  *
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  */
-public abstract class VFSCacheTest extends AbstractVFSTest
+public abstract class VFSCacheTest extends AbstractVFSRegistryTest
 {
    public VFSCacheTest(String name)
    {
@@ -87,8 +86,8 @@
             VFSCache wrapper = new WrapperVFSCache(cache);
             VFSCacheFactory.setInstance(wrapper);
 
-            assertEquals(file, wrapper.getFile(fileURL));
-            assertEquals(nested, wrapper.getFile(nestedURL));
+            assertEquals(file, VFS.getRoot(fileURL));
+            assertEquals(nested, VFS.getRoot(nestedURL));
          }
          finally
          {
@@ -201,14 +200,14 @@
          this.delegate = delegate;
       }
 
-      public VirtualFile getFile(URI uri) throws IOException
+      public VFSContext findContext(URI uri)
       {
-         return delegate.getFile(uri);
+         return delegate.findContext(uri);
       }
 
-      public VirtualFile getFile(URL url) throws IOException
+      public VFSContext findContext(URL url)
       {
-         return delegate.getFile(url);
+         return delegate.findContext(url);
       }
 
       public void putContext(VFSContext context)




More information about the jboss-cvs-commits mailing list