[jboss-cvs] JBossAS SVN: r91989 - in projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs: protocol and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 4 18:45:47 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-08-04 18:45:47 -0400 (Tue, 04 Aug 2009)
New Revision: 91989

Modified:
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempDir.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempFileProvider.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSInputSource.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilter.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilterWithAttributes.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileVisitor.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VisitorAttributes.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/file/Handler.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterable.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterator.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/FileSystem.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JZipFileSystem.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/RealFileSystem.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileFilterWithAttributes.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileVisitor.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/ExtensibleFilter.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/MatchAllVirtualFileFilter.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/PathTokenizer.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixMatchFilter.java
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixesExcludeFilter.java
Log:
Code style cleanup - no functional changes

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempDir.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempDir.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempDir.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -32,93 +32,92 @@
 /**
  * A temporary directory which exists until it is closed, at which time its contents will be removed.
  */
-public final class TempDir implements Closeable
-{
-   private final TempFileProvider provider;
-   private final File root;
-   private final AtomicBoolean open = new AtomicBoolean(true);
+public final class TempDir implements Closeable {
 
-   TempDir(TempFileProvider provider, File root)
-   {
-      this.provider = provider;
-      this.root = root;
-   }
+    private final TempFileProvider provider;
+    private final File root;
+    private final AtomicBoolean open = new AtomicBoolean(true);
 
-   /**
-    * Get the {@code File} that represents the root of this temporary directory.  The returned file is only valid
-    * as long as the tempdir exists.
-    *
-    * @return the root file
-    * @throws IOException if the directory was closed at the time of this invocation
-    */
-   public File getRoot() throws IOException
-   {
-      if (! open.get()) {
-         throw new IOException("Temp directory closed");
-      }
-      return root;
-   }
+    TempDir(TempFileProvider provider, File root) {
+        this.provider = provider;
+        this.root = root;
+    }
 
-   /**
-    * Get the {@code File} for a relative path.  The returned file is only valid
-    * as long as the tempdir exists.
-    *
-    * @param relativePath the relative path
-    * @return the corresponding file
-    * @throws IOException if the directory was closed at the time of this invocation
-    */
-   public File getFile(String relativePath) throws IOException {
-      if (! open.get()) {
-         throw new IOException("Temp directory closed");
-      }
-      return new File(root, relativePath);
-   }
+    /**
+     * Get the {@code File} that represents the root of this temporary directory.  The returned file is only valid as
+     * long as the tempdir exists.
+     *
+     * @return the root file
+     *
+     * @throws IOException if the directory was closed at the time of this invocation
+     */
+    public File getRoot() throws IOException {
+        if (!open.get()) {
+            throw new IOException("Temp directory closed");
+        }
+        return root;
+    }
 
-   /**
-    * Create a file within this temporary directory, prepopulating the file from the given
-    * input stream.
-    *
-    * @param relativePath the relative path name
-    * @param sourceData the source input stream to use
-    * @return the file
-    * @throws IOException if the directory was closed at the time of this invocation or an error occurs
-    */
-   public File createFile(String relativePath, InputStream sourceData) throws IOException {
-      final File tempFile = getFile(relativePath);
-      boolean ok = false;
-      try {
-         final FileOutputStream fos = new FileOutputStream(tempFile);
-         try {
-            VFSUtils.copyStream(sourceData, fos);
-            fos.close();
-            sourceData.close();
-            ok = true;
-            return tempFile;
-         } finally {
-            VFSUtils.safeClose(fos);
-         }
-      } finally {
-         VFSUtils.safeClose(sourceData);
-         if (! ok) {
-            tempFile.delete();
-         }
-      }
-   }
+    /**
+     * Get the {@code File} for a relative path.  The returned file is only valid as long as the tempdir exists.
+     *
+     * @param relativePath the relative path
+     *
+     * @return the corresponding file
+     *
+     * @throws IOException if the directory was closed at the time of this invocation
+     */
+    public File getFile(String relativePath) throws IOException {
+        if (!open.get()) {
+            throw new IOException("Temp directory closed");
+        }
+        return new File(root, relativePath);
+    }
 
-   /**
-    * Close this directory.  The contents of the directory will be removed.
-    *
-    * @throws IOException if an I/O error occurs
-    */
-   public void close() throws IOException
-   {
-      if (open.getAndSet(false)) {
-         provider.new DeleteTask(root).run();
-      }
-   }
+    /**
+     * Create a file within this temporary directory, prepopulating the file from the given input stream.
+     *
+     * @param relativePath the relative path name
+     * @param sourceData the source input stream to use
+     *
+     * @return the file
+     *
+     * @throws IOException if the directory was closed at the time of this invocation or an error occurs
+     */
+    public File createFile(String relativePath, InputStream sourceData) throws IOException {
+        final File tempFile = getFile(relativePath);
+        boolean ok = false;
+        try {
+            final FileOutputStream fos = new FileOutputStream(tempFile);
+            try {
+                VFSUtils.copyStream(sourceData, fos);
+                fos.close();
+                sourceData.close();
+                ok = true;
+                return tempFile;
+            } finally {
+                VFSUtils.safeClose(fos);
+            }
+        } finally {
+            VFSUtils.safeClose(sourceData);
+            if (!ok) {
+                tempFile.delete();
+            }
+        }
+    }
 
-   protected void finalize() throws Throwable
-   {
-      VFSUtils.safeClose(this);
-   }
+    /**
+     * Close this directory.  The contents of the directory will be removed.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    public void close() throws IOException {
+        if (open.getAndSet(false)) {
+            provider.new DeleteTask(root).run();
+        }
+    }
+
+    protected void finalize() throws Throwable {
+        VFSUtils.safeClose(this);
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempFileProvider.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempFileProvider.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/TempFileProvider.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -34,118 +34,112 @@
 /**
  * A provider for temporary physical files and directories.
  */
-public final class TempFileProvider implements Closeable
-{
-   private static final String JBOSS_TMP_DIR_PROPERTY = "jboss.server.temp.dir";
-   private static final String JVM_TMP_DIR_PROPERTY = "java.io.tmpdir";
-   private static final File TMP_ROOT;
-   private static final int RETRIES = 10;
-   private final AtomicBoolean open = new AtomicBoolean(true);
+public final class TempFileProvider implements Closeable {
 
-   static {
-      String configTmpDir = System.getProperty(JBOSS_TMP_DIR_PROPERTY);
-      if (configTmpDir == null)
-         configTmpDir = System.getProperty(JVM_TMP_DIR_PROPERTY);
+    private static final String JBOSS_TMP_DIR_PROPERTY = "jboss.server.temp.dir";
+    private static final String JVM_TMP_DIR_PROPERTY = "java.io.tmpdir";
+    private static final File TMP_ROOT;
+    private static final int RETRIES = 10;
+    private final AtomicBoolean open = new AtomicBoolean(true);
 
-      try
-      {
-         TMP_ROOT = new File(configTmpDir, "vfs");
-         TMP_ROOT.mkdirs();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Can't set up temp file provider", e);
-      }
-   }
+    static {
+        String configTmpDir = System.getProperty(JBOSS_TMP_DIR_PROPERTY);
+        if (configTmpDir == null)
+            configTmpDir = System.getProperty(JVM_TMP_DIR_PROPERTY);
+        try {
+            TMP_ROOT = new File(configTmpDir, "vfs");
+            TMP_ROOT.mkdirs();
+        }
+        catch (Exception e) {
+            throw new RuntimeException("Can't set up temp file provider", e);
+        }
+    }
 
-   /**
-    * Create a temporary file provider for a given type.
-    *
-    * @param providerType the provider type string (used as a prefix in the temp file dir name)
-    * @return the new provider
-    * @throws IOException if an I/O error occurs
-    */
-   public static TempFileProvider create(String providerType, ScheduledExecutorService executor) throws IOException
-   {
-      return new TempFileProvider(createTempDir(providerType, "", TMP_ROOT), executor);
-   }
+    /**
+     * Create a temporary file provider for a given type.
+     *
+     * @param providerType the provider type string (used as a prefix in the temp file dir name)
+     *
+     * @return the new provider
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    public static TempFileProvider create(String providerType, ScheduledExecutorService executor) throws IOException {
+        return new TempFileProvider(createTempDir(providerType, "", TMP_ROOT), executor);
+    }
 
-   private final File providerRoot;
-   private final ScheduledExecutorService executor;
+    private final File providerRoot;
+    private final ScheduledExecutorService executor;
 
-   private TempFileProvider(File providerRoot, ScheduledExecutorService executor)
-   {
-      this.providerRoot = providerRoot;
-      this.executor = executor;
-   }
+    private TempFileProvider(File providerRoot, ScheduledExecutorService executor) {
+        this.providerRoot = providerRoot;
+        this.executor = executor;
+    }
 
-   /**
-    * Create a temp directory, into which temporary files may be placed.
-    *
-    * @param originalName the original file name
-    * @return the temp directory
-    * @throws IOException
-    */
-   public TempDir createTempDir(String originalName) throws IOException {
-      if (! open.get()) {
-         throw new IOException("Temp file provider closed");
-      }
-      final String name = createTempName(originalName + "-", "");
-      final File f = new File(providerRoot, name);
-      for (int i = 0; i < RETRIES; i ++) {
-         if (f.mkdir())
-            return new TempDir(this, f);
-      }
-      final IOException eo = new IOException("Could not create directory after " + RETRIES + " attempts");
-      throw eo;
-   }
+    /**
+     * Create a temp directory, into which temporary files may be placed.
+     *
+     * @param originalName the original file name
+     *
+     * @return the temp directory
+     *
+     * @throws IOException
+     */
+    public TempDir createTempDir(String originalName) throws IOException {
+        if (!open.get()) {
+            throw new IOException("Temp file provider closed");
+        }
+        final String name = createTempName(originalName + "-", "");
+        final File f = new File(providerRoot, name);
+        for (int i = 0; i < RETRIES; i++) {
+            if (f.mkdir())
+                return new TempDir(this, f);
+        }
+        final IOException eo = new IOException("Could not create directory after " + RETRIES + " attempts");
+        throw eo;
+    }
 
-   private static final Random rng = new SecureRandom();
+    private static final Random rng = new SecureRandom();
 
-   private static File createTempDir(String prefix, String suffix, File root) throws IOException
-   {
-      for (int i = 0; i < RETRIES; i ++) {
-         final File f = new File(root, createTempName(prefix, suffix));
-         if (f.mkdir())
-            return f;
-      }
-      final IOException eo = new IOException("Could not create directory after " + RETRIES + " attempts");
-      throw eo;
-   }
+    private static File createTempDir(String prefix, String suffix, File root) throws IOException {
+        for (int i = 0; i < RETRIES; i++) {
+            final File f = new File(root, createTempName(prefix, suffix));
+            if (f.mkdir())
+                return f;
+        }
+        final IOException eo = new IOException("Could not create directory after " + RETRIES + " attempts");
+        throw eo;
+    }
 
-   static String createTempName(String prefix, String suffix) {
-      return prefix + Long.toHexString(rng.nextLong()) + suffix;
-   }
+    static String createTempName(String prefix, String suffix) {
+        return prefix + Long.toHexString(rng.nextLong()) + suffix;
+    }
 
-   /**
-    * Close this provider and delete any temp files associated with it.
-    */
-   public void close() throws IOException
-   {
-      if (open.getAndSet(false)) {
-         new DeleteTask(providerRoot).run();
-      }
-   }
+    /**
+     * Close this provider and delete any temp files associated with it.
+     */
+    public void close() throws IOException {
+        if (open.getAndSet(false)) {
+            new DeleteTask(providerRoot).run();
+        }
+    }
 
-   protected void finalize()
-   {
-      VFSUtils.safeClose(this);
-   }
+    protected void finalize() {
+        VFSUtils.safeClose(this);
+    }
 
-   class DeleteTask implements Runnable
-   {
-      private final File root;
+    class DeleteTask implements Runnable {
 
-      public DeleteTask(File root)
-      {
-         this.root = root;
-      }
+        private final File root;
 
-      public void run()
-      {
-         if (! VFSUtils.recursiveDelete(root)) {
-            executor.schedule(this, 30L, TimeUnit.SECONDS);
-         }
-      }
-   }
+        public DeleteTask(File root) {
+            this.root = root;
+        }
+
+        public void run() {
+            if (!VFSUtils.recursiveDelete(root)) {
+                executor.schedule(this, 30L, TimeUnit.SECONDS);
+            }
+        }
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -61,745 +61,723 @@
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
-public class VFS
-{
-   private static final Logger log = Logger.getLogger(VFS.class);
+public class VFS {
 
-   public static final boolean LEAK_DEBUGGING;
+    private static final Logger log = Logger.getLogger(VFS.class);
 
-   private final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = new ConcurrentHashMap<VirtualFile, Map<String, Mount>>();
-   private final VirtualFile rootVirtualFile;
-   private final Mount rootMount;
+    public static final boolean LEAK_DEBUGGING;
 
-   static VFS instance = new VFS();
+    private final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = new ConcurrentHashMap<VirtualFile, Map<String, Mount>>();
+    private final VirtualFile rootVirtualFile;
+    private final Mount rootMount;
 
-   // todo - LRU VirtualFiles?
-   // todo - LRU String intern?
+    static VFS instance = new VFS();
+    // todo - LRU VirtualFiles?
+    // todo - LRU String intern?
 
-   static
-   {
-      init();
-      LEAK_DEBUGGING = AccessController.doPrivileged(new PrivilegedAction<Boolean>()
-      {
-         public Boolean run()
-         {
-            return Boolean.valueOf(System.getProperty("jboss.vfs.leakDebugging", "true"));
-         }
-      }).booleanValue();
-   }
+    static {
+        init();
+        LEAK_DEBUGGING = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                return Boolean.valueOf(System.getProperty("jboss.vfs.leakDebugging", "true"));
+            }
+        }).booleanValue();
+    }
 
-   /**
-    * Get the "global" instance.
-    *
-    * @return the VFS instance
-    */
-   public static VFS getInstance()
-   {
-      return instance;
-   }
+    /**
+     * Get the "global" instance.
+     *
+     * @return the VFS instance
+     */
+    public static VFS getInstance() {
+        return instance;
+    }
 
-   /**
-    * Create a new instance.
-    */
-   public VFS()
-   {
-      // By default, there's a root mount which points to the "real" FS
-      //noinspection ThisEscapedInObjectConstruction
-      rootVirtualFile = new VirtualFile("", null);
-      rootMount = new Mount(RealFileSystem.ROOT_INSTANCE, rootVirtualFile);
-   }
+    /**
+     * Create a new instance.
+     */
+    public VFS() {
+        // By default, there's a root mount which points to the "real" FS
+        //noinspection ThisEscapedInObjectConstruction
+        rootVirtualFile = new VirtualFile("", null);
+        rootMount = new Mount(RealFileSystem.ROOT_INSTANCE, rootVirtualFile);
+    }
 
-   /**
-    * Get file.
-    * Backcompatibility method.
-    *
-    * @param url the url
-    * @return the file matching url
-    * @throws IOException if there is a problem accessing the VFS
-    * @deprecated use {@link #getChild(URL)} instead
-    */
-   @Deprecated
-   @SuppressWarnings("deprecation")
-   public static VirtualFile getRoot(URL url) throws IOException
-   {
-      try
-      {
-         return getRoot(url.toURI());
-      }
-      catch (URISyntaxException e)
-      {
-         IOException ioe = new IOException();
-         ioe.initCause(e);
-         throw ioe;
-      }
-   }
+    /**
+     * Get file. Backcompatibility method.
+     *
+     * @param url the url
+     *
+     * @return the file matching url
+     *
+     * @throws IOException if there is a problem accessing the VFS
+     * @deprecated use {@link #getChild(URL)} instead
+     */
+    @Deprecated
+    @SuppressWarnings("deprecation")
+    public static VirtualFile getRoot(URL url) throws IOException {
+        try {
+            return getRoot(url.toURI());
+        }
+        catch (URISyntaxException e) {
+            IOException ioe = new IOException();
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
 
-   /**
-    * Get file.
-    * Backcompatibility method.
-    *
-    * @param uri the uri
-    * @return the file matching uri
-    * @throws IOException if there is a problem accessing the VFS
-    * @deprecated use {@link #getChild(URI)} instead
-    */
-   @Deprecated
-   public static VirtualFile getRoot(URI uri) throws IOException
-   {
-      return getInstance().getChild(uri.getPath());
-   }
+    /**
+     * Get file. Backcompatibility method.
+     *
+     * @param uri the uri
+     *
+     * @return the file matching uri
+     *
+     * @throws IOException if there is a problem accessing the VFS
+     * @deprecated use {@link #getChild(URI)} instead
+     */
+    @Deprecated
+    public static VirtualFile getRoot(URI uri) throws IOException {
+        return getInstance().getChild(uri.getPath());
+    }
 
-   /**
-    * Initialize VFS protocol handlers package property.
-    */
-   @SuppressWarnings({"deprecation", "unchecked"})
-   public static void init()
-   {
-      // A small hack that allows us to replace file for now
-      URL.setURLStreamHandlerFactory(null);
+    /**
+     * Initialize VFS protocol handlers package property.
+     */
+    @SuppressWarnings({ "deprecation", "unchecked" })
+    public static void init() {
+        // A small hack that allows us to replace file for now
+        URL.setURLStreamHandlerFactory(null);
+        String pkgs = System.getProperty("java.protocol.handler.pkgs");
+        if (pkgs == null || pkgs.trim().length() == 0) {
+            pkgs = "org.jboss.virtual.protocol";
+            System.setProperty("java.protocol.handler.pkgs", pkgs);
+        } else if (pkgs.contains("org.jboss.virtual.protocol") == false) {
+            pkgs = "org.jboss.virtual.protocol|" + pkgs;
+            System.setProperty("java.protocol.handler.pkgs", pkgs);
+        }
+    }
 
-      String pkgs = System.getProperty("java.protocol.handler.pkgs");
-      if (pkgs == null || pkgs.trim().length() == 0)
-      {
-         pkgs = "org.jboss.virtual.protocol";
-         System.setProperty("java.protocol.handler.pkgs", pkgs);
-      }
-      else if (pkgs.contains("org.jboss.virtual.protocol") == false)
-      {
-         pkgs = "org.jboss.virtual.protocol|" + pkgs;
-         System.setProperty("java.protocol.handler.pkgs", pkgs);
-      }
-   }
-
-   /**
-    * Mount a filesystem on a mount point in the VFS.  The mount point is any valid file name, existant or non-existant.
-    * If a relative path is given, it will be treated as relative to the VFS root.
-    *
-    * @param mountPoint the mount point
-    * @param fileSystem the file system to mount
-    * @return a handle which can be used to unmount the filesystem
-    * @throws IOException if an I/O error occurs, such as a filesystem already being mounted at the given mount point
-    */
-   public Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws IOException {
-      if (mountPoint.getVFS() != this) {
-         throw new IOException("VirtualFile does not match VFS instance");
-      }
-      final VirtualFile parent = mountPoint.getParent();
-      if (parent == null) {
-         throw new IOException("Root filsystem already mounted");
-      }
-      final String name = mountPoint.getName();
-      final Mount mount = new Mount(fileSystem, mountPoint);
-      for (;;) {
-         Map<String, Mount> childMountMap = mounts.get(parent);
-         Map<String, Mount> newMap;
-         if (childMountMap == null) {
-            childMountMap = mounts.putIfAbsent(parent, Collections.singletonMap(name, mount));
+    /**
+     * Mount a filesystem on a mount point in the VFS.  The mount point is any valid file name, existant or non-existant.
+     * If a relative path is given, it will be treated as relative to the VFS root.
+     *
+     * @param mountPoint the mount point
+     * @param fileSystem the file system to mount
+     *
+     * @return a handle which can be used to unmount the filesystem
+     *
+     * @throws IOException if an I/O error occurs, such as a filesystem already being mounted at the given mount point
+     */
+    public Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws IOException {
+        if (mountPoint.getVFS() != this) {
+            throw new IOException("VirtualFile does not match VFS instance");
+        }
+        final VirtualFile parent = mountPoint.getParent();
+        if (parent == null) {
+            throw new IOException("Root filsystem already mounted");
+        }
+        final String name = mountPoint.getName();
+        final Mount mount = new Mount(fileSystem, mountPoint);
+        for (; ;) {
+            Map<String, Mount> childMountMap = mounts.get(parent);
+            Map<String, Mount> newMap;
             if (childMountMap == null) {
-               return mount;
+                childMountMap = mounts.putIfAbsent(parent, Collections.singletonMap(name, mount));
+                if (childMountMap == null) {
+                    return mount;
+                }
             }
-         }
-         newMap = new HashMap<String, Mount>(childMountMap);
-         if (newMap.put(name, mount) != null) {
-            throw new IOException("Filsystem already mounted at mount point \"" + mountPoint + "\"");
-         }
-         if (mounts.replace(parent, childMountMap, newMap)) {
-            return mount;
-         }
-      }
-   }
+            newMap = new HashMap<String, Mount>(childMountMap);
+            if (newMap.put(name, mount) != null) {
+                throw new IOException("Filsystem already mounted at mount point \"" + mountPoint + "\"");
+            }
+            if (mounts.replace(parent, childMountMap, newMap)) {
+                return mount;
+            }
+        }
+    }
 
-   /**
-    * Find a virtual file.
-    *
-    * @param url the URL whose path component is the child path
-    * @return the child
-    * @throws IllegalArgumentException if the path is null
-    */
-   public VirtualFile getChild(URL url) throws URISyntaxException
-   {
-      return getChild(url.toURI());
-   }
+    /**
+     * Find a virtual file.
+     *
+     * @param url the URL whose path component is the child path
+     *
+     * @return the child
+     *
+     * @throws IllegalArgumentException if the path is null
+     */
+    public VirtualFile getChild(URL url) throws URISyntaxException {
+        return getChild(url.toURI());
+    }
 
-   /**
-    * Find a virtual file.
-    *
-    * @param uri the URI whose path component is the child path
-    * @return the child
-    * @throws IllegalArgumentException if the path is null
-    */
-   public VirtualFile getChild(URI uri)
-   {
-      return getChild(uri.getPath());
-   }
+    /**
+     * Find a virtual file.
+     *
+     * @param uri the URI whose path component is the child path
+     *
+     * @return the child
+     *
+     * @throws IllegalArgumentException if the path is null
+     */
+    public VirtualFile getChild(URI uri) {
+        return getChild(uri.getPath());
+    }
 
-   /**
-    * Find a virtual file.
-    *
-    * @param path the child path
-    * @return the child
-    * @throws IllegalArgumentException if the path is null
-    */
-   public VirtualFile getChild(String path)
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
+    /**
+     * Find a virtual file.
+     *
+     * @param path the child path
+     *
+     * @return the child
+     *
+     * @throws IllegalArgumentException if the path is null
+     */
+    public VirtualFile getChild(String path) {
+        if (path == null)
+            throw new IllegalArgumentException("Null path");
+        return rootVirtualFile.getChild(path);
+    }
 
-      return rootVirtualFile.getChild(path);
-   }
+    /**
+     * Get the root virtual file for this VFS instance.
+     *
+     * @return the root virtual file
+     */
+    public VirtualFile getRootVirtualFile() {
+        return rootVirtualFile;
+    }
 
-   /**
-    * Get the root virtual file for this VFS instance.
-    *
-    * @return the root virtual file
-    */
-   public VirtualFile getRootVirtualFile()
-   {
-      return rootVirtualFile;
-   }
+    /**
+     * Get the children
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     */
+    public List<VirtualFile> getChildren() throws IOException {
+        return getRootVirtualFile().getChildren(null);
+    }
 
-   /**
-    * Get the children
-    *
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   public List<VirtualFile> getChildren() throws IOException
-   {
-      return getRootVirtualFile().getChildren(null);
-   }
+    /**
+     * Get the children
+     *
+     * @param filter to filter the children
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     */
+    public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException {
+        return getRootVirtualFile().getChildren(filter);
+    }
 
-   /**
-    * Get the children
-    *
-    * @param filter to filter the children
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException
-   {
-      return getRootVirtualFile().getChildren(filter);
-   }
+    /**
+     * Get all the children recursively<p>
+     * <p/>
+     * This always uses {@link VisitorAttributes#RECURSE}
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     */
+    public List<VirtualFile> getChildrenRecursively() throws IOException {
+        return getRootVirtualFile().getChildrenRecursively(null);
+    }
 
-   /**
-    * Get all the children recursively<p>
-    *
-    * This always uses {@link VisitorAttributes#RECURSE}
-    *
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   public List<VirtualFile> getChildrenRecursively() throws IOException
-   {
-      return getRootVirtualFile().getChildrenRecursively(null);
-   }
+    /**
+     * Get all the children recursively<p>
+     * <p/>
+     * This always uses {@link VisitorAttributes#RECURSE}
+     *
+     * @param filter to filter the children
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     */
+    public List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException {
+        return getRootVirtualFile().getChildrenRecursively(filter);
+    }
 
-   /**
-    * Get all the children recursively<p>
-    *
-    * This always uses {@link VisitorAttributes#RECURSE}
-    *
-    * @param filter to filter the children
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   public List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException
-   {
-      return getRootVirtualFile().getChildrenRecursively(filter);
-   }
+    /**
+     * Visit the virtual file system from the root
+     *
+     * @param visitor the visitor
+     *
+     * @throws IOException for any problem accessing the VFS
+     * @throws IllegalArgumentException if the visitor is null
+     */
+    public void visit(VirtualFileVisitor visitor) throws IOException {
+        visitor.visit(rootVirtualFile);
+    }
 
-   /**
-    * Visit the virtual file system from the root
-    *
-    * @param visitor the visitor
-    * @throws IOException for any problem accessing the VFS
-    * @throws IllegalArgumentException if the visitor is null
-    */
-   public void visit(VirtualFileVisitor visitor) throws IOException
-   {
-      visitor.visit(rootVirtualFile);
-   }
+    /**
+     * Visit the virtual file system
+     *
+     * @param file the file
+     * @param visitor the visitor
+     *
+     * @throws IOException for any problem accessing the VFS
+     * @throws IllegalArgumentException if the file or visitor is null
+     */
+    protected void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException {
+        if (file == null)
+            throw new IllegalArgumentException("Null file");
+        if (file.getVFS() != this)
+            throw new IllegalArgumentException("Virtual file from foreign VFS");
+        visitor.visit(file);
+    }
 
-   /**
-    * Visit the virtual file system
-    *
-    * @param file the file
-    * @param visitor the visitor
-    * @throws IOException for any problem accessing the VFS
-    * @throws IllegalArgumentException if the file or visitor is null
-    */
-   protected void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException
-   {
-      if (file == null)
-         throw new IllegalArgumentException("Null file");
-
-      if (file.getVFS() != this)
-         throw new IllegalArgumentException("Virtual file from foreign VFS");
-
-      visitor.visit(file);
-   }
-
-   Mount getMount(VirtualFile virtualFile) {
-      final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = this.mounts;
-      for (;;) {
-         final VirtualFile parent = virtualFile.getParent();
-         if (parent == null) {
-            return rootMount;
-         }
-         final Map<String, Mount> parentMounts = mounts.get(parent);
-         if (parentMounts == null) {
-            virtualFile = parent;
-         } else {
-            final Mount mount = parentMounts.get(virtualFile.getName());
-            if (mount == null) {
-               virtualFile = parent;
+    Mount getMount(VirtualFile virtualFile) {
+        final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = this.mounts;
+        for (; ;) {
+            final VirtualFile parent = virtualFile.getParent();
+            if (parent == null) {
+                return rootMount;
+            }
+            final Map<String, Mount> parentMounts = mounts.get(parent);
+            if (parentMounts == null) {
+                virtualFile = parent;
             } else {
-               return mount;
+                final Mount mount = parentMounts.get(virtualFile.getName());
+                if (mount == null) {
+                    virtualFile = parent;
+                } else {
+                    return mount;
+                }
             }
-         }
-      }
-   }
+        }
+    }
 
-   /**
-    * Get all immediate submounts for a path.
-    *
-    * @param virtualFile the path
-    * @return the collection of present mount (simple) names
-    */
-   Set<String> getSubmounts(VirtualFile virtualFile)
-   {
-      final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = this.mounts;
-      final Map<String, Mount> mountMap = mounts.get(virtualFile);
-      if (mountMap == null) {
-         return emptyRemovableSet();
-      }
-      return new HashSet<String>(mountMap.keySet());
-   }
+    /**
+     * Get all immediate submounts for a path.
+     *
+     * @param virtualFile the path
+     *
+     * @return the collection of present mount (simple) names
+     */
+    Set<String> getSubmounts(VirtualFile virtualFile) {
+        final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = this.mounts;
+        final Map<String, Mount> mountMap = mounts.get(virtualFile);
+        if (mountMap == null) {
+            return emptyRemovableSet();
+        }
+        return new HashSet<String>(mountMap.keySet());
+    }
 
-   private static Closeable doMount(final FileSystem fileSystem, final VirtualFile mountPoint) throws IOException
-   {
-      boolean ok = false;
-      try {
-         final Closeable mountHandle = getInstance().mount(mountPoint, fileSystem);
-         final Closeable closeable = new Closeable()
-         {
-            public void close() throws IOException
-            {
-               VFSUtils.safeClose(mountHandle);
-               VFSUtils.safeClose(fileSystem);
+    private static Closeable doMount(final FileSystem fileSystem, final VirtualFile mountPoint) throws IOException {
+        boolean ok = false;
+        try {
+            final Closeable mountHandle = getInstance().mount(mountPoint, fileSystem);
+            final Closeable closeable = new Closeable() {
+                public void close() throws IOException {
+                    VFSUtils.safeClose(mountHandle);
+                    VFSUtils.safeClose(fileSystem);
+                }
+            };
+            ok = true;
+            return closeable;
+        } finally {
+            if (!ok) {
+                VFSUtils.safeClose(fileSystem);
             }
-         };
-         ok = true;
-         return closeable;
-      } finally {
-         if (! ok) {
-            VFSUtils.safeClose(fileSystem);
-         }
-      }
-   }
+        }
+    }
 
-   /**
-    * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
-    * system when closed.
-    *
-    * @param zipFile the zip file to mount
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @param tempFileProvider the temporary file provider
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountZip(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException
-   {
-      boolean ok = false;
-      final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName());
-      try {
-         final Closeable closeable = doMount(new JavaZipFileSystem(zipFile, tempDir), mountPoint);
-         ok = true;
-         return closeable;
-      } finally {
-         if (! ok) {
-            VFSUtils.safeClose(tempDir);
-         }
-      }
-   }
-
-   /**
-    * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
-    * system when closed.
-    *
-    * @param zipData an input stream containing the zip data
-    * @param zipName the name of the archive
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @param tempFileProvider the temporary file provider
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountZip(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException
-   {
-      boolean ok = false;
-      try {
-         final TempDir tempDir = tempFileProvider.createTempDir(zipName);
-         try {
-            final Closeable closeable = doMount(new JavaZipFileSystem(zipName, zipData, tempDir), mountPoint);
+    /**
+     * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
+     * system when closed.
+     *
+     * @param zipFile the zip file to mount
+     * @param mountPoint the point at which the filesystem should be mounted
+     * @param tempFileProvider the temporary file provider
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountZip(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
+        boolean ok = false;
+        final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName());
+        try {
+            final Closeable closeable = doMount(new JavaZipFileSystem(zipFile, tempDir), mountPoint);
             ok = true;
             return closeable;
-         } finally {
-            if (! ok) {
-               VFSUtils.safeClose(tempDir);
+        } finally {
+            if (!ok) {
+                VFSUtils.safeClose(tempDir);
             }
-         }
-      } finally {
-         VFSUtils.safeClose(zipData);
-      }
-   }
+        }
+    }
 
-   /**
-    * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
-    * system when closed.
-    *
-    * @param zipFile a zip file in the VFS
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @param tempFileProvider the temporary file provider
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException
-   {
-      return mountZip(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
-   }
+    /**
+     * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
+     * system when closed.
+     *
+     * @param zipData an input stream containing the zip data
+     * @param zipName the name of the archive
+     * @param mountPoint the point at which the filesystem should be mounted
+     * @param tempFileProvider the temporary file provider
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountZip(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
+        boolean ok = false;
+        try {
+            final TempDir tempDir = tempFileProvider.createTempDir(zipName);
+            try {
+                final Closeable closeable = doMount(new JavaZipFileSystem(zipName, zipData, tempDir), mountPoint);
+                ok = true;
+                return closeable;
+            } finally {
+                if (!ok) {
+                    VFSUtils.safeClose(tempDir);
+                }
+            }
+        } finally {
+            VFSUtils.safeClose(zipData);
+        }
+    }
 
-   /**
-    * Create and mount a real file system, returning a single handle which will unmount and close the filesystem when
-    * closed.
-    *
-    * @param realRoot the real filesystem root
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountReal(File realRoot, VirtualFile mountPoint) throws IOException
-   {
-      return doMount(new RealFileSystem(realRoot), mountPoint);
-   }
+    /**
+     * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
+     * system when closed.
+     *
+     * @param zipFile a zip file in the VFS
+     * @param mountPoint the point at which the filesystem should be mounted
+     * @param tempFileProvider the temporary file provider
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
+        return mountZip(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
+    }
 
-   /**
-    * Create and mount a temporary file system, returning a single handle which will unmount and close the filesystem
-    * when closed.
-    *
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @param tempFileProvider the temporary file provider
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException
-   {
-      boolean ok = false;
-      final TempDir tempDir = tempFileProvider.createTempDir("tmpfs");
-      try {
-         final Closeable closeable = doMount(new RealFileSystem(tempDir.getRoot()), mountPoint);
-         ok = true;
-         return new Closeable()
-         {
-            public void close() throws IOException
-            {
-               VFSUtils.safeClose(closeable);
-               VFSUtils.safeClose(tempDir);
+    /**
+     * Create and mount a real file system, returning a single handle which will unmount and close the filesystem when
+     * closed.
+     *
+     * @param realRoot the real filesystem root
+     * @param mountPoint the point at which the filesystem should be mounted
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountReal(File realRoot, VirtualFile mountPoint) throws IOException {
+        return doMount(new RealFileSystem(realRoot), mountPoint);
+    }
+
+    /**
+     * Create and mount a temporary file system, returning a single handle which will unmount and close the filesystem
+     * when closed.
+     *
+     * @param mountPoint the point at which the filesystem should be mounted
+     * @param tempFileProvider the temporary file provider
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
+        boolean ok = false;
+        final TempDir tempDir = tempFileProvider.createTempDir("tmpfs");
+        try {
+            final Closeable closeable = doMount(new RealFileSystem(tempDir.getRoot()), mountPoint);
+            ok = true;
+            return new Closeable() {
+                public void close() throws IOException {
+                    VFSUtils.safeClose(closeable);
+                    VFSUtils.safeClose(tempDir);
+                }
+            };
+        } finally {
+            if (!ok) {
+                VFSUtils.safeClose(tempDir);
             }
-         };
-      } finally {
-         if (! ok) {
-            VFSUtils.safeClose(tempDir);
-         }
-      }
-   }
+        }
+    }
 
-   /**
-    * Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
-    * close the filesystem when closed.
-    *
-    * @param zipFile the zip file to mount
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @param tempFileProvider the temporary file provider
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException
-   {
-      boolean ok = false;
-      final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName());
-      try {
-         final File rootFile = tempDir.getRoot();
-         unzip(zipFile, rootFile);
-         final Closeable closeable = doMount(new RealFileSystem(rootFile), mountPoint);
-         ok = true;
-         return new Closeable()
-         {
-            public void close() throws IOException
-            {
-               VFSUtils.safeClose(closeable);
-               VFSUtils.safeClose(tempDir);
+    /**
+     * Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
+     * close the filesystem when closed.
+     *
+     * @param zipFile the zip file to mount
+     * @param mountPoint the point at which the filesystem should be mounted
+     * @param tempFileProvider the temporary file provider
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
+        boolean ok = false;
+        final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName());
+        try {
+            final File rootFile = tempDir.getRoot();
+            unzip(zipFile, rootFile);
+            final Closeable closeable = doMount(new RealFileSystem(rootFile), mountPoint);
+            ok = true;
+            return new Closeable() {
+                public void close() throws IOException {
+                    VFSUtils.safeClose(closeable);
+                    VFSUtils.safeClose(tempDir);
+                }
+            };
+        } finally {
+            if (!ok) {
+                VFSUtils.safeClose(tempDir);
             }
-         };
-      } finally {
-         if (! ok) {
-            VFSUtils.safeClose(tempDir);
-         }
-      }
-   }
+        }
+    }
 
-   /**
-    * Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
-    * close the filesystem when closed.  The given zip data stream is closed.
-    *
-    * @param zipData an input stream containing the zip data
-    * @param zipName the name of the archive
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @param tempFileProvider the temporary file provider
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException
-   {
-      try {
-         boolean ok = false;
-         final TempDir tempDir = tempFileProvider.createTempDir(zipName);
-         try {
-            final File zipFile = File.createTempFile(zipName + "-", ".tmp", tempDir.getRoot());
+    /**
+     * Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
+     * close the filesystem when closed.  The given zip data stream is closed.
+     *
+     * @param zipData an input stream containing the zip data
+     * @param zipName the name of the archive
+     * @param mountPoint the point at which the filesystem should be mounted
+     * @param tempFileProvider the temporary file provider
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
+        try {
+            boolean ok = false;
+            final TempDir tempDir = tempFileProvider.createTempDir(zipName);
             try {
-               final FileOutputStream os = new FileOutputStream(zipFile);
-               try {
-                  // allow an error on close to terminate the unzip
-                  VFSUtils.copyStream(zipData, os);
-                  zipData.close();
-                  os.close();
-               } finally {
-                  VFSUtils.safeClose(zipData);
-                  VFSUtils.safeClose(os);
-               }
-               final File rootFile = tempDir.getRoot();
-               unzip(zipFile, rootFile);
-               final Closeable closeable = doMount(new RealFileSystem(rootFile), mountPoint);
-               ok = true;
-               return new Closeable()
-               {
-                  public void close() throws IOException
-                  {
-                     VFSUtils.safeClose(closeable);
-                     VFSUtils.safeClose(tempDir);
-                  }
-               };
+                final File zipFile = File.createTempFile(zipName + "-", ".tmp", tempDir.getRoot());
+                try {
+                    final FileOutputStream os = new FileOutputStream(zipFile);
+                    try {
+                        // allow an error on close to terminate the unzip
+                        VFSUtils.copyStream(zipData, os);
+                        zipData.close();
+                        os.close();
+                    } finally {
+                        VFSUtils.safeClose(zipData);
+                        VFSUtils.safeClose(os);
+                    }
+                    final File rootFile = tempDir.getRoot();
+                    unzip(zipFile, rootFile);
+                    final Closeable closeable = doMount(new RealFileSystem(rootFile), mountPoint);
+                    ok = true;
+                    return new Closeable() {
+                        public void close() throws IOException {
+                            VFSUtils.safeClose(closeable);
+                            VFSUtils.safeClose(tempDir);
+                        }
+                    };
+                } finally {
+                    zipFile.delete();
+                }
             } finally {
-               zipFile.delete();
+                if (!ok) {
+                    VFSUtils.safeClose(tempDir);
+                }
             }
-         } finally {
-            if (! ok) {
-               VFSUtils.safeClose(tempDir);
-            }
-         }
-      } finally {
-         VFSUtils.safeClose(zipData);
-      }
-   }
+        } finally {
+            VFSUtils.safeClose(zipData);
+        }
+    }
 
-   /**
-    * Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
-    * close the filesystem when closed.  The given zip data stream is closed.
-    *
-    * @param zipFile a zip file in the VFS
-    * @param mountPoint the point at which the filesystem should be mounted
-    * @param tempFileProvider the temporary file provider
-    * @return a handle
-    * @throws IOException if an error occurs
-    */
-   public static Closeable mountZipExpanded(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException
-   {
-      return mountZipExpanded(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
-   }
+    /**
+     * Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
+     * close the filesystem when closed.  The given zip data stream is closed.
+     *
+     * @param zipFile a zip file in the VFS
+     * @param mountPoint the point at which the filesystem should be mounted
+     * @param tempFileProvider the temporary file provider
+     *
+     * @return a handle
+     *
+     * @throws IOException if an error occurs
+     */
+    public static Closeable mountZipExpanded(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
+        return mountZipExpanded(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
+    }
 
-   /**
-    * Expand a zip file to a destination directory.  The directory must exist.  If an error occurs, the destination
-    * directory may contain a partially-extracted archive, so cleanup is up to the caller.
-    *
-    * @param zipFile the zip file
-    * @param destDir the destination directory
-    * @throws IOException if an error occurs
-    */
-   public static void unzip(File zipFile, File destDir) throws IOException
-   {
-      final ZipFile zip = new ZipFile(zipFile);
-      try {
-         final Set<File> createdDirs = new HashSet<File>();
-         final Enumeration<? extends ZipEntry> entries = zip.entries();
-         FILES_LOOP: while (entries.hasMoreElements()) {
-            final ZipEntry zipEntry = entries.nextElement();
-            final String name = zipEntry.getName();
-            final List<String> tokens = PathTokenizer.getTokens(name);
-            final Iterator<String> it = tokens.iterator();
-            File current = destDir;
-            while (it.hasNext())
-            {
-               String token = it.next();
-               if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token))
-               {
-                  // invalid file; skip it!
-                  continue FILES_LOOP;
-               }
-               current = new File(current, token);
-               if ((it.hasNext() || zipEntry.isDirectory()) && createdDirs.add(current))
-               {
-                  current.mkdir();
-               }
+    /**
+     * Expand a zip file to a destination directory.  The directory must exist.  If an error occurs, the destination
+     * directory may contain a partially-extracted archive, so cleanup is up to the caller.
+     *
+     * @param zipFile the zip file
+     * @param destDir the destination directory
+     *
+     * @throws IOException if an error occurs
+     */
+    public static void unzip(File zipFile, File destDir) throws IOException {
+        final ZipFile zip = new ZipFile(zipFile);
+        try {
+            final Set<File> createdDirs = new HashSet<File>();
+            final Enumeration<? extends ZipEntry> entries = zip.entries();
+            FILES_LOOP:
+            while (entries.hasMoreElements()) {
+                final ZipEntry zipEntry = entries.nextElement();
+                final String name = zipEntry.getName();
+                final List<String> tokens = PathTokenizer.getTokens(name);
+                final Iterator<String> it = tokens.iterator();
+                File current = destDir;
+                while (it.hasNext()) {
+                    String token = it.next();
+                    if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token)) {
+                        // invalid file; skip it!
+                        continue FILES_LOOP;
+                    }
+                    current = new File(current, token);
+                    if ((it.hasNext() || zipEntry.isDirectory()) && createdDirs.add(current)) {
+                        current.mkdir();
+                    }
+                }
+                if (!zipEntry.isDirectory()) {
+                    final InputStream is = zip.getInputStream(zipEntry);
+                    try {
+                        final FileOutputStream os = new FileOutputStream(current);
+                        try {
+                            VFSUtils.copyStream(is, os);
+                            // allow an error on close to terminate the unzip
+                            is.close();
+                            os.close();
+                        } finally {
+                            VFSUtils.safeClose(os);
+                        }
+                    } finally {
+                        VFSUtils.safeClose(is);
+                    }
+                }
             }
-            if (! zipEntry.isDirectory()) {
-               final InputStream is = zip.getInputStream(zipEntry);
-               try {
-                  final FileOutputStream os = new FileOutputStream(current);
-                  try {
-                     VFSUtils.copyStream(is, os);
-                     // allow an error on close to terminate the unzip
-                     is.close();
-                     os.close();
-                  } finally {
-                     VFSUtils.safeClose(os);
-                  }
-               } finally {
-                  VFSUtils.safeClose(is);
-               }
-            }
-         }
-      } finally {
-         VFSUtils.safeClose(zip);
-      }
-   }
+        } finally {
+            VFSUtils.safeClose(zip);
+        }
+    }
 
-   @SuppressWarnings({ "unchecked" })
-   private static <E> Set<E> emptyRemovableSet() {
-      return EMPTY_REMOVABLE_SET;
-   }
+    @SuppressWarnings({ "unchecked" })
+    private static <E> Set<E> emptyRemovableSet() {
+        return EMPTY_REMOVABLE_SET;
+    }
 
-   private static final Set EMPTY_REMOVABLE_SET = new EmptyRemovableSet();
+    private static final Set EMPTY_REMOVABLE_SET = new EmptyRemovableSet();
 
-   private static final class EmptyRemovableSet<E> extends AbstractSet<E> {
+    private static final class EmptyRemovableSet<E> extends AbstractSet<E> {
 
-      public boolean remove(Object o)
-      {
-         return false;
-      }
+        public boolean remove(Object o) {
+            return false;
+        }
 
-      public boolean retainAll(Collection<?> c)
-      {
-         return false;
-      }
+        public boolean retainAll(Collection<?> c) {
+            return false;
+        }
 
-      public void clear()
-      {
-      }
+        public void clear() {
+        }
 
-      public Iterator<E> iterator()
-      {
-         return Collections.<E>emptySet().iterator();
-      }
+        public Iterator<E> iterator() {
+            return Collections.<E>emptySet().iterator();
+        }
 
-      public int size()
-      {
-         return 0;
-      }
-   }
+        public int size() {
+            return 0;
+        }
+    }
 
-   /**
-    * The mount representation.  This instance represents a binding between a position in the virtual filesystem and
-    * the backing filesystem implementation; the same {@code FileSystem} may be mounted in more than one place, however
-    * only one {@code FileSystem} may be bound to a specific path at a time.
-    */
-   final class Mount implements Closeable {
-      private final FileSystem fileSystem;
-      private final VirtualFile mountPoint;
-      private final StackTraceElement[] allocationPoint;
-      private final AtomicBoolean closed = new AtomicBoolean(false);
+    /**
+     * The mount representation.  This instance represents a binding between a position in the virtual filesystem and the
+     * backing filesystem implementation; the same {@code FileSystem} may be mounted in more than one place, however only
+     * one {@code FileSystem} may be bound to a specific path at a time.
+     */
+    final class Mount implements Closeable {
 
-      Mount(FileSystem fileSystem, VirtualFile mountPoint)
-      {
-         this.fileSystem = fileSystem;
-         this.mountPoint = mountPoint;
-         allocationPoint = Thread.currentThread().getStackTrace();
-      }
+        private final FileSystem fileSystem;
+        private final VirtualFile mountPoint;
+        private final StackTraceElement[] allocationPoint;
+        private final AtomicBoolean closed = new AtomicBoolean(false);
 
-      public void close() throws IOException
-      {
-         if (closed.getAndSet(true)) {
-            return;
-         }
-         final String name = mountPoint.getName();
-         final VirtualFile parent = mountPoint.getParent();
-         final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.this.mounts;
-         for (;;) {
-            final Map<String, Mount> parentMounts = mounts.get(parent);
-            if (parentMounts == null) {
-               return;
+        Mount(FileSystem fileSystem, VirtualFile mountPoint) {
+            this.fileSystem = fileSystem;
+            this.mountPoint = mountPoint;
+            allocationPoint = Thread.currentThread().getStackTrace();
+        }
+
+        public void close() throws IOException {
+            if (closed.getAndSet(true)) {
+                return;
             }
-            final VFS.Mount mount = parentMounts.get(name);
-            if (mount != this) {
-               return;
+            final String name = mountPoint.getName();
+            final VirtualFile parent = mountPoint.getParent();
+            final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.this.mounts;
+            for (; ;) {
+                final Map<String, Mount> parentMounts = mounts.get(parent);
+                if (parentMounts == null) {
+                    return;
+                }
+                final VFS.Mount mount = parentMounts.get(name);
+                if (mount != this) {
+                    return;
+                }
+                final Map<String, Mount> newParentMounts;
+                if (parentMounts.size() == 2) {
+                    final Iterator<Map.Entry<String, Mount>> ei = parentMounts.entrySet().iterator();
+                    final Map.Entry<String, Mount> e1 = ei.next();
+                    if (e1.getKey().equals(name)) {
+                        final Map.Entry<String, Mount> e2 = ei.next();
+                        newParentMounts = Collections.singletonMap(e2.getKey(), e2.getValue());
+                    } else {
+                        newParentMounts = Collections.singletonMap(e1.getKey(), e1.getValue());
+                    }
+                    if (mounts.replace(parent, parentMounts, newParentMounts)) {
+                        return;
+                    }
+                } else if (parentMounts.size() == 1) {
+                    if (mounts.remove(parent, parentMounts)) {
+                        return;
+                    }
+                } else {
+                    newParentMounts = new HashMap<String, Mount>(parentMounts);
+                    newParentMounts.remove(name);
+                    if (mounts.replace(parent, parentMounts, newParentMounts)) {
+                        return;
+                    }
+                }
             }
-            final Map<String, Mount> newParentMounts;
-            if (parentMounts.size() == 2) {
-               final Iterator<Map.Entry<String, Mount>> ei = parentMounts.entrySet().iterator();
-               final Map.Entry<String, Mount> e1 = ei.next();
-               if (e1.getKey().equals(name)) {
-                  final Map.Entry<String, Mount> e2 = ei.next();
-                  newParentMounts = Collections.singletonMap(e2.getKey(), e2.getValue());
-               } else {
-                  newParentMounts = Collections.singletonMap(e1.getKey(), e1.getValue());
-               }
-               if (mounts.replace(parent, parentMounts, newParentMounts)) {
-                  return;
-               }
-            } else if (parentMounts.size() == 1) {
-               if (mounts.remove(parent, parentMounts)) {
-                  return;
-               }
-            } else {
-               newParentMounts = new HashMap<String, Mount>(parentMounts);
-               newParentMounts.remove(name);
-               if (mounts.replace(parent, parentMounts, newParentMounts)) {
-                  return;
-               }
-            }
-         }
-      }
+        }
 
-      FileSystem getFileSystem()
-      {
-         return fileSystem;
-      }
+        FileSystem getFileSystem() {
+            return fileSystem;
+        }
 
-      VirtualFile getMountPoint()
-      {
-         return mountPoint;
-      }
+        VirtualFile getMountPoint() {
+            return mountPoint;
+        }
 
-      protected void finalize() throws IOException
-      {
-         if (! closed.get()) {
-            final StackTraceElement[] allocationPoint = this.allocationPoint;
-            if (allocationPoint != null) {
-               final LeakDescriptor t = new LeakDescriptor();
-               t.setStackTrace(allocationPoint);
-               log.warnf(t, "A VFS mount (%s) was leaked!", mountPoint);
-            } else {
-               log.warnf("A VFS mount (%s) was leaked!", mountPoint);
+        protected void finalize() throws IOException {
+            if (!closed.get()) {
+                final StackTraceElement[] allocationPoint = this.allocationPoint;
+                if (allocationPoint != null) {
+                    final LeakDescriptor t = new LeakDescriptor();
+                    t.setStackTrace(allocationPoint);
+                    log.warnf(t, "A VFS mount (%s) was leaked!", mountPoint);
+                } else {
+                    log.warnf("A VFS mount (%s) was leaked!", mountPoint);
+                }
+                close();
             }
-            close();
-         }
-      }
-   }
+        }
+    }
 
-   private static final class LeakDescriptor extends Throwable {
-      private static final long serialVersionUID = 6034058126740270584L;
+    private static final class LeakDescriptor extends Throwable {
 
-      public String toString()
-      {
-         return "Allocation stack trace:";
-      }
-   }
+        private static final long serialVersionUID = 6034058126740270584L;
+
+        public String toString() {
+            return "Allocation stack trace:";
+        }
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSInputSource.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSInputSource.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSInputSource.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -33,53 +33,41 @@
  *
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
-public class VFSInputSource extends InputSource
-{
-   private VirtualFile file;
+public class VFSInputSource extends InputSource {
 
-   public VFSInputSource(VirtualFile file)
-   {
-      if (file == null)
-         throw new IllegalArgumentException("Null file");
+    private VirtualFile file;
 
-      this.file = file;
-   }
+    public VFSInputSource(VirtualFile file) {
+        if (file == null)
+            throw new IllegalArgumentException("Null file");
+        this.file = file;
+    }
 
-   @Override
-   public String getSystemId()
-   {
-      try
-      {
-         return VFSUtils.getVirtualURI(file).toString();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
+    @Override
+    public String getSystemId() {
+        try {
+            return VFSUtils.getVirtualURI(file).toString();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
 
-   @Override
-   public InputStream getByteStream()
-   {
-      try
-      {
-         return file.openStream();
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
+    @Override
+    public InputStream getByteStream() {
+        try {
+            return file.openStream();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 
-   @Override
-   public Reader getCharacterStream()
-   {
-      return new InputStreamReader(getByteStream());
-   }
+    @Override
+    public Reader getCharacterStream() {
+        return new InputStreamReader(getByteStream());
+    }
 
-   @Override
-   public String toString()
-   {
-      return file.getPathName();
-   }
+    @Override
+    public String toString() {
+        return file.getPathName();
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -52,546 +52,512 @@
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
-public class VFSUtils
-{
-   /** The log */
-   private static final Logger log = Logger.getLogger(VFSUtils.class);
+public class VFSUtils {
 
-   /** The default encoding */
-   private static final String DEFAULT_ENCODING = "UTF-8";
+    /**
+     * The log
+     */
+    private static final Logger log = Logger.getLogger(VFSUtils.class);
 
-   /**
-    * Constant representing the URL file protocol
-    */
-   public static final String FILE_PROTOCOL = "file";
+    /**
+     * The default encoding
+     */
+    private static final String DEFAULT_ENCODING = "UTF-8";
 
-   /** Standard separator for JAR URL */
-   public static final String JAR_URL_SEPARATOR = "!/";
+    /**
+     * Constant representing the URL file protocol
+     */
+    public static final String FILE_PROTOCOL = "file";
 
-   /** The default buffer size to use for copies */
-   public static final int DEFAULT_BUFFER_SIZE = 65536;
+    /**
+     * Standard separator for JAR URL
+     */
+    public static final String JAR_URL_SEPARATOR = "!/";
 
-   private VFSUtils()
-   {
-   }
+    /**
+     * The default buffer size to use for copies
+     */
+    public static final int DEFAULT_BUFFER_SIZE = 65536;
 
-   /**
-    * Get the paths string for a collection of virtual files
-    *
-    * @param paths the paths
-    * @return the string
-    * @throws IllegalArgumentException for null paths
-    */
-   public static String getPathsString(Collection<VirtualFile> paths)
-   {
-      if (paths == null)
-         throw new IllegalArgumentException("Null paths");
+    private VFSUtils() {
+    }
 
-      StringBuilder buffer = new StringBuilder();
-      boolean first = true;
-      for (VirtualFile path : paths)
-      {
-         if (path == null)
-            throw new IllegalArgumentException("Null path in " + paths);
-         if (first == false)
-            buffer.append(':');
-         else
-            first = false;
-         buffer.append(path.getPathName());
-      }
+    /**
+     * Get the paths string for a collection of virtual files
+     *
+     * @param paths the paths
+     *
+     * @return the string
+     *
+     * @throws IllegalArgumentException for null paths
+     */
+    public static String getPathsString(Collection<VirtualFile> paths) {
+        if (paths == null)
+            throw new IllegalArgumentException("Null paths");
+        StringBuilder buffer = new StringBuilder();
+        boolean first = true;
+        for (VirtualFile path : paths) {
+            if (path == null)
+                throw new IllegalArgumentException("Null path in " + paths);
+            if (first == false)
+                buffer.append(':');
+            else
+                first = false;
+            buffer.append(path.getPathName());
+        }
+        if (first == true)
+            buffer.append("<empty>");
+        return buffer.toString();
+    }
 
-      if (first == true)
-         buffer.append("<empty>");
+    /**
+     * Add manifest paths
+     *
+     * @param file the file
+     * @param paths the paths to add to
+     *
+     * @throws IOException if there is an error reading the manifest or the virtual file is closed
+     * @throws IllegalStateException if the file has no parent
+     * @throws IllegalArgumentException for a null file or paths
+     */
+    public static void addManifestLocations(VirtualFile file, List<VirtualFile> paths) throws IOException {
+        if (file == null)
+            throw new IllegalArgumentException("Null file");
+        if (paths == null)
+            throw new IllegalArgumentException("Null paths");
+        boolean trace = log.isTraceEnabled();
+        Manifest manifest = getManifest(file);
+        if (manifest == null)
+            return;
+        Attributes mainAttributes = manifest.getMainAttributes();
+        String classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
+        if (classPath == null) {
+            if (trace)
+                log.trace("Manifest has no Class-Path for " + file.getPathName());
+            return;
+        }
+        VirtualFile parent = file.getParent();
+        if (parent == null) {
+            log.debug(file + " has no parent.");
+            return;
+        }
+        if (trace)
+            log.trace("Parsing Class-Path: " + classPath + " for " + file.getName() + " parent=" + parent.getName());
+        StringTokenizer tokenizer = new StringTokenizer(classPath);
+        while (tokenizer.hasMoreTokens()) {
+            String path = tokenizer.nextToken();
+            try {
+                VirtualFile vf = parent.getChild(path);
+                if (vf != null) {
+                    if (paths.contains(vf) == false) {
+                        paths.add(vf);
+                        // Recursively process the jar
+                        addManifestLocations(vf, paths);
+                    } else if (trace)
+                        log.trace(vf.getName() + " from manifiest is already in the classpath " + paths);
+                } else if (trace)
+                    log.trace("Unable to find " + path + " from " + parent.getName());
+            }
+            catch (IOException e) {
+                log.debug("Manifest Class-Path entry " + path + " ignored for " + file.getPathName() + " reason=" + e);
+            }
+        }
+    }
 
-      return buffer.toString();
-   }
+    /**
+     * Get a manifest from a virtual file, assuming the virtual file is the root of an archive
+     *
+     * @param archive the root the archive
+     *
+     * @return the manifest or null if not found
+     *
+     * @throws IOException if there is an error reading the manifest or the virtual file is closed
+     * @throws IllegalArgumentException for a null archive
+     */
+    public static Manifest getManifest(VirtualFile archive) throws IOException {
+        if (archive == null)
+            throw new IllegalArgumentException("Null archive");
+        VirtualFile manifest = archive.getChild(JarFile.MANIFEST_NAME);
+        if (manifest == null) {
+            if (log.isTraceEnabled())
+                log.trace("Can't find manifest for " + archive.getPathName());
+            return null;
+        }
+        return readManifest(manifest);
+    }
 
-   /**
-    * Add manifest paths
-    *
-    * @param file the file
-    * @param paths the paths to add to
-    * @throws IOException if there is an error reading the manifest or the
-    *         virtual file is closed
-    * @throws IllegalStateException if the file has no parent
-    * @throws IllegalArgumentException for a null file or paths
-    */
-   public static void addManifestLocations(VirtualFile file, List<VirtualFile> paths) throws IOException
-   {
-      if (file == null)
-         throw new IllegalArgumentException("Null file");
-      if (paths == null)
-         throw new IllegalArgumentException("Null paths");
+    /**
+     * Read the manifest from given manifest VirtualFile.
+     *
+     * @param manifest the VF to read from
+     *
+     * @return JAR's manifest
+     *
+     * @throws IOException if problems while opening VF stream occur
+     */
+    public static Manifest readManifest(VirtualFile manifest) throws IOException {
+        if (manifest == null)
+            throw new IllegalArgumentException("Null manifest file");
+        InputStream stream = manifest.openStream();
+        try {
+            return new Manifest(stream);
+        }
+        finally {
+            safeClose(stream);
+        }
+    }
 
-      boolean trace = log.isTraceEnabled();
+    /**
+     * Fix a name (removes any trailing slash)
+     *
+     * @param name the name to fix
+     *
+     * @return the fixed name
+     *
+     * @throws IllegalArgumentException for a null name
+     */
+    public static String fixName(String name) {
+        if (name == null)
+            throw new IllegalArgumentException("Null name");
+        int length = name.length();
+        if (length <= 1)
+            return name;
+        if (name.charAt(length - 1) == '/')
+            return name.substring(0, length - 1);
+        return name;
+    }
 
-      Manifest manifest = getManifest(file);
-      if (manifest == null)
-         return;
+    /**
+     * Decode the path with UTF-8 encoding..
+     *
+     * @param path the path to decode
+     *
+     * @return decoded path
+     */
+    public static String decode(String path) {
+        return decode(path, DEFAULT_ENCODING);
+    }
 
-      Attributes mainAttributes = manifest.getMainAttributes();
-      String classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
+    /**
+     * Decode the path.
+     *
+     * @param path the path to decode
+     * @param encoding the encodeing
+     *
+     * @return decoded path
+     */
+    public static String decode(String path, String encoding) {
+        try {
+            return URLDecoder.decode(path, encoding);
+        }
+        catch (UnsupportedEncodingException e) {
+            throw new IllegalArgumentException("Cannot decode: " + path + " [" + encoding + "]", e);
+        }
+    }
 
-      if (classPath == null)
-      {
-         if (trace)
-            log.trace("Manifest has no Class-Path for " + file.getPathName());
-         return;
-      }
+    /**
+     * Get the name.
+     *
+     * @param uri the uri
+     *
+     * @return name from uri's path
+     */
+    public static String getName(URI uri) {
+        if (uri == null)
+            throw new IllegalArgumentException("Null uri");
+        String name = uri.getPath();
+        if (name != null) {
+            // TODO: Not correct for certain uris like jar:...!/
+            int lastSlash = name.lastIndexOf('/');
+            if (lastSlash > 0)
+                name = name.substring(lastSlash + 1);
+        }
+        return name;
+    }
 
-      VirtualFile parent = file.getParent();
-      if (parent == null)
-      {
-         log.debug(file + " has no parent.");
-         return;
-      }
-
-      if (trace)
-         log.trace("Parsing Class-Path: " + classPath + " for " + file.getName() + " parent=" + parent.getName());
-
-      StringTokenizer tokenizer = new StringTokenizer(classPath);
-      while (tokenizer.hasMoreTokens())
-      {
-         String path = tokenizer.nextToken();
-         try
-         {
-            VirtualFile vf = parent.getChild(path);
-            if(vf != null)
-            {
-               if(paths.contains(vf) == false)
-               {
-                  paths.add(vf);
-                  // Recursively process the jar
-                  addManifestLocations(vf, paths);
-               }
-               else if (trace)
-                  log.trace(vf.getName() + " from manifiest is already in the classpath " + paths);
+    /**
+     * Take a URL.getQuery string and parse it into name=value pairs
+     *
+     * @param query Possibly empty/null url query string
+     *
+     * @return String[] for the name/value pairs in the query. May be empty but never null.
+     */
+    public static Map<String, String> parseURLQuery(String query) {
+        Map<String, String> pairsMap = CollectionsFactory.createLazyMap();
+        if (query != null) {
+            StringTokenizer tokenizer = new StringTokenizer(query, "=&");
+            while (tokenizer.hasMoreTokens()) {
+                String name = tokenizer.nextToken();
+                String value = tokenizer.nextToken();
+                pairsMap.put(name, value);
             }
-            else if (trace)
-               log.trace("Unable to find " + path + " from " + parent.getName());
-         }
-         catch (IOException e)
-         {
-            log.debug("Manifest Class-Path entry " + path + " ignored for " + file.getPathName() + " reason=" + e);
-         }
-      }
-   }
+        }
+        return pairsMap;
+    }
 
-   /**
-    * Get a manifest from a virtual file,
-    * assuming the virtual file is the root of an archive
-    *
-    * @param archive the root the archive
-    * @return the manifest or null if not found
-    * @throws IOException if there is an error reading the manifest or the
-    *         virtual file is closed
-    * @throws IllegalArgumentException for a null archive
-    */
-   public static Manifest getManifest(VirtualFile archive) throws IOException
-   {
-      if (archive == null)
-         throw new IllegalArgumentException("Null archive");
+    /**
+     * Deal with urls that may include spaces.
+     *
+     * @param url the url
+     *
+     * @return uri the uri
+     *
+     * @throws URISyntaxException for any error
+     */
+    public static URI toURI(URL url) throws URISyntaxException {
+        if (url == null)
+            throw new IllegalArgumentException("Null url");
+        try {
+            return url.toURI();
+        }
+        catch (URISyntaxException e) {
+            String urispec = url.toExternalForm();
+            // Escape percent sign and spaces
+            urispec = urispec.replaceAll("%", "%25");
+            urispec = urispec.replaceAll(" ", "%20");
+            return new URI(urispec);
+        }
+    }
 
-      VirtualFile manifest = archive.getChild(JarFile.MANIFEST_NAME);
-      if (manifest == null)
-      {
-         if (log.isTraceEnabled())
-            log.trace("Can't find manifest for " + archive.getPathName());
-         return null;
-      }
-      return readManifest(manifest);
-   }
+    /**
+     * Ensure the url is convertible to URI by encoding spaces and percent characters if necessary
+     *
+     * @param url to be sanitized
+     *
+     * @return sanitized URL
+     *
+     * @throws URISyntaxException if URI conversion can't be fixed
+     * @throws MalformedURLException if an error occurs
+     */
+    public static URL sanitizeURL(URL url) throws URISyntaxException, MalformedURLException {
+        return toURI(url).toURL();
+    }
 
-   /**
-    * Read the manifest from given manifest VirtualFile.
-    *
-    * @param manifest the VF to read from
-    * @return JAR's manifest
-    * @throws IOException if problems while opening VF stream occur
-    */
-   public static Manifest readManifest(VirtualFile manifest) throws IOException
-   {
-      if (manifest == null)
-         throw new IllegalArgumentException("Null manifest file");
+    /**
+     * Copy input stream to output stream and close them both
+     *
+     * @param is input stream
+     * @param os output stream
+     *
+     * @throws IOException for any error
+     */
+    public static void copyStreamAndClose(InputStream is, OutputStream os) throws IOException {
+        copyStreamAndClose(is, os, DEFAULT_BUFFER_SIZE);
+    }
 
-      InputStream stream = manifest.openStream();
-      try
-      {
-         return new Manifest(stream);
-      }
-      finally
-      {
-         safeClose(stream);
-      }
-   }
+    /**
+     * Copy input stream to output stream and close them both
+     *
+     * @param is input stream
+     * @param os output stream
+     * @param bufferSize the buffer size to use
+     *
+     * @throws IOException for any error
+     */
+    public static void copyStreamAndClose(InputStream is, OutputStream os, int bufferSize)
+            throws IOException {
+        try {
+            copyStream(is, os, bufferSize);
+            // throw an exception if the close fails since some data might be lost
+            is.close();
+            os.close();
+        }
+        finally {
+            // ...but still guarantee that they're both closed
+            safeClose(is);
+            safeClose(os);
+        }
+    }
 
-   /**
-    * Fix a name (removes any trailing slash)
-    *
-    * @param name the name to fix
-    * @return the fixed name
-    * @throws IllegalArgumentException for a null name
-    */
-   public static String fixName(String name)
-   {
-      if (name == null)
-         throw new IllegalArgumentException("Null name");
+    /**
+     * Copy input stream to output stream without closing streams. Flushes output stream when done.
+     *
+     * @param is input stream
+     * @param os output stream
+     *
+     * @throws IOException for any error
+     */
+    public static void copyStream(InputStream is, OutputStream os) throws IOException {
+        copyStream(is, os, DEFAULT_BUFFER_SIZE);
+    }
 
-      int length = name.length();
-      if (length <= 1)
-         return name;
-      if (name.charAt(length-1) == '/')
-         return name.substring(0, length-1);
+    /**
+     * Copy input stream to output stream without closing streams. Flushes output stream when done.
+     *
+     * @param is input stream
+     * @param os output stream
+     * @param bufferSize the buffer size to use
+     *
+     * @throws IOException for any error
+     */
+    public static void copyStream(InputStream is, OutputStream os, int bufferSize)
+            throws IOException {
+        if (is == null)
+            throw new IllegalArgumentException("input stream is null");
+        if (os == null)
+            throw new IllegalArgumentException("output stream is null");
+        byte[] buff = new byte[bufferSize];
+        int rc;
+        while ((rc = is.read(buff)) != -1) os.write(buff, 0, rc);
+        os.flush();
+    }
 
-      return name;
-   }
+    /**
+     * Write the given bytes to the given virtual file, replacing its current contents (if any) or creating a new file if
+     * one does not exist.
+     *
+     * @param virtualFile the virtual file to write
+     * @param bytes the bytes
+     *
+     * @throws IOException if an error occurs
+     */
+    public static void writeFile(VirtualFile virtualFile, byte[] bytes) throws IOException {
+        final File file = virtualFile.getPhysicalFile();
+        file.getParentFile().mkdirs();
+        final FileOutputStream fos = new FileOutputStream(file);
+        try {
+            fos.write(bytes);
+            fos.close();
+        } finally {
+            safeClose(fos);
+        }
+    }
 
-   /**
-    * Decode the path with UTF-8 encoding..
-    *
-    * @param path the path to decode
-    * @return decoded path
-    */
-   public static String decode(String path)
-   {
-      return decode(path, DEFAULT_ENCODING);
-   }
+    /**
+     * Get the virtual URL for a virtual file.  This URL can be used to access the virtual file; however, taking the file
+     * part of the URL and attempting to use it with the {@link java.io.File} class may fail if the file is not present
+     * on the physical filesystem, and in general should not be attempted.
+     *
+     * @param file the virtual file
+     *
+     * @return the URL
+     *
+     * @throws MalformedURLException if the file cannot be coerced into a URL for some reason
+     */
+    public static URL getVirtualURL(VirtualFile file) throws MalformedURLException {
+        // todo: specify the URL handler directly as a minor optimization
+        return new URL("file", "", -1, file.getPathName(true));
+    }
 
-   /**
-    * Decode the path.
-    *
-    * @param path the path to decode
-    * @param encoding the encodeing
-    * @return decoded path
-    */
-   public static String decode(String path, String encoding)
-   {
-      try
-      {
-         return URLDecoder.decode(path, encoding);
-      }
-      catch (UnsupportedEncodingException e)
-      {
-         throw new IllegalArgumentException("Cannot decode: " + path + " [" + encoding + "]", e);
-      }
-   }
+    /**
+     * Get the virtual URI for a virtual file.
+     *
+     * @param file the virtual file
+     *
+     * @return the URI
+     *
+     * @throws URISyntaxException if the file cannot be coerced into a URI for some reason
+     */
+    public static URI getVirtualURI(VirtualFile file) throws URISyntaxException {
+        return new URI("file", "", file.getPathName(true), null);
+    }
 
-   /**
-    * Get the name.
-    *
-    * @param uri the uri
-    * @return name from uri's path
-    */
-   public static String getName(URI uri)
-   {
-      if (uri == null)
-         throw new IllegalArgumentException("Null uri");
+    /**
+     * Get a physical URL for a virtual file.  See the warnings on the {@link VirtualFile#getPhysicalFile()} method
+     * before using this method.
+     *
+     * @param file the virtual file
+     *
+     * @return the physical file URL
+     *
+     * @throws IOException if an I/O error occurs getting the physical file
+     */
+    public static URL getPhysicalURL(VirtualFile file) throws IOException {
+        return getPhysicalURI(file).toURL();
+    }
 
-      String name = uri.getPath();
-      if( name != null )
-      {
-         // TODO: Not correct for certain uris like jar:...!/
-         int lastSlash = name.lastIndexOf('/');
-         if( lastSlash > 0 )
-            name = name.substring(lastSlash+1);
-      }
-      return name;
-   }
+    /**
+     * Get a physical URI for a virtual file.  See the warnings on the {@link VirtualFile#getPhysicalFile()} method
+     * before using this method.
+     *
+     * @param file the virtual file
+     *
+     * @return the physical file URL
+     *
+     * @throws IOException if an I/O error occurs getting the physical file
+     */
+    public static URI getPhysicalURI(VirtualFile file) throws IOException {
+        return file.getPhysicalFile().toURI();
+    }
 
-   /**
-    * Take a URL.getQuery string and parse it into name=value pairs
-    *
-    * @param query Possibly empty/null url query string
-    * @return String[] for the name/value pairs in the query. May be empty but never null.
-    */
-   public static Map<String, String> parseURLQuery(String query)
-   {
-	   Map<String, String> pairsMap = CollectionsFactory.createLazyMap();
-      if(query != null)
-      {
-   	   StringTokenizer tokenizer = new StringTokenizer(query, "=&");
-   	   while(tokenizer.hasMoreTokens())
-   	   {
-   		   String name = tokenizer.nextToken();
-   		   String value = tokenizer.nextToken();
-   		   pairsMap.put(name, value);
-   	   }
-      }
-	   return pairsMap;
-   }
+    /**
+     * Safely close some resource without throwing an exception.  Any exception will be logged at TRACE level.
+     *
+     * @param c the resource
+     */
+    public static void safeClose(final Closeable c) {
+        if (c != null) try {
+            c.close();
+        }
+        catch (Exception e) {
+            log.trace("Failed to close resource", e);
+        }
+    }
 
-   /**
-    * Deal with urls that may include spaces.
-    *
-    * @param url the url
-    * @return uri the uri
-    * @throws URISyntaxException for any error
-    */
-   public static URI toURI(URL url) throws URISyntaxException
-   {
-      if (url == null)
-         throw new IllegalArgumentException("Null url");
+    /**
+     * Safely close some resources without throwing an exception.  Any exception will be logged at TRACE level.
+     *
+     * @param ci the resources
+     */
+    public static void safeClose(final Iterable<? extends Closeable> ci) {
+        if (ci != null) for (Closeable closeable : ci) {
+            safeClose(closeable);
+        }
+    }
 
-      try
-      {
-         return url.toURI();
-      }
-      catch (URISyntaxException e)
-      {
-         String urispec = url.toExternalForm();
-         // Escape percent sign and spaces
-         urispec = urispec.replaceAll("%", "%25");
-         urispec = urispec.replaceAll(" ", "%20");
-         return new URI(urispec);
-      }
-   }
+    /**
+     * Safely close some resource without throwing an exception.  Any exception will be logged at TRACE level.
+     *
+     * @param zipFile the resource
+     */
+    public static void safeClose(final ZipFile zipFile) {
+        if (zipFile != null) try {
+            zipFile.close();
+        }
+        catch (Exception e) {
+            log.trace("Failed to close resource", e);
+        }
+    }
 
-   /**
-    * Ensure the url is convertible to URI by encoding spaces and percent characters if necessary
-    *
-    * @param url to be sanitized
-    * @return sanitized URL
-    * @throws URISyntaxException if URI conversion can't be fixed
-    * @throws MalformedURLException if an error occurs
-    */
-   public static URL sanitizeURL(URL url) throws URISyntaxException, MalformedURLException
-   {
-      return toURI(url).toURL();
-   }
+    /**
+     * Attempt to recursively delete a real file.
+     *
+     * @param root the real file to delete
+     *
+     * @return {@code true} if the file was deleted
+     */
+    public static boolean recursiveDelete(File root) {
+        boolean ok = true;
+        if (root.isDirectory()) {
+            final File[] files = root.listFiles();
+            for (File file : files) {
+                ok &= recursiveDelete(file);
+            }
+            return ok && (root.delete() || !root.exists());
+        } else {
+            ok &= root.delete() || !root.exists();
+        }
+        return ok;
+    }
 
-   /**
-    * Copy input stream to output stream and close them both
-    *
-    * @param is input stream
-    * @param os output stream
-    * @throws IOException for any error
-    */
-   public static void copyStreamAndClose(InputStream is, OutputStream os) throws IOException
-   {
-      copyStreamAndClose(is, os, DEFAULT_BUFFER_SIZE);
-   }
-
-   /**
-    * Copy input stream to output stream and close them both
-    *
-    * @param is input stream
-    * @param os output stream
-    * @param bufferSize the buffer size to use
-    * @throws IOException for any error
-    */
-   public static void copyStreamAndClose(InputStream is, OutputStream os, int bufferSize)
-         throws IOException
-   {
-      try
-      {
-         copyStream(is, os, bufferSize);
-         // throw an exception if the close fails since some data might be lost
-         is.close();
-         os.close();
-      }
-      finally
-      {
-         // ...but still guarantee that they're both closed
-         safeClose(is);
-         safeClose(os);
-      }
-   }
-
-   /**
-    * Copy input stream to output stream without closing streams.
-    * Flushes output stream when done.
-    *
-    * @param is input stream
-    * @param os output stream
-    * @throws IOException for any error
-    */
-   public static void copyStream(InputStream is, OutputStream os) throws IOException
-   {
-      copyStream(is, os, DEFAULT_BUFFER_SIZE);
-   }
-
-   /**
-    * Copy input stream to output stream without closing streams.
-    * Flushes output stream when done.
-    *
-    * @param is input stream
-    * @param os output stream
-    * @param bufferSize the buffer size to use
-    * @throws IOException for any error
-    */
-   public static void copyStream(InputStream is, OutputStream os, int bufferSize)
-         throws IOException
-   {
-      if (is == null)
-         throw new IllegalArgumentException("input stream is null");
-      if (os == null)
-         throw new IllegalArgumentException("output stream is null");
-      byte [] buff = new byte[bufferSize];
-      int rc;
-      while ((rc = is.read(buff)) != -1) os.write(buff, 0, rc);
-      os.flush();
-   }
-
-   /**
-    * Write the given bytes to the given virtual file, replacing its current contents (if any) or creating a new
-    * file if one does not exist.
-    *
-    * @param virtualFile the virtual file to write
-    * @param bytes the bytes
-    * @throws IOException if an error occurs
-    */
-   public static void writeFile(VirtualFile virtualFile, byte[] bytes) throws IOException
-   {
-      final File file = virtualFile.getPhysicalFile();
-      file.getParentFile().mkdirs();
-      final FileOutputStream fos = new FileOutputStream(file);
-      try {
-         fos.write(bytes);
-         fos.close();
-      } finally {
-         safeClose(fos);
-      }
-   }
-
-   /**
-    * Get the virtual URL for a virtual file.  This URL can be used to access the virtual file; however, taking the
-    * file part of the URL and attempting to use it with the {@link java.io.File} class may fail if the file is not
-    * present on the physical filesystem, and in general should not be attempted.
-    *
-    * @param file the virtual file
-    * @return the URL
-    * @throws MalformedURLException if the file cannot be coerced into a URL for some reason
-    */
-   public static URL getVirtualURL(VirtualFile file) throws MalformedURLException
-   {
-      // todo: specify the URL handler directly as a minor optimization
-      return new URL("file", "", -1, file.getPathName(true));
-   }
-
-   /**
-    * Get the virtual URI for a virtual file.
-    *
-    * @param file the virtual file
-    * @return the URI
-    * @throws URISyntaxException if the file cannot be coerced into a URI for some reason
-    */
-   public static URI getVirtualURI(VirtualFile file) throws URISyntaxException
-   {
-      return new URI("file", "", file.getPathName(true), null);
-   }
-
-   /**
-    * Get a physical URL for a virtual file.  See the warnings on the {@link VirtualFile#getPhysicalFile()} method
-    * before using this method.
-    *
-    * @param file the virtual file
-    * @return the physical file URL
-    * @throws IOException if an I/O error occurs getting the physical file
-    */
-   public static URL getPhysicalURL(VirtualFile file) throws IOException
-   {
-      return getPhysicalURI(file).toURL();
-   }
-
-   /**
-    * Get a physical URI for a virtual file.  See the warnings on the {@link VirtualFile#getPhysicalFile()} method
-    * before using this method.
-    *
-    * @param file the virtual file
-    * @return the physical file URL
-    * @throws IOException if an I/O error occurs getting the physical file
-    */
-   public static URI getPhysicalURI(VirtualFile file) throws IOException
-   {
-      return file.getPhysicalFile().toURI();
-   }
-
-   /**
-    * Safely close some resource without throwing an exception.  Any exception will be logged at TRACE level.
-    *
-    * @param c the resource
-    */
-   public static void safeClose(final Closeable c)
-   {
-      if (c != null) try {
-         c.close();
-      }
-      catch (Exception e)
-      {
-         log.trace("Failed to close resource", e);
-      }
-   }
-
-   /**
-    * Safely close some resources without throwing an exception.  Any exception will be logged at TRACE level.
-    *
-    * @param ci the resources
-    */
-   public static void safeClose(final Iterable<? extends Closeable> ci)
-   {
-      if (ci != null) for (Closeable closeable : ci)
-      {
-         safeClose(closeable);
-      }
-   }
-
-   /**
-    * Safely close some resource without throwing an exception.  Any exception will be logged at TRACE level.
-    *
-    * @param zipFile the resource
-    */
-   public static void safeClose(final ZipFile zipFile)
-   {
-      if (zipFile != null) try {
-         zipFile.close();
-      }
-      catch (Exception e)
-      {
-         log.trace("Failed to close resource", e);
-      }
-   }
-
-   /**
-    * Attempt to recursively delete a real file.
-    *
-    * @param root the real file to delete
-    * @return {@code true} if the file was deleted
-    */
-   public static boolean recursiveDelete(File root)
-   {
-      boolean ok = true;
-      if (root.isDirectory()) {
-         final File[] files = root.listFiles();
-         for (File file : files)
-         {
-            ok &= recursiveDelete(file);
-         }
-         return ok && (root.delete() || ! root.exists());
-      } else {
-         ok &= root.delete() || ! root.exists();
-      }
-      return ok;
-   }
-
-   /**
-    * Attempt to recursively delete a virtual file.
-    *
-    * @param root the virtual file to delete
-    * @return {@code true} if the file was deleted
-    */
-   public static boolean recursiveDelete(VirtualFile root) throws IOException
-   {
-      boolean ok = true;
-      if (root.isDirectory()) {
-         final List<VirtualFile> files = root.getChildren();
-         for (VirtualFile file : files)
-         {
-            ok &= recursiveDelete(file);
-         }
-         return ok && (root.delete() || ! root.exists());
-      } else {
-         ok &= root.delete() || ! root.exists();
-      }
-      return ok;
-   }
+    /**
+     * Attempt to recursively delete a virtual file.
+     *
+     * @param root the virtual file to delete
+     *
+     * @return {@code true} if the file was deleted
+     */
+    public static boolean recursiveDelete(VirtualFile root) throws IOException {
+        boolean ok = true;
+        if (root.isDirectory()) {
+            final List<VirtualFile> files = root.getChildren();
+            for (VirtualFile file : files) {
+                ok &= recursiveDelete(file);
+            }
+            return ok && (root.delete() || !root.exists());
+        } else {
+            ok &= root.delete() || !root.exists();
+        }
+        return ok;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -39,461 +39,435 @@
 import org.jboss.vfs.util.PathTokenizer;
 
 /**
- * A virtual file.  This is a symbolic reference to a location in the virtual file system hierarchy.  Holding a
- * {@code VirtualFile} instance gives no guarantees as to the presence or immutability of the referenced file or
- * any of its parent path elements.
+ * A virtual file.  This is a symbolic reference to a location in the virtual file system hierarchy.  Holding a {@code
+ * VirtualFile} instance gives no guarantees as to the presence or immutability of the referenced file or any of its
+ * parent path elements.
  *
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
  * @author Ales.Justin at jboss.org
  * @version $Revision: 44334 $
  */
-public class VirtualFile implements Serializable
-{
-   private static final long serialVersionUID = 1L;
-   private final String name;
-   private final String lcname;
-   private final VirtualFile parent;
-   private final int hashCode;
+public class VirtualFile implements Serializable {
 
-   VirtualFile(String name, VirtualFile parent)
-   {
-      this.name = name;
-      lcname = name.toLowerCase();
-      this.parent = parent;
-      int result = parent == null ? 1 : parent.hashCode();
-      result = 31 * result + name.hashCode();
-      hashCode = result;
-   }
+    private static final long serialVersionUID = 1L;
+    private final String name;
+    private final String lcname;
+    private final VirtualFile parent;
+    private final int hashCode;
 
-   /**
-    * Get the simple VF name (X.java)
-    *
-    * @return the simple file name
-    */
-   public String getName()
-   {
-      return name;
-   }
+    VirtualFile(String name, VirtualFile parent) {
+        this.name = name;
+        lcname = name.toLowerCase();
+        this.parent = parent;
+        int result = parent == null ? 1 : parent.hashCode();
+        result = 31 * result + name.hashCode();
+        hashCode = result;
+    }
 
-   /**
-    * Get the simple VF name mapped to lowercase (x.java) (used by case-insensitive filesystems like ZIP).
-    *
-    * @return the lowercase simple file name
-    */
-   public String getLowerCaseName()
-   {
-      return lcname;
-   }
+    /**
+     * Get the simple VF name (X.java)
+     *
+     * @return the simple file name
+     */
+    public String getName() {
+        return name;
+    }
 
-   /**
-    * Get the absolute VFS full path name (/xxx/yyy/foo.ear/baz.jar/org/jboss/X.java)
-    *
-    * @return the VFS full path name
-    */
-   public String getPathName()
-   {
-      return getPathName(false);
-   }
+    /**
+     * Get the simple VF name mapped to lowercase (x.java) (used by case-insensitive filesystems like ZIP).
+     *
+     * @return the lowercase simple file name
+     */
+    public String getLowerCaseName() {
+        return lcname;
+    }
 
-   /**
-    * Get the absolute VFS full path name. If this is a URL then directory entries will
-    * have a trailing slash.
-    *
-    * @param url whether or not this path is being used for a URL
-    * @return the VFS full path name
-    */
-   String getPathName(boolean url)
-   {
-      final StringBuilder builder = new StringBuilder(160);
-      final VirtualFile parent = this.parent;
-      if (parent == null) {
-         return "/";
-      } else {
-         builder.append(parent.getPathName());
-         if (parent.parent != null) {
-            builder.append('/');
-         }
-         builder.append(name);
-      }
-      // Perhaps this should be cached to avoid the fs stat call?
-      if (url && isDirectory())
-         builder.append("/");
-      return builder.toString();
-   }
+    /**
+     * Get the absolute VFS full path name (/xxx/yyy/foo.ear/baz.jar/org/jboss/X.java)
+     *
+     * @return the VFS full path name
+     */
+    public String getPathName() {
+        return getPathName(false);
+    }
 
-   /**
-    * When the file was last modified
-    *
-    * @return the last modified time
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   public long getLastModified() throws IOException
-   {
-      final VFS.Mount mount = VFS.instance.getMount(this);
-      return mount.getFileSystem().getLastModified(mount.getMountPoint(), this);
-   }
+    /**
+     * Get the absolute VFS full path name. If this is a URL then directory entries will have a trailing slash.
+     *
+     * @param url whether or not this path is being used for a URL
+     *
+     * @return the VFS full path name
+     */
+    String getPathName(boolean url) {
+        final StringBuilder builder = new StringBuilder(160);
+        final VirtualFile parent = this.parent;
+        if (parent == null) {
+            return "/";
+        } else {
+            builder.append(parent.getPathName());
+            if (parent.parent != null) {
+                builder.append('/');
+            }
+            builder.append(name);
+        }
+        // Perhaps this should be cached to avoid the fs stat call?
+        if (url && isDirectory())
+            builder.append("/");
+        return builder.toString();
+    }
 
-   /**
-    * Get the size
-    *
-    * @return the size
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   public long getSize() throws IOException
-   {
-      final VFS.Mount mount = VFS.instance.getMount(this);
-      return mount.getFileSystem().getSize(mount.getMountPoint(), this);
-   }
+    /**
+     * When the file was last modified
+     *
+     * @return the last modified time
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     */
+    public long getLastModified() throws IOException {
+        final VFS.Mount mount = VFS.instance.getMount(this);
+        return mount.getFileSystem().getLastModified(mount.getMountPoint(), this);
+    }
 
-   /**
-    * Tests whether the underlying implementation file still exists.
-    * @return true if the file exists, false otherwise.
-    * @throws IOException - thrown on failure to detect existence.
-    */
-   public boolean exists() throws IOException
-   {
-      final VFS.Mount mount = VFS.instance.getMount(this);
-      return mount.getFileSystem().exists(mount.getMountPoint(), this);
-   }
+    /**
+     * Get the size
+     *
+     * @return the size
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     */
+    public long getSize() throws IOException {
+        final VFS.Mount mount = VFS.instance.getMount(this);
+        return mount.getFileSystem().getSize(mount.getMountPoint(), this);
+    }
 
-   /**
-    * Whether it is a simple leaf of the VFS,
-    * i.e. whether it can contain other files
-    *
-    * @return true if a simple file.
-    * @throws IOException for any problem accessing the virtual file system
-    * @deprecated use {@link #isDirectory()} instead
-    */
-   @Deprecated
-   public boolean isLeaf() throws IOException
-   {
-      return ! isDirectory();
-   }
+    /**
+     * Tests whether the underlying implementation file still exists.
+     *
+     * @return true if the file exists, false otherwise.
+     *
+     * @throws IOException - thrown on failure to detect existence.
+     */
+    public boolean exists() throws IOException {
+        final VFS.Mount mount = VFS.instance.getMount(this);
+        return mount.getFileSystem().exists(mount.getMountPoint(), this);
+    }
 
-   /**
-    * Determine whether the named virtual file is a directory.
-    *
-    * @return {@code true} if it is a directory, {@code false} otherwise
-    * @throws IOException if an I/O error occurs
-    */
-   public boolean isDirectory()
-   {
-      final VFS.Mount mount = VFS.instance.getMount(this);
-      return mount.getFileSystem().isDirectory(mount.getMountPoint(), this);
-   }
+    /**
+     * Whether it is a simple leaf of the VFS, i.e. whether it can contain other files
+     *
+     * @return true if a simple file.
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     * @deprecated use {@link #isDirectory()} instead
+     */
+    @Deprecated
+    public boolean isLeaf() throws IOException {
+        return !isDirectory();
+    }
 
-   /**
-    * Access the file contents.
-    *
-    * @return an InputStream for the file contents.
-    * @throws IOException for any error accessing the file system
-    */
-   public InputStream openStream() throws IOException
-   {
-      final VFS.Mount mount = VFS.instance.getMount(this);
-      return mount.getFileSystem().openInputStream(mount.getMountPoint(), this);
-   }
+    /**
+     * Determine whether the named virtual file is a directory.
+     *
+     * @return {@code true} if it is a directory, {@code false} otherwise
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    public boolean isDirectory() {
+        final VFS.Mount mount = VFS.instance.getMount(this);
+        return mount.getFileSystem().isDirectory(mount.getMountPoint(), this);
+    }
 
-   /**
-    * Delete this virtual file
-    *
-    * @return true if file was deleted
-    * @throws IOException if an error occurs
-    */
-   public boolean delete() throws IOException
-   {
-      final VFS.Mount mount = VFS.instance.getMount(this);
-      return mount.getFileSystem().delete(mount.getMountPoint(), this);
-   }
+    /**
+     * Access the file contents.
+     *
+     * @return an InputStream for the file contents.
+     *
+     * @throws IOException for any error accessing the file system
+     */
+    public InputStream openStream() throws IOException {
+        final VFS.Mount mount = VFS.instance.getMount(this);
+        return mount.getFileSystem().openInputStream(mount.getMountPoint(), this);
+    }
 
-   /**
-    * Get a physical file for this virtual file.  Depending on the underlying file system type, this may simply return
-    * an already-existing file; it may create a copy of a file; or it may reuse a preexisting copy of the file.  Furthermore,
-    * the retured file may or may not have any relationship to other files from the same or any other virtual
-    * directory.
-    *
-    * @return the physical file
-    * @throws IOException if an I/O error occurs while producing the physical file
-    */
-   public File getPhysicalFile() throws IOException
-   {
-      final VFS.Mount mount = VFS.instance.getMount(this);
-      return mount.getFileSystem().getFile(mount.getMountPoint(), this);
-   }
+    /**
+     * Delete this virtual file
+     *
+     * @return true if file was deleted
+     *
+     * @throws IOException if an error occurs
+     */
+    public boolean delete() throws IOException {
+        final VFS.Mount mount = VFS.instance.getMount(this);
+        return mount.getFileSystem().delete(mount.getMountPoint(), this);
+    }
 
-   /**
-    * Get the VFS instance for this virtual file
-    *
-    * @return the VFS
-    */
-   public VFS getVFS()
-   {
-      return VFS.instance;
-   }
+    /**
+     * Get a physical file for this virtual file.  Depending on the underlying file system type, this may simply return
+     * an already-existing file; it may create a copy of a file; or it may reuse a preexisting copy of the file.
+     * Furthermore, the retured file may or may not have any relationship to other files from the same or any other
+     * virtual directory.
+     *
+     * @return the physical file
+     *
+     * @throws IOException if an I/O error occurs while producing the physical file
+     */
+    public File getPhysicalFile() throws IOException {
+        final VFS.Mount mount = VFS.instance.getMount(this);
+        return mount.getFileSystem().getFile(mount.getMountPoint(), this);
+    }
 
-   /**
-    * Get a {@code VirtualFile} which represents the parent of this instance.
-    *
-    * @return the parent or {@code null} if there is no parent
-    */
-   public VirtualFile getParent()
-   {
-      return parent;
-   }
+    /**
+     * Get the VFS instance for this virtual file
+     *
+     * @return the VFS
+     */
+    public VFS getVFS() {
+        return VFS.instance;
+    }
 
-   /**
-    * Get the all the parent files of this virtual file from this file to the root.  The leafmost file will be at
-    * the start of the array, and the rootmost will be at the end.
-    *
-    * @return the array of parent files
-    */
-   public VirtualFile[] getParentFiles() {
-      return getParentFiles(0);
-   }
+    /**
+     * Get a {@code VirtualFile} which represents the parent of this instance.
+     *
+     * @return the parent or {@code null} if there is no parent
+     */
+    public VirtualFile getParent() {
+        return parent;
+    }
 
-   /**
-    * Get the all the parent files of this virtual file from this file to the root as a list.  The leafmost file will be at
-    * the start of the list, and the rootmost will be at the end.
-    *
-    * @return the list of parent files
-    */
-   public List<VirtualFile> getParentFileList() {
-      return Arrays.asList(getParentFiles());
-   }
+    /**
+     * Get the all the parent files of this virtual file from this file to the root.  The leafmost file will be at the
+     * start of the array, and the rootmost will be at the end.
+     *
+     * @return the array of parent files
+     */
+    public VirtualFile[] getParentFiles() {
+        return getParentFiles(0);
+    }
 
-   private VirtualFile[] getParentFiles(int idx) {
-      final VirtualFile[] array;
-      if (parent == null) {
-         array = new VirtualFile[idx + 1];
-      } else {
-         array = parent.getParentFiles(idx + 1);
-      }
-      array[idx] = this;
-      return array;
-   }
+    /**
+     * Get the all the parent files of this virtual file from this file to the root as a list.  The leafmost file will be
+     * at the start of the list, and the rootmost will be at the end.
+     *
+     * @return the list of parent files
+     */
+    public List<VirtualFile> getParentFileList() {
+        return Arrays.asList(getParentFiles());
+    }
 
-   /**
-    * Get the children.  This is the combined list of real children within this directory, as well as virtual
-    * children created by submounts.
-    *
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   public List<VirtualFile> getChildren() throws IOException
-   {
-      if (! isDirectory())
-         return Collections.emptyList();
+    private VirtualFile[] getParentFiles(int idx) {
+        final VirtualFile[] array;
+        if (parent == null) {
+            array = new VirtualFile[idx + 1];
+        } else {
+            array = parent.getParentFiles(idx + 1);
+        }
+        array[idx] = this;
+        return array;
+    }
 
-      VFS vfs = VFS.instance;
-      final VFS.Mount mount = vfs.getMount(this);
-      final Set<String> submounts = vfs.getSubmounts(this);
-      final List<String> names = mount.getFileSystem().getDirectoryEntries(mount.getMountPoint(), this);
-      final List<VirtualFile> virtualFiles = new ArrayList<VirtualFile>(names.size() + submounts.size());
-      for (String name : names)
-      {
-         final VirtualFile child = new VirtualFile(name, this);
-         virtualFiles.add(child);
-         submounts.remove(name);
-      }
-      return virtualFiles;
-   }
+    /**
+     * Get the children.  This is the combined list of real children within this directory, as well as virtual children
+     * created by submounts.
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     */
+    public List<VirtualFile> getChildren() throws IOException {
+        if (!isDirectory())
+            return Collections.emptyList();
+        VFS vfs = VFS.instance;
+        final VFS.Mount mount = vfs.getMount(this);
+        final Set<String> submounts = vfs.getSubmounts(this);
+        final List<String> names = mount.getFileSystem().getDirectoryEntries(mount.getMountPoint(), this);
+        final List<VirtualFile> virtualFiles = new ArrayList<VirtualFile>(names.size() + submounts.size());
+        for (String name : names) {
+            final VirtualFile child = new VirtualFile(name, this);
+            virtualFiles.add(child);
+            submounts.remove(name);
+        }
+        return virtualFiles;
+    }
 
-   /**
-    * Get the children
-    *
-    * @param filter to filter the children
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed or it is a leaf node
-    */
-   public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException
-   {
-      if (! isDirectory())
-         return Collections.emptyList();
+    /**
+     * Get the children
+     *
+     * @param filter to filter the children
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     * @throws IllegalStateException if the file is closed or it is a leaf node
+     */
+    public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException {
+        if (!isDirectory())
+            return Collections.emptyList();
+        if (filter == null)
+            filter = MatchAllVirtualFileFilter.INSTANCE;
+        FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, null);
+        visit(visitor);
+        return visitor.getMatched();
+    }
 
-      if (filter == null)
-         filter = MatchAllVirtualFileFilter.INSTANCE;
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, null);
-      visit(visitor);
-      return visitor.getMatched();
-   }
+    /**
+     * Get all the children recursively<p>
+     * <p/>
+     * This always uses {@link VisitorAttributes#RECURSE}
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     * @throws IllegalStateException if the file is closed
+     */
+    public List<VirtualFile> getChildrenRecursively() throws IOException {
+        return getChildrenRecursively(null);
+    }
 
-   /**
-    * Get all the children recursively<p>
-    *
-    * This always uses {@link VisitorAttributes#RECURSE}
-    *
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed
-    */
-   public List<VirtualFile> getChildrenRecursively() throws IOException
-   {
-      return getChildrenRecursively(null);
-   }
+    /**
+     * Get all the children recursively<p>
+     * <p/>
+     * This always uses {@link VisitorAttributes#RECURSE}
+     *
+     * @param filter to filter the children
+     *
+     * @return the children
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     * @throws IllegalStateException if the file is closed or it is a leaf node
+     */
+    public List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException {
+        if (!isDirectory())
+            return Collections.emptyList();
+        if (filter == null)
+            filter = MatchAllVirtualFileFilter.INSTANCE;
+        FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, VisitorAttributes.RECURSE);
+        visit(visitor);
+        return visitor.getMatched();
+    }
 
-   /**
-    * Get all the children recursively<p>
-    *
-    * This always uses {@link VisitorAttributes#RECURSE}
-    *
-    * @param filter to filter the children
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed or it is a leaf node
-    */
-   public List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException
-   {
-      if (! isDirectory())
-         return Collections.emptyList();
+    /**
+     * Visit the virtual file system
+     *
+     * @param visitor the visitor
+     *
+     * @throws IOException for any problem accessing the virtual file system
+     * @throws IllegalArgumentException if the visitor is null
+     * @throws IllegalStateException if the file is closed
+     */
+    public void visit(VirtualFileVisitor visitor) throws IOException {
+        visit(visitor, true);
+    }
 
-      if (filter == null)
-         filter = MatchAllVirtualFileFilter.INSTANCE;
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, VisitorAttributes.RECURSE);
-      visit(visitor);
-      return visitor.getMatched();
-   }
+    private void visit(VirtualFileVisitor visitor, boolean root) throws IOException {
+        final VisitorAttributes visitorAttributes = visitor.getAttributes();
+        if (root && visitorAttributes.isIncludeRoot())
+            visitor.visit(this);
+        if (!isDirectory())
+            return;
+        for (VirtualFile child : getChildren()) {
+            // Always visit a leaf, and visit directories when leaves only is false
+            if (!child.isDirectory() || !visitorAttributes.isLeavesOnly())
+                visitor.visit(child);
+            if (child.isDirectory() && visitorAttributes.isRecurse(child))
+                child.visit(visitor, false);
+        }
+    }
 
-   /**
-    * Visit the virtual file system
-    *
-    * @param visitor the visitor
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalArgumentException if the visitor is null
-    * @throws IllegalStateException if the file is closed
-    */
-   public void visit(VirtualFileVisitor visitor) throws IOException
-   {
-      visit(visitor, true);
-   }
+    /**
+     * Get a child virtual file.
+     *
+     * @param path the path
+     *
+     * @return the child or {@code null} if not found
+     *
+     * @throws IllegalArgumentException if the path is null
+     */
+    public VirtualFile getChild(String path) {
+        if (path == null)
+            throw new IllegalArgumentException("Null path");
+        final List<String> pathParts = PathTokenizer.getTokens(path);
+        VirtualFile current = this;
+        for (String part : pathParts) {
+            if (PathTokenizer.isReverseToken(part)) {
+                final VirtualFile parent = current.parent;
+                current = parent == null ? current : parent;
+            } else if (PathTokenizer.isCurrentToken(part) == false) {
+                current = new VirtualFile(part, current);
+            }
+        }
+        try {
+            if (current.exists())
+                return current;
+        }
+        catch (IOException e) {
+            // Fall-through
+        }
+        return null;
+    }
 
-   private void visit(VirtualFileVisitor visitor, boolean root) throws IOException
-   {
-      final VisitorAttributes visitorAttributes = visitor.getAttributes();
+    /**
+     * Get file's URL.
+     *
+     * @return the url
+     *
+     * @throws IOException for any io error
+     */
+    public URL toURL() throws IOException {
+        return VFSUtils.getVirtualURL(this);
+    }
 
-      if (root && visitorAttributes.isIncludeRoot())
-         visitor.visit(this);
+    /**
+     * Get file's URI.
+     *
+     * @return the uri
+     *
+     * @throws URISyntaxException for any error
+     */
+    public URI toURI() throws URISyntaxException {
+        return VFSUtils.getVirtualURI(this);
+    }
 
-      if (! isDirectory())
-         return;
+    /**
+     * Get a human-readable (but non-canonical) representation of this virtual file.
+     *
+     * @return the string
+     */
+    public String toString() {
+        return "Virtual file \"" + getPathName() + "\" for " + VFS.instance;
+    }
 
-      for (VirtualFile child : getChildren())
-      {
-         // Always visit a leaf, and visit directories when leaves only is false
-         if (!child.isDirectory() || !visitorAttributes.isLeavesOnly())
-            visitor.visit(child);
+    /**
+     * Determine whether the given object is equal to this one.  Returns true if the argument is a {@code VirtualFile}
+     * from the same {@code VFS} instance with the same name.
+     *
+     * @param o the other object
+     *
+     * @return {@code true} if they are equal
+     */
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (!(o instanceof VirtualFile))
+            return false;
+        VirtualFile that = (VirtualFile) o;
+        if (hashCode != that.hashCode)
+            return false;
+        if (!name.equals(that.name))
+            return false;
+        final VirtualFile parent = this.parent;
+        if (parent == null)
+            return that.parent == null;
+        else
+            return parent.equals(that.parent);
+    }
 
-         if (child.isDirectory() && visitorAttributes.isRecurse(child))
-            child.visit(visitor, false);
-      }
-   }
-
-   /**
-    * Get a child virtual file.
-    *
-    * @param path the path
-    * @return the child or {@code null} if not found
-    * @throws IllegalArgumentException if the path is null
-    */
-   public VirtualFile getChild(String path)
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-
-      VFS vfs = VFS.instance;
-
-      final List<String> pathParts = PathTokenizer.getTokens(path);
-      VirtualFile current = this;
-      for (String part : pathParts)
-      {
-         if (PathTokenizer.isReverseToken(part))
-         {
-            final VirtualFile parent = current.parent;
-            current = parent == null ? current : parent;
-         }
-         else if (PathTokenizer.isCurrentToken(part) == false)
-         {
-            current = new VirtualFile(part, current);
-         }
-      }
-      try
-      {
-         if (current.exists())
-            return current;
-      }
-      catch (IOException e)
-      {
-         // Fall-through
-      }
-
-      return null;
-   }
-
-   /**
-    * Get file's URL.
-    *
-    * @return the url
-    * @throws IOException for any io error
-    */
-   public URL toURL() throws IOException
-   {
-      return VFSUtils.getVirtualURL(this);
-   }
-
-   /**
-    * Get file's URI.
-    *
-    * @return the uri
-    * @throws URISyntaxException for any error
-    */
-   public URI toURI() throws URISyntaxException
-   {
-      return VFSUtils.getVirtualURI(this);
-   }
-
-   /**
-    * Get a human-readable (but non-canonical) representation of this virtual file.
-    *
-    * @return the string
-    */
-   public String toString()
-   {
-      return "Virtual file \"" + getPathName() + "\" for " + VFS.instance;
-   }
-
-   /**
-    * Determine whether the given object is equal to this one.  Returns true if the argument is a {@code VirtualFile}
-    * from the same {@code VFS} instance with the same name.
-    *
-    * @param o the other object
-    * @return {@code true} if they are equal
-    */
-   public boolean equals(Object o)
-   {
-      if (this == o)
-         return true;
-      if (! (o instanceof VirtualFile))
-         return false;
-      VirtualFile that = (VirtualFile) o;
-      if (hashCode != that.hashCode)
-         return false;
-      if (! name.equals(that.name))
-         return false;
-      final VirtualFile parent = this.parent;
-      if (parent == null)
-         return that.parent == null;
-      else
-         return parent.equals(that.parent);
-   }
-
-   /**
-    * Get a hashcode for this virtual file.
-    *
-    * @return the hash code
-    */
-   public int hashCode()
-   {
-      return hashCode;
-   }
+    /**
+     * Get a hashcode for this virtual file.
+     *
+     * @return the hash code
+     */
+    public int hashCode() {
+        return hashCode;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilter.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilter.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilter.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -28,13 +28,14 @@
  * @author adrian at jboss.org
  * @version $Revision: 44334 $
  */
-public interface VirtualFileFilter
-{
-   /**
-    * Match the virtual file
-    * 
-    * @param file the virtual file
-    * @return true when it matches
-    */
-   boolean accepts(VirtualFile file);
+public interface VirtualFileFilter {
+
+    /**
+     * Match the virtual file
+     *
+     * @param file the virtual file
+     *
+     * @return true when it matches
+     */
+    boolean accepts(VirtualFile file);
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilterWithAttributes.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilterWithAttributes.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileFilterWithAttributes.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -27,12 +27,12 @@
  * @author adrian at jboss.org
  * @version $Revision: 44334 $
  */
-public interface VirtualFileFilterWithAttributes extends VirtualFileFilter
-{
-   /**
-    * Get the attributes for this filter
-    * 
-    * @return the attributes
-    */
-   VisitorAttributes getAttributes();
+public interface VirtualFileFilterWithAttributes extends VirtualFileFilter {
+
+    /**
+     * Get the attributes for this filter
+     *
+     * @return the attributes
+     */
+    VisitorAttributes getAttributes();
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileVisitor.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileVisitor.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileVisitor.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -23,23 +23,23 @@
 
 /**
  * Visits a virtual file and its children
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
-public interface VirtualFileVisitor
-{
-   /**
-    * Get the search attribues for this visitor
-    * 
-    * @return the attributes
-    */
-   VisitorAttributes getAttributes();
-   
-   /**
-    * Visit a virtual file
-    * 
-    * @param virtualFile the virtual file being visited
-    */
-   void visit(VirtualFile virtualFile);
+public interface VirtualFileVisitor {
+
+    /**
+     * Get the search attribues for this visitor
+     *
+     * @return the attributes
+     */
+    VisitorAttributes getAttributes();
+
+    /**
+     * Visit a virtual file
+     *
+     * @param virtualFile the virtual file being visited
+     */
+    void visit(VirtualFile virtualFile);
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VisitorAttributes.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VisitorAttributes.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VisitorAttributes.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -23,231 +23,240 @@
 
 /**
  * Attributes used when visiting a virtual file system
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @author Scott.Stark at jboss.org
  * @version $Revision: 1.1 $
  */
-public class VisitorAttributes
-{
-   /** A VirtualFileFilter than accepts any file */
-   public static final AcceptAnyFilter RECURSE_ALL = new AcceptAnyFilter();
+public class VisitorAttributes {
 
-   /** The default attributes - visit leaves and non-leaves, no recursion, no root */
-   public static final VisitorAttributes DEFAULT = new ImmutableVisitorAttributes();
+    /**
+     * A VirtualFileFilter than accepts any file
+     */
+    public static final AcceptAnyFilter RECURSE_ALL = new AcceptAnyFilter();
 
-   /** Visit leaves only and do not recurse non-leaf files */
-   public static final VisitorAttributes LEAVES_ONLY = new ImmutableVisitorAttributes(true, null);
+    /**
+     * The default attributes - visit leaves and non-leaves, no recursion, no root
+     */
+    public static final VisitorAttributes DEFAULT = new ImmutableVisitorAttributes();
 
-   /** Recurse and visit all non-leaf files */
-   public static final VisitorAttributes RECURSE = new ImmutableVisitorAttributes(false, RECURSE_ALL);
+    /**
+     * Visit leaves only and do not recurse non-leaf files
+     */
+    public static final VisitorAttributes LEAVES_ONLY = new ImmutableVisitorAttributes(true, null);
 
-   /** Recurse all non-leaf files but only visit leaves */
-   public static final VisitorAttributes RECURSE_LEAVES_ONLY = new ImmutableVisitorAttributes(true, RECURSE_ALL);
-   
-   /** Whether to include the root */
-   private boolean includeRoot;
+    /**
+     * Recurse and visit all non-leaf files
+     */
+    public static final VisitorAttributes RECURSE = new ImmutableVisitorAttributes(false, RECURSE_ALL);
 
-   /** Whether to only visit leaves */
-   private boolean leavesOnly;
+    /**
+     * Recurse all non-leaf files but only visit leaves
+     */
+    public static final VisitorAttributes RECURSE_LEAVES_ONLY = new ImmutableVisitorAttributes(true, RECURSE_ALL);
 
-   /** Whether to ignore individual file errors */
-   private boolean ignoreErrors;
+    /**
+     * Whether to include the root
+     */
+    private boolean includeRoot;
 
-   /** Whether to include hidden files */
-   private boolean includeHidden;
+    /**
+     * Whether to only visit leaves
+     */
+    private boolean leavesOnly;
 
-   /** A filter used to control whether a non-leaf is recursive visited */
-   private VirtualFileFilter recurseFilter;
+    /**
+     * Whether to ignore individual file errors
+     */
+    private boolean ignoreErrors;
 
-   /**
-    * Whether to visit leaves only<p>
-    * 
-    * Default: false
-    * 
-    * @return the visit leaves only.
-    */
-   public boolean isLeavesOnly()
-   {
-      return leavesOnly;
-   }
+    /**
+     * Whether to include hidden files
+     */
+    private boolean includeHidden;
 
-   /**
-    * Set the leaves only.
-    * 
-    * @param leavesOnly the leaves only
-    * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
-    */
-   public void setLeavesOnly(boolean leavesOnly)
-   {
-      this.leavesOnly = leavesOnly;
-   }
+    /**
+     * A filter used to control whether a non-leaf is recursive visited
+     */
+    private VirtualFileFilter recurseFilter;
 
-   /**
-    * Whether to recurse into the non-leaf file<p>. If there is a recurse
-    * filter then the result will by its accepts(file) value.
-    * 
-    * Default: false
-    * 
-    * @param file the file
-    * @return the recurse flag.
-    */
-   public boolean isRecurse(VirtualFile file)
-   {
-      boolean recurse = false;
-      if( recurseFilter != null )
-         recurse = recurseFilter.accepts(file);
-      return recurse;
-   }
+    /**
+     * Whether to visit leaves only<p>
+     * <p/>
+     * Default: false
+     *
+     * @return the visit leaves only.
+     */
+    public boolean isLeavesOnly() {
+        return leavesOnly;
+    }
 
-   /**
-    * Get the recurse filter.
-    * @return the current recurse filter.
-    */
-   public VirtualFileFilter getRecurseFilter()
-   {
-      return recurseFilter;
-   }
+    /**
+     * Set the leaves only.
+     *
+     * @param leavesOnly the leaves only
+     *
+     * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
+     */
+    public void setLeavesOnly(boolean leavesOnly) {
+        this.leavesOnly = leavesOnly;
+    }
 
-   /**
-    * Set the recurse filter.
-    * 
-    * @param filter - the recurse filter.
-    * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
-    */
-   public void setRecurseFilter(VirtualFileFilter filter)
-   {
-      this.recurseFilter = filter;
-   }
+    /**
+     * Whether to recurse into the non-leaf file<p>. If there is a recurse filter then the result will by its
+     * accepts(file) value.
+     * <p/>
+     * Default: false
+     *
+     * @param file the file
+     *
+     * @return the recurse flag.
+     */
+    public boolean isRecurse(VirtualFile file) {
+        boolean recurse = false;
+        if (recurseFilter != null)
+            recurse = recurseFilter.accepts(file);
+        return recurse;
+    }
 
-   /**
-    * Whether to include the root of the visit<p>
-    * 
-    * Default: false
-    * 
-    * @return the includeRoot.
-    */
-   public boolean isIncludeRoot()
-   {
-      return includeRoot;
-   }
+    /**
+     * Get the recurse filter.
+     *
+     * @return the current recurse filter.
+     */
+    public VirtualFileFilter getRecurseFilter() {
+        return recurseFilter;
+    }
 
-   /**
-    * Set the includeRoot.
-    * 
-    * @param includeRoot the includeRoot.
-    * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
-    */
-   public void setIncludeRoot(boolean includeRoot)
-   {
-      this.includeRoot = includeRoot;
-   }
+    /**
+     * Set the recurse filter.
+     *
+     * @param filter - the recurse filter.
+     *
+     * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
+     */
+    public void setRecurseFilter(VirtualFileFilter filter) {
+        recurseFilter = filter;
+    }
 
-   /**
-    * Whether to ignore individual errors<p>
-    * 
-    * Default: false
-    * 
-    * @return the ignoreErrors.
-    */
-   public boolean isIgnoreErrors()
-   {
-      return ignoreErrors;
-   }
+    /**
+     * Whether to include the root of the visit<p>
+     * <p/>
+     * Default: false
+     *
+     * @return the includeRoot.
+     */
+    public boolean isIncludeRoot() {
+        return includeRoot;
+    }
 
-   /**
-    * Set the ignoreErrors.
-    * 
-    * @param ignoreErrors the ignoreErrors.
-    * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
-    */
-   public void setIgnoreErrors(boolean ignoreErrors)
-   {
-      this.ignoreErrors = ignoreErrors;
-   }
+    /**
+     * Set the includeRoot.
+     *
+     * @param includeRoot the includeRoot.
+     *
+     * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
+     */
+    public void setIncludeRoot(boolean includeRoot) {
+        this.includeRoot = includeRoot;
+    }
 
-   /**
-    * Whether to include hidden files<p>
-    * 
-    * Default: false
-    * 
-    * @return the includeHidden.
-    */
-   public boolean isIncludeHidden()
-   {
-      return includeHidden;
-   }
+    /**
+     * Whether to ignore individual errors<p>
+     * <p/>
+     * Default: false
+     *
+     * @return the ignoreErrors.
+     */
+    public boolean isIgnoreErrors() {
+        return ignoreErrors;
+    }
 
-   /**
-    * Set the includeHidden.
-    * 
-    * @param includeHidden the includeHidden.
-    * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
-    */
-   public void setIncludeHidden(boolean includeHidden)
-   {
-      this.includeHidden = includeHidden;
-   }
+    /**
+     * Set the ignoreErrors.
+     *
+     * @param ignoreErrors the ignoreErrors.
+     *
+     * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
+     */
+    public void setIgnoreErrors(boolean ignoreErrors) {
+        this.ignoreErrors = ignoreErrors;
+    }
 
-   private static class AcceptAnyFilter implements VirtualFileFilter
-   {
-      public boolean accepts(VirtualFile file)
-      {
-         return true;
-      }      
-   }
-   /**
-    * Immutable version of the attribues
-    */
-   private static class ImmutableVisitorAttributes extends VisitorAttributes
-   {
-      /**
-       * Create a new ImmutableVirtualFileVisitorAttributes with default values
-       */
-      public ImmutableVisitorAttributes()
-      {
-      }
-      
-      /**
-       * Create a new ImmutableVirtualFileVisitorAttributes.
-       * 
-       * @param leavesOnly whether to visit leaves only 
-       * @param recurseFilter - filter which controls whether to recurse
-       */
-      public ImmutableVisitorAttributes(boolean leavesOnly, VirtualFileFilter recurseFilter)
-      {
-         super.setLeavesOnly(leavesOnly);
-         super.setRecurseFilter(recurseFilter);
-      }
-      
-      @Override
-      public void setLeavesOnly(boolean leavesOnly)
-      {
-         throw new IllegalStateException("The preconfigured attributes are immutable");
-      }
+    /**
+     * Whether to include hidden files<p>
+     * <p/>
+     * Default: false
+     *
+     * @return the includeHidden.
+     */
+    public boolean isIncludeHidden() {
+        return includeHidden;
+    }
 
-      @Override
-      public void setIncludeRoot(boolean includeRoot)
-      {
-         throw new IllegalStateException("The preconfigured attributes are immutable");
-      }
+    /**
+     * Set the includeHidden.
+     *
+     * @param includeHidden the includeHidden.
+     *
+     * @throws IllegalStateException if you attempt to modify one of the preconfigured static values of this class
+     */
+    public void setIncludeHidden(boolean includeHidden) {
+        this.includeHidden = includeHidden;
+    }
 
-      @Override
-      public void setRecurseFilter(VirtualFileFilter filter)
-      {
-         throw new IllegalStateException("The preconfigured attributes are immutable");
-      }
+    private static class AcceptAnyFilter implements VirtualFileFilter {
 
-      @Override
-      public void setIgnoreErrors(boolean ignoreErrors)
-      {
-         throw new IllegalStateException("The preconfigured attributes are immutable");
-      }
+        public boolean accepts(VirtualFile file) {
+            return true;
+        }
+    }
 
-      @Override
-      public void setIncludeHidden(boolean includeHidden)
-      {
-         throw new IllegalStateException("The preconfigured attributes are immutable");
-      }
-   }
+    /**
+     * Immutable version of the attribues
+     */
+    private static class ImmutableVisitorAttributes extends VisitorAttributes {
+
+        /**
+         * Create a new ImmutableVirtualFileVisitorAttributes with default values
+         */
+        public ImmutableVisitorAttributes() {
+        }
+
+        /**
+         * Create a new ImmutableVirtualFileVisitorAttributes.
+         *
+         * @param leavesOnly whether to visit leaves only
+         * @param recurseFilter - filter which controls whether to recurse
+         */
+        public ImmutableVisitorAttributes(boolean leavesOnly, VirtualFileFilter recurseFilter) {
+            super.setLeavesOnly(leavesOnly);
+            super.setRecurseFilter(recurseFilter);
+        }
+
+        @Override
+        public void setLeavesOnly(boolean leavesOnly) {
+            throw new IllegalStateException("The preconfigured attributes are immutable");
+        }
+
+        @Override
+        public void setIncludeRoot(boolean includeRoot) {
+            throw new IllegalStateException("The preconfigured attributes are immutable");
+        }
+
+        @Override
+        public void setRecurseFilter(VirtualFileFilter filter) {
+            throw new IllegalStateException("The preconfigured attributes are immutable");
+        }
+
+        @Override
+        public void setIgnoreErrors(boolean ignoreErrors) {
+            throw new IllegalStateException("The preconfigured attributes are immutable");
+        }
+
+        @Override
+        public void setIncludeHidden(boolean includeHidden) {
+            throw new IllegalStateException("The preconfigured attributes are immutable");
+        }
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -41,62 +41,50 @@
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
-class VirtualFileURLConnection extends URLConnection
-{
-   protected VirtualFile file;
+class VirtualFileURLConnection extends URLConnection {
 
-   public VirtualFileURLConnection(URL url) throws IOException
-   {
-      super(url);
-      file = VFS.getInstance().getChild(URLDecoder.decode(url.getPath(), "UTF-8"));
-   }
+    protected VirtualFile file;
 
-   public void connect() throws IOException
-   {
-   }
+    public VirtualFileURLConnection(URL url) throws IOException {
+        super(url);
+        file = VFS.getInstance().getChild(URLDecoder.decode(url.getPath(), "UTF-8"));
+    }
 
-   public VirtualFile getContent() throws IOException
-   {
-      return file;
-   }
+    public void connect() throws IOException {
+    }
 
-   public int getContentLength()
-   {
-      try
-      {
-         final long size = file.getSize();
-         return size > (long)Integer.MAX_VALUE ? -1 : (int)size;
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
+    public VirtualFile getContent() throws IOException {
+        return file;
+    }
 
-   public long getLastModified()
-   {
-      try
-      {
-         return file.getLastModified();
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
+    public int getContentLength() {
+        try {
+            final long size = file.getSize();
+            return size > (long) Integer.MAX_VALUE ? -1 : (int) size;
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 
-   public InputStream getInputStream() throws IOException
-   {
-      return file.openStream();
-   }
+    public long getLastModified() {
+        try {
+            return file.getLastModified();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 
-   public Permission getPermission() throws IOException {
-      String decodedPath = ParseUtil.decode(url.getPath());
-      if (File.separatorChar == '/') {
-         return new FilePermission(decodedPath, "read");
-      } else {
-         return new FilePermission(
-               decodedPath.replace('/',File.separatorChar), "read");
-      }
-   }
+    public InputStream getInputStream() throws IOException {
+        return file.openStream();
+    }
+
+    public Permission getPermission() throws IOException {
+        String decodedPath = ParseUtil.decode(url.getPath());
+        if (File.separatorChar == '/') {
+            return new FilePermission(decodedPath, "read");
+        } else {
+            return new FilePermission(
+                    decodedPath.replace('/', File.separatorChar), "read");
+        }
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -33,42 +33,37 @@
 /**
  * The VFS URL stream handler.
  */
-public abstract class VirtualFileURLStreamHandler extends URLStreamHandler
-{
-   private static final Set<String> locals;
+public abstract class VirtualFileURLStreamHandler extends URLStreamHandler {
 
-   static {
-      Set<String> set = new HashSet<String>();
-      set.add(null);
-      set.add("");
-      set.add("~");
-      set.add("localhost");
-      locals = set;
-   }
+    private static final Set<String> locals;
 
-   protected URLConnection openConnection(URL u) throws IOException
-   {
-      if (locals.contains(toLower(u.getHost())))
-      {
-         // the URL is a valid local URL
-         return new VirtualFileURLConnection(u);
-      }
+    static {
+        Set<String> set = new HashSet<String>();
+        set.add(null);
+        set.add("");
+        set.add("~");
+        set.add("localhost");
+        locals = set;
+    }
 
-      throw new IOException("Remote host access not supported for URLs of type \"" + u.getProtocol() + "\"");
-   }
+    protected URLConnection openConnection(URL u) throws IOException {
+        if (locals.contains(toLower(u.getHost()))) {
+            // the URL is a valid local URL
+            return new VirtualFileURLConnection(u);
+        }
+        throw new IOException("Remote host access not supported for URLs of type \"" + u.getProtocol() + "\"");
+    }
 
-   protected URLConnection openConnection(URL u, Proxy p) throws IOException
-   {
-      return openConnection(u);
-   }
+    protected URLConnection openConnection(URL u, Proxy p) throws IOException {
+        return openConnection(u);
+    }
 
-   @Override
-   protected boolean hostsEqual(URL url1, URL url2)
-   {
-      return locals.contains(toLower(url1.getHost())) && locals.contains(toLower(url2.getHost())) || super.hostsEqual(url1, url2);
-   }
+    @Override
+    protected boolean hostsEqual(URL url1, URL url2) {
+        return locals.contains(toLower(url1.getHost())) && locals.contains(toLower(url2.getHost())) || super.hostsEqual(url1, url2);
+    }
 
-   private static String toLower(String str) {
-      return str == null ? null : str.toLowerCase();
-   }
+    private static String toLower(String str) {
+        return str == null ? null : str.toLowerCase();
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/file/Handler.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/file/Handler.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/file/Handler.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -27,6 +27,6 @@
 /**
  * Stub handler class.
  */
-public final class Handler extends VirtualFileURLStreamHandler
-{
+public final class Handler extends VirtualFileURLStreamHandler {
+
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterable.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterable.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterable.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -25,17 +25,15 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 
-class EnumerationIterable<T> implements Iterable<T>
-{
-   private final Enumeration<T> entries;
+class EnumerationIterable<T> implements Iterable<T> {
 
-   public EnumerationIterable(Enumeration<T> entries)
-   {
-      this.entries = entries;
-   }
+    private final Enumeration<T> entries;
 
-   public Iterator<T> iterator()
-   {
-      return new EnumerationIterator<T>(entries);
-   }
+    public EnumerationIterable(Enumeration<T> entries) {
+        this.entries = entries;
+    }
+
+    public Iterator<T> iterator() {
+        return new EnumerationIterator<T>(entries);
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterator.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterator.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/EnumerationIterator.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -25,27 +25,23 @@
 import java.util.Iterator;
 import java.util.Enumeration;
 
-class EnumerationIterator<T> implements Iterator<T>
-{
-   private final Enumeration<T> entries;
+class EnumerationIterator<T> implements Iterator<T> {
 
-   public EnumerationIterator(Enumeration<T> entries)
-   {
-      this.entries = entries;
-   }
+    private final Enumeration<T> entries;
 
-   public boolean hasNext()
-   {
-      return entries.hasMoreElements();
-   }
+    public EnumerationIterator(Enumeration<T> entries) {
+        this.entries = entries;
+    }
 
-   public T next()
-   {
-      return entries.nextElement();
-   }
+    public boolean hasNext() {
+        return entries.hasMoreElements();
+    }
 
-   public void remove()
-   {
-      throw new UnsupportedOperationException();
-   }
+    public T next() {
+        return entries.nextElement();
+    }
+
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/FileSystem.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/FileSystem.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/FileSystem.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -32,111 +32,127 @@
 
 /**
  * A file system which is mounted in to the VFS.  This is the driver class for a given virtual file system type.  An
- * instance of {@code FileSystem} will be mounted at some point on a VFS.  The specific instance is only called when
- * a file from this filesystem is called upon.  The path components passed in to the operations are canonical, with
- * no "." or ".." components.
+ * instance of {@code FileSystem} will be mounted at some point on a VFS.  The specific instance is only called when a
+ * file from this filesystem is called upon.  The path components passed in to the operations are canonical, with no "."
+ * or ".." components.
  */
-public interface FileSystem extends Closeable
-{
-   /**
-    * Get a real {@code File} for the given path within this filesystem.  Some filesystem types will need to make a copy
-    * in order to return this file; such copies should be cached and retained until the filesystem is closed.  Depending
-    * on the file type, the real path of the returned {@code File} may or may not bear a relationship to the virtual path
-    * provided; if such a relationship is required, it must be negotiated at the time the filesystem is mounted.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return the file instance
-    * @throws IOException if an I/O error occurs
-    */
-   File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException;
+public interface FileSystem extends Closeable {
 
-   /**
-    * Open an input stream for the file at the given relative path.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return the input stream
-    * @throws IOException if an I/O error occurs
-    */
-   InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException;
+    /**
+     * Get a real {@code File} for the given path within this filesystem.  Some filesystem types will need to make a copy
+     * in order to return this file; such copies should be cached and retained until the filesystem is closed.  Depending
+     * on the file type, the real path of the returned {@code File} may or may not bear a relationship to the virtual
+     * path provided; if such a relationship is required, it must be negotiated at the time the filesystem is mounted.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return the file instance
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException;
 
-   /**
-    * Determine whether this filesystem is read-only.  A read-only filesystem prohibits file modification or
-    * deletion.  It is not an error to mount a read-write filesystem within a read-only filesystem however (this
-    * operation does not take place within the {@code FileSystem} implementation).
-    *
-    * @return {@code true} if the filesystem is read-only
-    */
-   boolean isReadOnly();
+    /**
+     * Open an input stream for the file at the given relative path.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return the input stream
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException;
 
-   /**
-    * Attempt to delete a virtual file within this filesystem.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return {@code true} if the file was deleted, {@code false} if it failed for any reason
-    * @throws IOException if an I/O error occurs
-    */
-   boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException;
+    /**
+     * Determine whether this filesystem is read-only.  A read-only filesystem prohibits file modification or deletion.
+     * It is not an error to mount a read-write filesystem within a read-only filesystem however (this operation does not
+     * take place within the {@code FileSystem} implementation).
+     *
+     * @return {@code true} if the filesystem is read-only
+     */
+    boolean isReadOnly();
 
-   /**
-    * Get the size of a virtual file within this filesystem.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return the size, in bytes
-    * @throws IOException if an I/O error occurs
-    */
-   long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException;
+    /**
+     * Attempt to delete a virtual file within this filesystem.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return {@code true} if the file was deleted, {@code false} if it failed for any reason
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException;
 
-   /**
-    * Get the last modification time of a virtual file within this filesystem.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return the modification time in milliseconds
-    * @throws IOException if an I/O error occurs
-    */
-   long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException;
+    /**
+     * Get the size of a virtual file within this filesystem.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return the size, in bytes
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException;
 
-   /**
-    * Ascertain the existance of a virtual file within this filesystem.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return {@code true} if the file exists, {@code false} otherwise
-    * @throws IOException if an I/O error occurs
-    */
-   boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException;
+    /**
+     * Get the last modification time of a virtual file within this filesystem.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return the modification time in milliseconds
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException;
 
-   /**
-    * Ascertain whether a virtual file within this filesystem is a directory.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return {@code true} if the file exists and is a directory, {@code false} otherwise
-    * @throws IOException if an I/O error occurs
-    */
-   boolean isDirectory(VirtualFile mountPoint, VirtualFile target);
+    /**
+     * Ascertain the existance of a virtual file within this filesystem.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return {@code true} if the file exists, {@code false} otherwise
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException;
 
-   /**
-    * Read a directory.  Returns all the simple path names (excluding "." and "..").  The returned list will be
-    * empty if the node is not a directory.
-    *
-    * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
-    * @param target the virtual file to act upon
-    * @return the collection of children names
-    * @throws IOException if an I/O error occurs
-    */
-   List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException;
+    /**
+     * Ascertain whether a virtual file within this filesystem is a directory.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return {@code true} if the file exists and is a directory, {@code false} otherwise
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    boolean isDirectory(VirtualFile mountPoint, VirtualFile target);
 
-   /**
-    * Destroy this filesystem instance.  After this method is called, the filesystem may not be used in any way.  This
-    * method should be called only after all mounts of this filesystem have been cleared; otherwise, VFS accesses may
-    * result in {@code IOException}s.
-    *
-    * @throws IOException if an I/O error occurs during close
-    */
-   void close() throws IOException;
+    /**
+     * Read a directory.  Returns all the simple path names (excluding "." and "..").  The returned list will be empty if
+     * the node is not a directory.
+     *
+     * @param mountPoint the mount point of the filesystem instance (guaranteed to be a parent of {@code target})
+     * @param target the virtual file to act upon
+     *
+     * @return the collection of children names
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException;
+
+    /**
+     * Destroy this filesystem instance.  After this method is called, the filesystem may not be used in any way.  This
+     * method should be called only after all mounts of this filesystem have been cleared; otherwise, VFS accesses may
+     * result in {@code IOException}s.
+     *
+     * @throws IOException if an I/O error occurs during close
+     */
+    void close() throws IOException;
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JZipFileSystem.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JZipFileSystem.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JZipFileSystem.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -49,230 +49,214 @@
 /**
  * {@inheritDoc}
  * <p/>
- * This implementation is backed by a zip file.  The provided file must be owned by this instance; otherwise, if the file
- * disappears unexpectedly, the filesystem will malfunction.
+ * This implementation is backed by a zip file.  The provided file must be owned by this instance; otherwise, if the
+ * file disappears unexpectedly, the filesystem will malfunction.
  */
-public final class JZipFileSystem implements FileSystem
-{
-   private final File zipFile;
-   private final long zipTime;
-   private final ZipNode rootNode;
-   private final TempDir tempDir;
-   private final File contentsDir;
+public final class JZipFileSystem implements FileSystem {
 
-   /**
-    * Create a new instance.
-    *
-    * @param name the name of the source archive
-    * @param inputStream an input stream from the source archive
-    * @param tempDir the temp dir into which zip information is stored
-    * @throws java.io.IOException if an I/O error occurs
-    */
-   public JZipFileSystem(String name, InputStream inputStream, TempDir tempDir) throws IOException {
-      this(tempDir.createFile(name, inputStream), tempDir);
-   }
+    private final File zipFile;
+    private final long zipTime;
+    private final ZipNode rootNode;
+    private final TempDir tempDir;
+    private final File contentsDir;
 
-   /**
-    * Create a new instance.
-    *
-    * @param zipFile the original archive file
-    * @param tempDir the temp dir into which zip information is stored
-    * @throws java.io.IOException if an I/O error occurs
-    */
-   public JZipFileSystem(File zipFile, TempDir tempDir) throws IOException
-   {
-      zipTime = zipFile.lastModified();
-      this.zipFile = zipFile;
-      final ZipCatalog catalog = Zip.readCatalog(zipFile);
-      final ZipNode rootNode = new ZipNode(new HashMap<String, ZipNode>(), "", null);
-      FILES: for (ZipEntry entry : catalog.allEntries())
-      {
-         final String name = entry.getName();
-         final boolean isDirectory = entry.getEntryType() == ZipEntryType.DIRECTORY;
-         final List<String> tokens = PathTokenizer.getTokens(name);
-         ZipNode node = rootNode;
-         final Iterator<String> it = tokens.iterator();
-         while (it.hasNext())
-         {
-            String token = it.next();
-            if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token)) {
-               // invalid file name
-               continue FILES;
+    /**
+     * Create a new instance.
+     *
+     * @param name the name of the source archive
+     * @param inputStream an input stream from the source archive
+     * @param tempDir the temp dir into which zip information is stored
+     *
+     * @throws java.io.IOException if an I/O error occurs
+     */
+    public JZipFileSystem(String name, InputStream inputStream, TempDir tempDir) throws IOException {
+        this(tempDir.createFile(name, inputStream), tempDir);
+    }
+
+    /**
+     * Create a new instance.
+     *
+     * @param zipFile the original archive file
+     * @param tempDir the temp dir into which zip information is stored
+     *
+     * @throws java.io.IOException if an I/O error occurs
+     */
+    public JZipFileSystem(File zipFile, TempDir tempDir) throws IOException {
+        zipTime = zipFile.lastModified();
+        this.zipFile = zipFile;
+        final ZipCatalog catalog = Zip.readCatalog(zipFile);
+        final ZipNode rootNode = new ZipNode(new HashMap<String, ZipNode>(), "", null);
+        FILES:
+        for (ZipEntry entry : catalog.allEntries()) {
+            final String name = entry.getName();
+            final boolean isDirectory = entry.getEntryType() == ZipEntryType.DIRECTORY;
+            final List<String> tokens = PathTokenizer.getTokens(name);
+            ZipNode node = rootNode;
+            final Iterator<String> it = tokens.iterator();
+            while (it.hasNext()) {
+                String token = it.next();
+                if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token)) {
+                    // invalid file name
+                    continue FILES;
+                }
+                final Map<String, ZipNode> children = node.children;
+                if (children == null) {
+                    // todo - log bad zip entry
+                    continue FILES;
+                }
+                ZipNode child = children.get(token.toLowerCase());
+                if (child == null) {
+                    child = it.hasNext() || isDirectory ? new ZipNode(new HashMap<String, ZipNode>(), token, null) : new ZipNode(null, token, entry);
+                    children.put(token.toLowerCase(), child);
+                }
+                node = child;
             }
-            final Map<String, ZipNode> children = node.children;
-            if (children == null) {
-               // todo - log bad zip entry
-               continue FILES;
-            }
-            ZipNode child = children.get(token.toLowerCase());
-            if (child == null)
-            {
-               child = it.hasNext() || isDirectory ? new ZipNode(new HashMap<String, ZipNode>(), token, null) : new ZipNode(null, token, entry);
-               children.put(token.toLowerCase(), child);
-            }
-            node = child;
-         }
-      }
-      this.rootNode = rootNode;
-      this.tempDir = tempDir;
-      contentsDir = tempDir.getFile("contents");
-      contentsDir.mkdir();
-   }
+        }
+        this.rootNode = rootNode;
+        this.tempDir = tempDir;
+        contentsDir = tempDir.getFile("contents");
+        contentsDir.mkdir();
+    }
 
-   public File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-
-      // check if we have cached one already
-      File cachedFile = zipNode.cachedFile;
-      if (cachedFile != null) {
-         return cachedFile;
-      }
-      synchronized (zipNode) {
-         // double-check
-         cachedFile = zipNode.cachedFile;
-         if (cachedFile != null) {
+    public File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        // check if we have cached one already
+        File cachedFile = zipNode.cachedFile;
+        if (cachedFile != null) {
             return cachedFile;
-         }
+        }
+        synchronized (zipNode) {
+            // double-check
+            cachedFile = zipNode.cachedFile;
+            if (cachedFile != null) {
+                return cachedFile;
+            }
+            // nope, create a cached temp
+            final ZipEntry entry = getNodeEntry(zipNode);
+            final String name = entry.getName();
+            cachedFile = new File(contentsDir, name);
+            VFSUtils.copyStreamAndClose(Zip.openEntry(zipFile, entry), new BufferedOutputStream(new FileOutputStream(cachedFile)));
+            zipNode.cachedFile = cachedFile;
+            return cachedFile;
+        }
+    }
 
-         // nope, create a cached temp
-         final ZipEntry entry = getNodeEntry(zipNode);
-         final String name = entry.getName();
-         cachedFile = new File(contentsDir, name);
-         VFSUtils.copyStreamAndClose(Zip.openEntry(zipFile, entry), new BufferedOutputStream(new FileOutputStream(cachedFile)));
-         zipNode.cachedFile = cachedFile;
-         return cachedFile;
-      }
-   }
+    public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        if (cachedFile != null) {
+            return new FileInputStream(cachedFile);
+        }
+        final ZipEntry entry = zipNode.entry;
+        if (entry == null) {
+            throw new IOException("Not a file: \"" + target.getPathName() + "\"");
+        }
+        return Zip.openEntry(zipFile, entry);
+    }
 
-   public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      if (cachedFile != null) {
-         return new FileInputStream(cachedFile);
-      }
-      final ZipEntry entry = zipNode.entry;
-      if (entry == null) {
-         throw new IOException("Not a file: \"" + target.getPathName() + "\"");
-      }
-      return Zip.openEntry(zipFile, entry);
-   }
+    public boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        return cachedFile != null && cachedFile.delete();
+    }
 
-   public boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      return cachedFile != null && cachedFile.delete();
-   }
+    public long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        final ZipEntry entry = zipNode.entry;
+        return cachedFile != null ? cachedFile.length() : entry == null ? 0L : entry.getSize();
+    }
 
-   public long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      final ZipEntry entry = zipNode.entry;
-      return cachedFile != null ? cachedFile.length() : entry == null ? 0L : entry.getSize();
-   }
+    public long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        final ZipEntry entry = zipNode.entry;
+        return cachedFile != null ? cachedFile.lastModified() : entry == null ? zipTime : entry.getModificationTime();
+    }
 
-   public long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      final ZipEntry entry = zipNode.entry;
-      return cachedFile != null ? cachedFile.lastModified() : entry == null ? zipTime : entry.getModificationTime();
-   }
+    public boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = rootNode.find(mountPoint, target);
+        if (zipNode == null) {
+            return false;
+        } else {
+            final File cachedFile = zipNode.cachedFile;
+            return cachedFile == null || cachedFile.exists();
+        }
+    }
 
-   public boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = rootNode.find(mountPoint, target);
-      if (zipNode == null) {
-         return false;
-      } else {
-         final File cachedFile = zipNode.cachedFile;
-         return cachedFile == null || cachedFile.exists();
-      }
-   }
+    public boolean isDirectory(VirtualFile mountPoint, VirtualFile target) {
+        final ZipNode zipNode = rootNode.find(mountPoint, target);
+        return zipNode != null && zipNode.entry == null;
+    }
 
-   public boolean isDirectory(VirtualFile mountPoint, VirtualFile target)
-   {
-      final ZipNode zipNode = rootNode.find(mountPoint, target);
-      return zipNode != null && zipNode.entry == null;
-   }
+    public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final Map<String, ZipNode> children = zipNode.children;
+        if (children == null) {
+            return Collections.emptyList();
+        }
+        final Collection<ZipNode> values = children.values();
+        final List<String> names = new ArrayList<String>(values.size());
+        for (ZipNode node : values) {
+            names.add(node.name);
+        }
+        return names;
+    }
 
-   public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final Map<String, ZipNode> children = zipNode.children;
-      if (children == null) {
-         return Collections.emptyList();
-      }
-      final Collection<ZipNode> values = children.values();
-      final List<String> names = new ArrayList<String>(values.size());
-      for (ZipNode node : values)
-      {
-         names.add(node.name);
-      }
-      return names;
-   }
+    private ZipEntry getNodeEntry(ZipNode zipNode)
+            throws IOException {
+        final ZipEntry entry = zipNode.entry;
+        if (entry == null) {
+            throw new IOException("Cannot call this operation on a directory");
+        }
+        return entry;
+    }
 
-   private ZipEntry getNodeEntry(ZipNode zipNode)
-         throws IOException
-   {
-      final ZipEntry entry = zipNode.entry;
-      if (entry == null) {
-         throw new IOException("Cannot call this operation on a directory");
-      }
-      return entry;
-   }
+    private ZipNode getExistingZipNode(VirtualFile mountPoint, VirtualFile target)
+            throws FileNotFoundException {
+        final ZipNode zipNode = rootNode.find(mountPoint, target);
+        if (zipNode == null) {
+            throw new FileNotFoundException(target.getPathName());
+        }
+        return zipNode;
+    }
 
-   private ZipNode getExistingZipNode(VirtualFile mountPoint, VirtualFile target)
-         throws FileNotFoundException
-   {
-      final ZipNode zipNode = rootNode.find(mountPoint, target);
-      if (zipNode == null) {
-         throw new FileNotFoundException(target.getPathName());
-      }
-      return zipNode;
-   }
+    public boolean isReadOnly() {
+        return true;
+    }
 
-   public boolean isReadOnly()
-   {
-      return true;
-   }
+    public void close() throws IOException {
+        tempDir.close();
+    }
 
-   public void close() throws IOException
-   {
-      tempDir.close();
-   }
+    private static final class ZipNode {
 
-   private static final class ZipNode {
-      // immutable child map
-      private final Map<String, ZipNode> children;
-      private final String name;
-      private final ZipEntry entry;
-      private volatile File cachedFile;
+        // immutable child map
+        private final Map<String, ZipNode> children;
+        private final String name;
+        private final ZipEntry entry;
+        private volatile File cachedFile;
 
-      private ZipNode(Map<String, ZipNode> children, String name, ZipEntry entry)
-      {
-         this.children = children;
-         this.name = name;
-         this.entry = entry;
-      }
+        private ZipNode(Map<String, ZipNode> children, String name, ZipEntry entry) {
+            this.children = children;
+            this.name = name;
+            this.entry = entry;
+        }
 
-      private ZipNode find(VirtualFile mountPoint, VirtualFile target) {
-         if (mountPoint.equals(target)) {
-            return this;
-         } else {
-            final ZipNode parent = find(mountPoint, target.getParent());
-            if (parent == null) {
-               return null;
+        private ZipNode find(VirtualFile mountPoint, VirtualFile target) {
+            if (mountPoint.equals(target)) {
+                return this;
+            } else {
+                final ZipNode parent = find(mountPoint, target.getParent());
+                if (parent == null) {
+                    return null;
+                }
+                final Map<String, ZipNode> children = parent.children;
+                if (children == null) {
+                    return null;
+                }
+                return children.get(target.getLowerCaseName());
             }
-            final Map<String, ZipNode> children = parent.children;
-            if (children == null) {
-               return null;
-            }
-            return children.get(target.getLowerCaseName());
-         }
-      }
-   }
+        }
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -49,254 +49,233 @@
 /**
  * {@inheritDoc}
  * <p/>
- * This implementation is backed by a zip file.  The provided file must be owned by this instance; otherwise, if the file
- * disappears unexpectedly, the filesystem will malfunction.
+ * This implementation is backed by a zip file.  The provided file must be owned by this instance; otherwise, if the
+ * file disappears unexpectedly, the filesystem will malfunction.
  */
-public final class JavaZipFileSystem implements FileSystem
-{
-   private final ZipFile zipFile;
-   private final File archiveFile;
-   private final long zipTime;
-   private final ZipNode rootNode;
-   private final TempDir tempDir;
-   private final File contentsDir;
+public final class JavaZipFileSystem implements FileSystem {
 
-   /**
-    * Create a new instance.
-    *
-    * @param name the name of the source archive
-    * @param inputStream an input stream from the source archive
-    * @param tempDir the temp dir into which zip information is stored
-    * @throws java.io.IOException if an I/O error occurs
-    */
-   public JavaZipFileSystem(String name, InputStream inputStream, TempDir tempDir) throws IOException {
-      this(tempDir.createFile(name, inputStream), tempDir);
-   }
+    private final ZipFile zipFile;
+    private final File archiveFile;
+    private final long zipTime;
+    private final ZipNode rootNode;
+    private final TempDir tempDir;
+    private final File contentsDir;
 
-   /**
-    * Create a new instance.
-    *
-    * @param archiveFile the original archive file
-    * @param tempDir the temp dir into which zip information is stored
-    * @throws java.io.IOException if an I/O error occurs
-    */
-   public JavaZipFileSystem(File archiveFile, TempDir tempDir) throws IOException
-   {
-      zipTime = archiveFile.lastModified();
-      final ZipFile zipFile;
-      this.zipFile = zipFile = new ZipFile(archiveFile);
-      this.archiveFile = archiveFile;
-      this.tempDir = tempDir;
-      final Enumeration<? extends ZipEntry> entries = zipFile.entries();
-      final ZipNode rootNode = new ZipNode(new HashMap<String, ZipNode>(), "", null);
+    /**
+     * Create a new instance.
+     *
+     * @param name the name of the source archive
+     * @param inputStream an input stream from the source archive
+     * @param tempDir the temp dir into which zip information is stored
+     *
+     * @throws java.io.IOException if an I/O error occurs
+     */
+    public JavaZipFileSystem(String name, InputStream inputStream, TempDir tempDir) throws IOException {
+        this(tempDir.createFile(name, inputStream), tempDir);
+    }
 
-      FILES: for (ZipEntry entry : iter(entries))
-      {
-         final String name = entry.getName();
-         final boolean isDirectory = entry.isDirectory();
-         final List<String> tokens = PathTokenizer.getTokens(name);
-         ZipNode node = rootNode;
-         final Iterator<String> it = tokens.iterator();
-         while (it.hasNext())
-         {
-            String token = it.next();
-            if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token)) {
-               // invalid file name
-               continue FILES;
+    /**
+     * Create a new instance.
+     *
+     * @param archiveFile the original archive file
+     * @param tempDir the temp dir into which zip information is stored
+     *
+     * @throws java.io.IOException if an I/O error occurs
+     */
+    public JavaZipFileSystem(File archiveFile, TempDir tempDir) throws IOException {
+        zipTime = archiveFile.lastModified();
+        final ZipFile zipFile;
+        this.zipFile = zipFile = new ZipFile(archiveFile);
+        this.archiveFile = archiveFile;
+        this.tempDir = tempDir;
+        final Enumeration<? extends ZipEntry> entries = zipFile.entries();
+        final ZipNode rootNode = new ZipNode(new HashMap<String, ZipNode>(), "", null);
+        FILES:
+        for (ZipEntry entry : iter(entries)) {
+            final String name = entry.getName();
+            final boolean isDirectory = entry.isDirectory();
+            final List<String> tokens = PathTokenizer.getTokens(name);
+            ZipNode node = rootNode;
+            final Iterator<String> it = tokens.iterator();
+            while (it.hasNext()) {
+                String token = it.next();
+                if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token)) {
+                    // invalid file name
+                    continue FILES;
+                }
+                final Map<String, ZipNode> children = node.children;
+                if (children == null) {
+                    // todo - log bad zip entry
+                    continue FILES;
+                }
+                final String lcToken = token.toLowerCase();
+                ZipNode child = children.get(lcToken);
+                if (child == null) {
+                    child = it.hasNext() || isDirectory ? new ZipNode(new HashMap<String, ZipNode>(), token, null) : new ZipNode(null, token, entry);
+                    children.put(lcToken, child);
+                }
+                node = child;
             }
-            final Map<String, ZipNode> children = node.children;
-            if (children == null) {
-               // todo - log bad zip entry
-               continue FILES;
-            }
-            final String lcToken = token.toLowerCase();
-            ZipNode child = children.get(lcToken);
-            if (child == null)
-            {
-               child = it.hasNext() || isDirectory ? new ZipNode(new HashMap<String, ZipNode>(), token, null) : new ZipNode(null, token, entry);
-               children.put(lcToken, child);
-            }
-            node = child;
-         }
-      }
-      this.rootNode = rootNode;
-      contentsDir = tempDir.getFile("contents");
-      contentsDir.mkdir();
-   }
+        }
+        this.rootNode = rootNode;
+        contentsDir = tempDir.getFile("contents");
+        contentsDir.mkdir();
+    }
 
-   private static <T> Iterable<T> iter(final Enumeration<T> entries)
-   {
-      return new EnumerationIterable<T>(entries);
-   }
+    private static <T> Iterable<T> iter(final Enumeration<T> entries) {
+        return new EnumerationIterable<T>(entries);
+    }
 
-   public File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-
-      // check if we have cached one already
-      File cachedFile = zipNode.cachedFile;
-      if (cachedFile != null) {
-         return cachedFile;
-      }
-      synchronized (zipNode) {
-         // double-check
-         cachedFile = zipNode.cachedFile;
-         if (cachedFile != null) {
+    public File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        // check if we have cached one already
+        File cachedFile = zipNode.cachedFile;
+        if (cachedFile != null) {
             return cachedFile;
-         }
+        }
+        synchronized (zipNode) {
+            // double-check
+            cachedFile = zipNode.cachedFile;
+            if (cachedFile != null) {
+                return cachedFile;
+            }
+            // nope, create a cached temp
+            final ZipEntry zipEntry = getNodeEntry(zipNode);
+            final String name = zipEntry.getName();
+            cachedFile = new File(contentsDir, name);
+            VFSUtils.copyStreamAndClose(zipFile.getInputStream(zipEntry), new BufferedOutputStream(new FileOutputStream(cachedFile)));
+            zipNode.cachedFile = cachedFile;
+            return cachedFile;
+        }
+    }
 
-         // nope, create a cached temp
-         final ZipEntry zipEntry = getNodeEntry(zipNode);
-         final String name = zipEntry.getName();
-         cachedFile = new File(contentsDir, name);
-         VFSUtils.copyStreamAndClose(zipFile.getInputStream(zipEntry), new BufferedOutputStream(new FileOutputStream(cachedFile)));
-         zipNode.cachedFile = cachedFile;
-         return cachedFile;
-      }
-   }
+    public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        if (cachedFile != null) {
+            return new FileInputStream(cachedFile);
+        }
+        if (rootNode == zipNode) {
+            return new FileInputStream(archiveFile);
+        }
+        final ZipEntry entry = zipNode.entry;
+        if (entry == null) {
+            throw new IOException("Not a file: \"" + target.getPathName() + "\"");
+        }
+        return zipFile.getInputStream(entry);
+    }
 
-   public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      if (cachedFile != null) {
-         return new FileInputStream(cachedFile);
-      }
-      if (rootNode == zipNode) {
-         return new FileInputStream(archiveFile);
-      }
+    public boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        return cachedFile != null && cachedFile.delete();
+    }
 
-      final ZipEntry entry = zipNode.entry;
-      if (entry == null) {
-         throw new IOException("Not a file: \"" + target.getPathName() + "\"");
-      }
-      return zipFile.getInputStream(entry);
-   }
+    public long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        final ZipEntry entry = zipNode.entry;
+        if (zipNode == rootNode) {
+            return archiveFile.length();
+        }
+        return cachedFile != null ? cachedFile.length() : entry == null ? 0L : entry.getSize();
+    }
 
-   public boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      return cachedFile != null && cachedFile.delete();
-   }
+    public long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final File cachedFile = zipNode.cachedFile;
+        final ZipEntry entry = zipNode.entry;
+        return cachedFile != null ? cachedFile.lastModified() : entry == null ? zipTime : entry.getTime();
+    }
 
-   public long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      final ZipEntry entry = zipNode.entry;
+    public boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = rootNode.find(mountPoint, target);
+        if (zipNode == null) {
+            return false;
+        } else {
+            final File cachedFile = zipNode.cachedFile;
+            return cachedFile == null || cachedFile.exists();
+        }
+    }
 
-      if (zipNode == rootNode) {
-         return archiveFile.length();
-      }
+    public boolean isDirectory(VirtualFile mountPoint, VirtualFile target) {
+        final ZipNode zipNode = rootNode.find(mountPoint, target);
+        return zipNode != null && zipNode.entry == null;
+    }
 
-      return cachedFile != null ? cachedFile.length() : entry == null ? 0L : entry.getSize();
-   }
+    public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final ZipNode zipNode = getExistingZipNode(mountPoint, target);
+        final Map<String, ZipNode> children = zipNode.children;
+        if (children == null) {
+            return Collections.emptyList();
+        }
+        final Collection<ZipNode> values = children.values();
+        final List<String> names = new ArrayList<String>(values.size());
+        for (ZipNode node : values) {
+            names.add(node.name);
+        }
+        return names;
+    }
 
-   public long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final File cachedFile = zipNode.cachedFile;
-      final ZipEntry entry = zipNode.entry;
-      return cachedFile != null ? cachedFile.lastModified() : entry == null ? zipTime : entry.getTime();
-   }
+    private ZipEntry getNodeEntry(ZipNode zipNode)
+            throws IOException {
+        final ZipEntry entry = zipNode.entry;
+        if (entry == null) {
+            throw new IOException("Cannot call this operation on a directory");
+        }
+        return entry;
+    }
 
-   public boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = rootNode.find(mountPoint, target);
-      if (zipNode == null) {
-         return false;
-      } else {
-         final File cachedFile = zipNode.cachedFile;
-         return cachedFile == null || cachedFile.exists();
-      }
-   }
+    private ZipNode getExistingZipNode(VirtualFile mountPoint, VirtualFile target)
+            throws FileNotFoundException {
+        final ZipNode zipNode = rootNode.find(mountPoint, target);
+        if (zipNode == null) {
+            throw new FileNotFoundException(target.getPathName());
+        }
+        return zipNode;
+    }
 
-   public boolean isDirectory(VirtualFile mountPoint, VirtualFile target)
-   {
-      final ZipNode zipNode = rootNode.find(mountPoint, target);
-      return zipNode != null && zipNode.entry == null;
-   }
+    public boolean isReadOnly() {
+        return true;
+    }
 
-   public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final ZipNode zipNode = getExistingZipNode(mountPoint, target);
-      final Map<String, ZipNode> children = zipNode.children;
-      if (children == null) {
-         return Collections.emptyList();
-      }
-      final Collection<ZipNode> values = children.values();
-      final List<String> names = new ArrayList<String>(values.size());
-      for (ZipNode node : values)
-      {
-         names.add(node.name);
-      }
-      return names;
-   }
+    public void close() throws IOException {
+        VFSUtils.safeClose(new Closeable() {
+            public void close() throws IOException {
+                zipFile.close();
+            }
+        });
+        tempDir.close();
+    }
 
-   private ZipEntry getNodeEntry(ZipNode zipNode)
-         throws IOException
-   {
-      final ZipEntry entry = zipNode.entry;
-      if (entry == null) {
-         throw new IOException("Cannot call this operation on a directory");
-      }
-      return entry;
-   }
+    private static final class ZipNode {
 
-   private ZipNode getExistingZipNode(VirtualFile mountPoint, VirtualFile target)
-         throws FileNotFoundException
-   {
-      final ZipNode zipNode = rootNode.find(mountPoint, target);
-      if (zipNode == null) {
-         throw new FileNotFoundException(target.getPathName());
-      }
-      return zipNode;
-   }
+        // immutable child map
+        private final Map<String, ZipNode> children;
+        private final String name;
+        private final ZipEntry entry;
+        private volatile File cachedFile;
 
-   public boolean isReadOnly()
-   {
-      return true;
-   }
+        private ZipNode(Map<String, ZipNode> children, String name, ZipEntry entry) {
+            this.children = children;
+            this.name = name;
+            this.entry = entry;
+        }
 
-   public void close() throws IOException
-   {
-      VFSUtils.safeClose(new Closeable() {
-         public void close() throws IOException {
-            zipFile.close();
-         }
-      });
-      tempDir.close();
-   }
-
-   private static final class ZipNode {
-      // immutable child map
-      private final Map<String, ZipNode> children;
-      private final String name;
-      private final ZipEntry entry;
-      private volatile File cachedFile;
-
-      private ZipNode(Map<String, ZipNode> children, String name, ZipEntry entry)
-      {
-         this.children = children;
-         this.name = name;
-         this.entry = entry;
-      }
-
-      private ZipNode find(VirtualFile mountPoint, VirtualFile target) {
-         if (mountPoint.equals(target)) {
-            return this;
-         } else {
-            final ZipNode parent = find(mountPoint, target.getParent());
-            if (parent == null) {
-               return null;
+        private ZipNode find(VirtualFile mountPoint, VirtualFile target) {
+            if (mountPoint.equals(target)) {
+                return this;
+            } else {
+                final ZipNode parent = find(mountPoint, target.getParent());
+                if (parent == null) {
+                    return null;
+                }
+                final Map<String, ZipNode> children = parent.children;
+                if (children == null) {
+                    return null;
+                }
+                return children.get(target.getLowerCaseName());
             }
-            final Map<String, ZipNode> children = parent.children;
-            if (children == null) {
-               return null;
-            }
-            return children.get(target.getLowerCaseName());
-         }
-      }
-   }
+        }
+    }
 }
\ No newline at end of file

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/RealFileSystem.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/RealFileSystem.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/RealFileSystem.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -35,88 +35,96 @@
 /**
  * A real filesystem.
  */
-public final class RealFileSystem implements FileSystem
-{
+public final class RealFileSystem implements FileSystem {
 
-   /**
-    * The root real filesystem (singleton instance).
-    */
-   public static final RealFileSystem ROOT_INSTANCE = new RealFileSystem(new File(""));
+    /**
+     * The root real filesystem (singleton instance).
+     */
+    public static final RealFileSystem ROOT_INSTANCE = new RealFileSystem(new File(""));
 
-   private final File realRoot;
+    private final File realRoot;
 
-   /**
-    * Construct a real filesystem with the given real root.
-    *
-    * @param realRoot the real root
-    */
-   public RealFileSystem(File realRoot)
-   {
-      this.realRoot = realRoot;
-   }
+    /**
+     * Construct a real filesystem with the given real root.
+     *
+     * @param realRoot the real root
+     */
+    public RealFileSystem(File realRoot) {
+        this.realRoot = realRoot;
+    }
 
-   /** {@inheritDoc} */
-   public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      return new FileInputStream(getFile(mountPoint, target));
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        return new FileInputStream(getFile(mountPoint, target));
+    }
 
-   /** {@inheritDoc} */
-   public boolean isReadOnly()
-   {
-      return false;
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isReadOnly() {
+        return false;
+    }
 
-   /** {@inheritDoc} */
-   public File getFile(VirtualFile mountPoint, VirtualFile target)
-   {
-      if (mountPoint.equals(target)) {
-         return realRoot;
-      } else {
-         return new File(getFile(mountPoint, target.getParent()), target.getName());
-      }
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public File getFile(VirtualFile mountPoint, VirtualFile target) {
+        if (mountPoint.equals(target)) {
+            return realRoot;
+        } else {
+            return new File(getFile(mountPoint, target.getParent()), target.getName());
+        }
+    }
 
-   /** {@inheritDoc} */
-   public boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      return getFile(mountPoint, target).delete();
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean delete(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        return getFile(mountPoint, target).delete();
+    }
 
-   /** {@inheritDoc} */
-   public long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      return getFile(mountPoint, target).length();
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public long getSize(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        return getFile(mountPoint, target).length();
+    }
 
-   /** {@inheritDoc} */
-   public long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      return getFile(mountPoint, target).lastModified();
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public long getLastModified(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        return getFile(mountPoint, target).lastModified();
+    }
 
-   /** {@inheritDoc} */
-   public boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      return getFile(mountPoint, target).exists();
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean exists(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        return getFile(mountPoint, target).exists();
+    }
 
-   /** {@inheritDoc} */
-   public boolean isDirectory(VirtualFile mountPoint, VirtualFile target)
-   {
-      return getFile(mountPoint, target).isDirectory();
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDirectory(VirtualFile mountPoint, VirtualFile target) {
+        return getFile(mountPoint, target).isDirectory();
+    }
 
-   /** {@inheritDoc} */
-   public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException
-   {
-      final String[] names = getFile(mountPoint, target).list();
-      return names == null ? Collections.<String>emptyList() : Arrays.asList(names);
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) throws IOException {
+        final String[] names = getFile(mountPoint, target).list();
+        return names == null ? Collections.<String>emptyList() : Arrays.asList(names);
+    }
 
-   /** {@inheritDoc} */
-   public void close() throws IOException
-   {
-      // no operation - the real FS can't be closed
-   }
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws IOException {
+        // no operation - the real FS can't be closed
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileFilterWithAttributes.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileFilterWithAttributes.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileFilterWithAttributes.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -26,38 +26,36 @@
 
 /**
  * AbstractVirtualFileFilterWithAttributes
- * 
+ *
  * @author adrian at jboss.org
  * @version $Revision: 44223 $
  */
-public abstract class AbstractVirtualFileFilterWithAttributes implements VirtualFileFilterWithAttributes
-{
-   /** The attributes */
-   private VisitorAttributes attributes;
-   
-   /**
-    * Create a new AbstractVirtualFileFilterWithAttributes,
-    * using {@link VisitorAttributes#DEFAULT}
-    */
-   public AbstractVirtualFileFilterWithAttributes()
-   {
-      this(null);
-   }
-   
-   /**
-    * Create a new AbstractVirtualFileFilterWithAttributes.
-    * 
-    * @param attributes the attributes, pass null to use {@link VisitorAttributes#DEFAULT}
-    */
-   public AbstractVirtualFileFilterWithAttributes(VisitorAttributes attributes)
-   {
-      if (attributes == null)
-         attributes = VisitorAttributes.DEFAULT;
-      this.attributes = attributes;
-   }
-   
-   public VisitorAttributes getAttributes()
-   {
-      return attributes;
-   }
+public abstract class AbstractVirtualFileFilterWithAttributes implements VirtualFileFilterWithAttributes {
+
+    /**
+     * The attributes
+     */
+    private VisitorAttributes attributes;
+
+    /**
+     * Create a new AbstractVirtualFileFilterWithAttributes, using {@link VisitorAttributes#DEFAULT}
+     */
+    protected AbstractVirtualFileFilterWithAttributes() {
+        this(null);
+    }
+
+    /**
+     * Create a new AbstractVirtualFileFilterWithAttributes.
+     *
+     * @param attributes the attributes, pass null to use {@link VisitorAttributes#DEFAULT}
+     */
+    protected AbstractVirtualFileFilterWithAttributes(VisitorAttributes attributes) {
+        if (attributes == null)
+            attributes = VisitorAttributes.DEFAULT;
+        this.attributes = attributes;
+    }
+
+    public VisitorAttributes getAttributes() {
+        return attributes;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileVisitor.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileVisitor.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/AbstractVirtualFileVisitor.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -26,37 +26,36 @@
 
 /**
  * AbstractVirtualFileVisitor.
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
-public abstract class AbstractVirtualFileVisitor implements VirtualFileVisitor
-{
-   /** The attributes */
-   private final VisitorAttributes attributes;
+public abstract class AbstractVirtualFileVisitor implements VirtualFileVisitor {
 
-   /**
-    * Create a new AbstractVirtualFileVisitor using the default visitor attributes
-    */
-   protected AbstractVirtualFileVisitor()
-   {
-      this(null);
-   }
+    /**
+     * The attributes
+     */
+    private final VisitorAttributes attributes;
 
-   /**
-    * Create a new AbstractVirtualFileVisitor using the default visitor attributes
-    * 
-    * @param attributes the attributes, uses the default if null
-    */
-   protected AbstractVirtualFileVisitor(VisitorAttributes attributes)
-   {
-      if (attributes == null)
-         attributes = VisitorAttributes.DEFAULT;
-      this.attributes = attributes;
-   }
-   
-   public VisitorAttributes getAttributes()
-   {
-      return attributes;
-   }
+    /**
+     * Create a new AbstractVirtualFileVisitor using the default visitor attributes
+     */
+    protected AbstractVirtualFileVisitor() {
+        this(null);
+    }
+
+    /**
+     * Create a new AbstractVirtualFileVisitor using the default visitor attributes
+     *
+     * @param attributes the attributes, uses the default if null
+     */
+    protected AbstractVirtualFileVisitor(VisitorAttributes attributes) {
+        if (attributes == null)
+            attributes = VisitorAttributes.DEFAULT;
+        this.attributes = attributes;
+    }
+
+    public VisitorAttributes getAttributes() {
+        return attributes;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/ExtensibleFilter.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/ExtensibleFilter.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/ExtensibleFilter.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -31,221 +31,209 @@
 import org.jboss.vfs.VirtualFileFilter;
 
 /**
- * An extensible filter for VFS files.  Three arrays are
- * maintained for checking: a prefix, suffix, and match array.  If the
- * filename starts with any of the prefixes, ends with any of the
- * suffixes, or exactly matches any of the matches, then the accepts
- * method will return false.
- * 
- * NOTE: the arrays *must* be sorted for the string matching to work,
- *       and suffixes use the 'reverseComparator'
- * 
+ * An extensible filter for VFS files.  Three arrays are maintained for checking: a prefix, suffix, and match array.  If
+ * the filename starts with any of the prefixes, ends with any of the suffixes, or exactly matches any of the matches,
+ * then the accepts method will return false.
+ * <p/>
+ * NOTE: the arrays *must* be sorted for the string matching to work, and suffixes use the 'reverseComparator'
+ *
  * @author somebody at jboss.org
  * @author Scott.Stark at jboss.org
  * @version $Revision: 57108 $
  */
-public class ExtensibleFilter implements VirtualFileFilter
-{
-   /**
-    * Compare the strings backwards.  This assists in suffix comparisons.
-    */
-   private static final Comparator<String> reverseComparator = new Comparator<String>()
-   {
-      public int compare(String o1, String o2)
-      {
-         int idx1 = o1.length();
-         int idx2 = o2.length();
-         int comp = 0;
+public class ExtensibleFilter implements VirtualFileFilter {
 
-         while (comp == 0 && idx1 > 0 && idx2 > 0)
-            comp = o1.charAt(--idx1) - o2.charAt(--idx2);
+    /**
+     * Compare the strings backwards.  This assists in suffix comparisons.
+     */
+    private static final Comparator<String> reverseComparator = new Comparator<String>() {
+        public int compare(String o1, String o2) {
+            int idx1 = o1.length();
+            int idx2 = o2.length();
+            int comp = 0;
+            while (comp == 0 && idx1 > 0 && idx2 > 0)
+                comp = o1.charAt(--idx1) - o2.charAt(--idx2);
+            return (comp == 0) ? (idx1 - idx2) : comp;
+        }
+    };
 
-         return (comp == 0) ? (idx1 - idx2) : comp;
-      }
-   };
+    /**
+     * the default prefix list
+     */
+    private static final String[] DEFAULT_PREFIXES =
+            { "#", "%", ",", ".", "_$" };
 
-   /** the default prefix list */
-   private static final String[] DEFAULT_PREFIXES =
-      {"#", "%", ",", ".", "_$"};
+    /**
+     * the default suffix list
+     */
+    private static final String[] DEFAULT_SUFFIXES =
+            { "#", "$", "%", "~", ",v", ".BAK", ".bak", ".old", ".orig", ".tmp", ".rej", ".sh" };
 
-   /** the default suffix list */
-   private static final String[] DEFAULT_SUFFIXES =
-      {"#", "$", "%", "~", ",v", ".BAK", ".bak", ".old", ".orig", ".tmp", ".rej", ".sh" };
+    /**
+     * the default matches list
+     */
+    private static final String[] DEFAULT_MATCHES =
+            { ".make.state", ".nse_depinfo", "CVS", "CVS.admin", "RCS", "RCSLOG",
+                    "SCCS", "TAGS", "core", "tags" };
 
-   /** the default matches list */
-   private static final String[] DEFAULT_MATCHES =
-      {".make.state", ".nse_depinfo", "CVS", "CVS.admin", "RCS", "RCSLOG",
-          "SCCS", "TAGS", "core", "tags"};
+    /**
+     * The list of disallowed suffixes, sorted using reverse values
+     */
+    private List<String> suffixes;
 
-   /** The list of disallowed suffixes, sorted using reverse values */
-   private List<String> suffixes;
+    /**
+     * The sorted list of disallowed prefixes
+     */
+    private List<String> prefixes;
 
-   /** The sorted list of disallowed prefixes */
-   private List<String> prefixes;
+    /**
+     * The sorted list of disallowed values
+     */
+    private List<String> matches;
 
-   /** The sorted list of disallowed values */
-   private List<String> matches;
+    /**
+     * Use the default values for suffixes, prefixes, and matches
+     */
+    public ExtensibleFilter() {
+        this(DEFAULT_MATCHES, DEFAULT_PREFIXES, DEFAULT_SUFFIXES);
+    }
 
-   /** Use the default values for suffixes, prefixes, and matches */
-   public ExtensibleFilter()
-   {
-      this(DEFAULT_MATCHES, DEFAULT_PREFIXES, DEFAULT_SUFFIXES);
-   }
+    /**
+     * Create using a custom set of matches, prefixes, and suffixes.  If any of these arrays are null, then the
+     * corresponding default will be substituted.
+     *
+     * @param matches the matches
+     * @param prefixes the prefixes
+     * @param suffixes the suffixes
+     */
+    public ExtensibleFilter(String[] matches, String[] prefixes, String[] suffixes) {
+        if (matches == null)
+            matches = DEFAULT_MATCHES;
+        Arrays.sort(matches);
+        this.matches = new ArrayList<String>(Arrays.asList(matches));
+        if (prefixes == null)
+            prefixes = DEFAULT_PREFIXES;
+        Arrays.sort(prefixes);
+        this.prefixes = new ArrayList<String>(Arrays.asList(prefixes));
+        if (suffixes == null)
+            suffixes = DEFAULT_SUFFIXES;
+        Arrays.sort(suffixes, reverseComparator);
+        this.suffixes = new ArrayList<String>(Arrays.asList(suffixes));
+    }
 
-   /**
-    * Create using a custom set of matches, prefixes, and suffixes.  If any of
-    * these arrays are null, then the corresponding default will be
-    * substituted.
-    * 
-    * @param matches the matches
-    * @param prefixes the prefixes
-    * @param suffixes the suffixes
-    */
-   public ExtensibleFilter(String[] matches, String[] prefixes, String[] suffixes)
-   {
-      if( matches == null )
-         matches = DEFAULT_MATCHES;
-      Arrays.sort(matches);
-      this.matches = new ArrayList<String>(Arrays.asList(matches));
+    public void addPrefix(String prefix) {
+        prefixes.add(prefix);
+        Collections.sort(prefixes);
+    }
 
-      if( prefixes == null )
-         prefixes = DEFAULT_PREFIXES;
-      Arrays.sort(prefixes);
-      this.prefixes = new ArrayList<String>(Arrays.asList(prefixes));
+    public void addPrefixes(String[] prefixes) {
+        this.prefixes.addAll(Arrays.asList(prefixes));
+        Collections.sort(this.prefixes);
+    }
 
-      if( suffixes == null )
-         suffixes = DEFAULT_SUFFIXES;
-      Arrays.sort(suffixes, reverseComparator);
-      this.suffixes = new ArrayList<String>(Arrays.asList(suffixes));
-   }
+    public void delPrefix(String prefix) {
+        prefixes.remove(prefix);
+    }
 
-   public void addPrefix(String prefix)
-   {
-      this.prefixes.add(prefix);
-      Collections.sort(this.prefixes);
-   }
-   public void addPrefixes(String[] prefixes)
-   {
-      this.prefixes.addAll(Arrays.asList(prefixes));
-      Collections.sort(this.prefixes);
-   }
+    public void delPrefixes(String[] prefixes) {
+        this.prefixes.removeAll(Arrays.asList(prefixes));
+        Collections.sort(this.prefixes);
+    }
 
-   public void delPrefix(String prefix)
-   {
-      this.prefixes.remove(prefix);
-   }
-   public void delPrefixes(String[] prefixes)
-   {
-      this.prefixes.removeAll(Arrays.asList(prefixes));
-      Collections.sort(this.prefixes);
-   }
+    public void addSuffix(String suffix) {
+        suffixes.add(suffix);
+        Collections.sort(suffixes, reverseComparator);
+    }
 
-   public void addSuffix(String suffix)
-   {
-      this.suffixes.add(suffix);
-      Collections.sort(this.suffixes, reverseComparator);
-   }
-   public void addSuffixes(String[] suffixes)
-   {
-      this.suffixes.addAll(Arrays.asList(suffixes));
-      Collections.sort(this.suffixes, reverseComparator);
-   }
+    public void addSuffixes(String[] suffixes) {
+        this.suffixes.addAll(Arrays.asList(suffixes));
+        Collections.sort(this.suffixes, reverseComparator);
+    }
 
-   public void delSuffix(String suffix)
-   {
-      this.suffixes.remove(suffix);
-   }
-   public void delSuffixes(String[] suffixes)
-   {
-      this.suffixes.removeAll(Arrays.asList(suffixes));
-      Collections.sort(this.suffixes, reverseComparator);
-   }
+    public void delSuffix(String suffix) {
+        suffixes.remove(suffix);
+    }
 
-   public String[] getSuffixes()
-   {
-      String[] tmp = new String[suffixes.size()];
-      suffixes.toArray(tmp);
-      return tmp;
-   }
-   public void setSuffixes(String[] suffixes)
-   {
-      Arrays.sort(suffixes, reverseComparator);
-      this.suffixes.clear();
-      this.suffixes.addAll(Arrays.asList(suffixes));
-   }
+    public void delSuffixes(String[] suffixes) {
+        this.suffixes.removeAll(Arrays.asList(suffixes));
+        Collections.sort(this.suffixes, reverseComparator);
+    }
 
-   public String[] getPrefixes()
-   {
-      String[] tmp = new String[prefixes.size()];
-      prefixes.toArray(tmp);
-      return tmp;
-   }
-   public void setPrefixes(String[] prefixes)
-   {
-      Arrays.sort(prefixes);
-      this.prefixes.clear();
-      this.prefixes.addAll(Arrays.asList(prefixes));
-   }
+    public String[] getSuffixes() {
+        String[] tmp = new String[suffixes.size()];
+        suffixes.toArray(tmp);
+        return tmp;
+    }
 
-   public String[] getMatches()
-   {
-      String[] tmp = new String[matches.size()];
-      matches.toArray(tmp);
-      return tmp;
-   }
-   public void setMatches(String[] matches)
-   {
-      Arrays.sort(matches);
-      this.matches.clear();
-      this.matches.addAll(Arrays.asList(matches));
-   }
+    public void setSuffixes(String[] suffixes) {
+        Arrays.sort(suffixes, reverseComparator);
+        this.suffixes.clear();
+        this.suffixes.addAll(Arrays.asList(suffixes));
+    }
 
-   /**
-    * If the filename matches any string in the prefix, suffix, or matches
-    * array, return false.  Perhaps a bit of overkill, but this method
-    * operates in log(n) time, where n is the size of the arrays.
-    *
-    * @param  file  The file to be tested
-    * @return  <code>false</code> if the filename matches any of the prefixes,
-    *          suffixes, or matches.
-    */
-   public boolean accepts(VirtualFile file)
-   {
-      String name = file.getName();
-      // check exact match
-      int index = Collections.binarySearch(matches, name);
-      if (index >= 0)
-         return false;
+    public String[] getPrefixes() {
+        String[] tmp = new String[prefixes.size()];
+        prefixes.toArray(tmp);
+        return tmp;
+    }
 
-      // check prefix
-      index = Collections.binarySearch(prefixes, name);
-      if (index >= 0)
-         return false;
-      if (index < -1)
-      {
-         // The < 0 index gives the first index greater than name
-         int firstLessIndex = -2 - index;
-         String prefix = prefixes.get(firstLessIndex);
-         // If name starts with an ingored prefix ignore name
-         if( name.startsWith(prefix) )
-            return false;
-      }
+    public void setPrefixes(String[] prefixes) {
+        Arrays.sort(prefixes);
+        this.prefixes.clear();
+        this.prefixes.addAll(Arrays.asList(prefixes));
+    }
 
-      // check suffix
-      index = Collections.binarySearch(suffixes, name, reverseComparator);
-      if (index >= 0)
-         return false;
-      if (index < -1)
-      {
-         // The < 0 index gives the first index greater than name
-         int firstLessIndex = -2 - index;
-         String suffix = suffixes.get(firstLessIndex);
-         // If name ends with an ingored suffix ignore name
-         if( name.endsWith(suffix) )
-            return false;
-      }
+    public String[] getMatches() {
+        String[] tmp = new String[matches.size()];
+        matches.toArray(tmp);
+        return tmp;
+    }
 
-      // everything checks out.
-      return true;
-   }
+    public void setMatches(String[] matches) {
+        Arrays.sort(matches);
+        this.matches.clear();
+        this.matches.addAll(Arrays.asList(matches));
+    }
+
+    /**
+     * If the filename matches any string in the prefix, suffix, or matches array, return false.  Perhaps a bit of
+     * overkill, but this method operates in log(n) time, where n is the size of the arrays.
+     *
+     * @param file The file to be tested
+     *
+     * @return <code>false</code> if the filename matches any of the prefixes, suffixes, or matches.
+     */
+    public boolean accepts(VirtualFile file) {
+        String name = file.getName();
+        // check exact match
+        int index = Collections.binarySearch(matches, name);
+        if (index >= 0)
+            return false;
+        // check prefix
+        index = Collections.binarySearch(prefixes, name);
+        if (index >= 0)
+            return false;
+        if (index < -1) {
+            // The < 0 index gives the first index greater than name
+            int firstLessIndex = -2 - index;
+            String prefix = prefixes.get(firstLessIndex);
+            // If name starts with an ingored prefix ignore name
+            if (name.startsWith(prefix))
+                return false;
+        }
+        // check suffix
+        index = Collections.binarySearch(suffixes, name, reverseComparator);
+        if (index >= 0)
+            return false;
+        if (index < -1) {
+            // The < 0 index gives the first index greater than name
+            int firstLessIndex = -2 - index;
+            String suffix = suffixes.get(firstLessIndex);
+            // If name ends with an ingored suffix ignore name
+            if (name.endsWith(suffix))
+                return false;
+        }
+        // everything checks out.
+        return true;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -32,87 +32,86 @@
 
 /**
  * A visitor based on a virtual file filter
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
-public class FilterVirtualFileVisitor extends AbstractVirtualFileVisitor
-{
-   /** The filter */
-   private final VirtualFileFilter filter;
-   
-   /** What is matched */
-   private List<VirtualFile> matched;
+public class FilterVirtualFileVisitor extends AbstractVirtualFileVisitor {
 
-   /**
-    * Check the attributes
-    * 
-    * @param filter the filter
-    * @param attributes the attributes
-    * @return the attributes
-    * @throws IllegalArgumentException for a null filter
-    */
-   private static VisitorAttributes checkAttributes(VirtualFileFilter filter, VisitorAttributes attributes)
-   {
-      if (filter == null)
-         throw new IllegalArgumentException("Null filter");
+    /**
+     * The filter
+     */
+    private final VirtualFileFilter filter;
 
-      // Specified
-      if (attributes != null)
-         return attributes;
-      
-      // From the filter
-      if (filter instanceof VirtualFileFilterWithAttributes)
-         return ((VirtualFileFilterWithAttributes) filter).getAttributes();
-      
-      // It will use the default
-      return null;
-   }
-   
-   /**
-    * Create a new FilterVirtualFileVisitor with default attributes
-    * 
-    * @param filter the filter
-    * @throws IllegalArgumentException if the filter is null
-    */
-   public FilterVirtualFileVisitor(VirtualFileFilter filter)
-   {
-      this(filter, null);
-   }
-   
-   /**
-    * Create a new FilterVirtualFileVisitor.
-    * 
-    * @param filter the filter
-    * @param attributes the attributes, uses the default if null
-    * @throws IllegalArgumentException if the filter is null
-    */
-   public FilterVirtualFileVisitor(VirtualFileFilter filter, VisitorAttributes attributes)
-   {
-      super(checkAttributes(filter, attributes));
-      this.filter = filter;
-   }
+    /**
+     * What is matched
+     */
+    private List<VirtualFile> matched;
 
-   /**
-    * Get the matched files
-    * 
-    * @return the matched files
-    */
-   public List<VirtualFile> getMatched()
-   {
-      if (matched == null)
-         return Collections.emptyList();
-      else
-         return matched;
-   }
-   
-   public void visit(VirtualFile virtualFile)
-   {
-      if (filter.accepts(virtualFile))
-      {
-         if (matched == null)
-            matched = new ArrayList<VirtualFile>();
-         matched.add(virtualFile);
-      }
-   }
+    /**
+     * Check the attributes
+     *
+     * @param filter the filter
+     * @param attributes the attributes
+     *
+     * @return the attributes
+     *
+     * @throws IllegalArgumentException for a null filter
+     */
+    private static VisitorAttributes checkAttributes(VirtualFileFilter filter, VisitorAttributes attributes) {
+        if (filter == null)
+            throw new IllegalArgumentException("Null filter");
+        // Specified
+        if (attributes != null)
+            return attributes;
+        // From the filter
+        if (filter instanceof VirtualFileFilterWithAttributes)
+            return ((VirtualFileFilterWithAttributes) filter).getAttributes();
+        // It will use the default
+        return null;
+    }
+
+    /**
+     * Create a new FilterVirtualFileVisitor with default attributes
+     *
+     * @param filter the filter
+     *
+     * @throws IllegalArgumentException if the filter is null
+     */
+    public FilterVirtualFileVisitor(VirtualFileFilter filter) {
+        this(filter, null);
+    }
+
+    /**
+     * Create a new FilterVirtualFileVisitor.
+     *
+     * @param filter the filter
+     * @param attributes the attributes, uses the default if null
+     *
+     * @throws IllegalArgumentException if the filter is null
+     */
+    public FilterVirtualFileVisitor(VirtualFileFilter filter, VisitorAttributes attributes) {
+        super(checkAttributes(filter, attributes));
+        this.filter = filter;
+    }
+
+    /**
+     * Get the matched files
+     *
+     * @return the matched files
+     */
+    public List<VirtualFile> getMatched() {
+        if (matched == null)
+            return Collections.emptyList();
+        else
+            return matched;
+    }
+
+    public void visit(VirtualFile virtualFile) {
+        if (filter.accepts(virtualFile)) {
+            if (matched == null)
+                matched = new ArrayList<VirtualFile>();
+            matched.add(virtualFile);
+        }
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/MatchAllVirtualFileFilter.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/MatchAllVirtualFileFilter.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/MatchAllVirtualFileFilter.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -26,24 +26,24 @@
 
 /**
  * MatchAllVirtualFileFilter.
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
-public class MatchAllVirtualFileFilter implements VirtualFileFilter
-{
-   /** The instance */
-   public static final MatchAllVirtualFileFilter INSTANCE = new MatchAllVirtualFileFilter();
+public class MatchAllVirtualFileFilter implements VirtualFileFilter {
 
-   /**
-    * Singleton 
-    */
-   private MatchAllVirtualFileFilter()
-   {
-   }
-   
-   public boolean accepts(VirtualFile file)
-   {
-      return true;
-   }
+    /**
+     * The instance
+     */
+    public static final MatchAllVirtualFileFilter INSTANCE = new MatchAllVirtualFileFilter();
+
+    /**
+     * Singleton
+     */
+    private MatchAllVirtualFileFilter() {
+    }
+
+    public boolean accepts(VirtualFile file) {
+        return true;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/PathTokenizer.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/PathTokenizer.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/PathTokenizer.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -26,272 +26,270 @@
 
 /**
  * PathTokenizer.
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @author <a href="david.lloyd at jboss.com">David M. Lloyd</a>
  * @version $Revision: 1.1 $
  */
- at SuppressWarnings({"StringEquality"})
-public class PathTokenizer
-{
-   /** The reverse path const */
-   private static final String CURRENT_PATH = ".";
+ at SuppressWarnings({ "StringEquality" })
+public class PathTokenizer {
 
-   /** The reverse path const */
-   private static final String REVERSE_PATH = "..";
+    /**
+     * The reverse path const
+     */
+    private static final String CURRENT_PATH = ".";
 
-   /** Token states */
-   private static final int STATE_INITIAL = 0;
-   private static final int STATE_NORMAL = 1;
-   private static final int STATE_MAYBE_CURRENT_PATH = 2;
-   private static final int STATE_MAYBE_REVERSE_PATH = 3;
+    /**
+     * The reverse path const
+     */
+    private static final String REVERSE_PATH = "..";
 
-   /**
-    * Utility class
-    */
-   private PathTokenizer()
-   {
-   }
+    /**
+     * Token states
+     */
+    private static final int STATE_INITIAL = 0;
+    private static final int STATE_NORMAL = 1;
+    private static final int STATE_MAYBE_CURRENT_PATH = 2;
+    private static final int STATE_MAYBE_REVERSE_PATH = 3;
 
-   /**
-    * Get the remaining path from some tokens
-    *
-    * @param tokens the tokens
-    * @param i the current location
-    * @param end the end index
-    * @return the remaining path
-    * @throws IllegalArgumentException for null tokens or i is out of range
-    */
-   protected static String getRemainingPath(List<String> tokens, int i, int end)
-   {
-      if (tokens == null)
-         throw new IllegalArgumentException("Null tokens");
-      if (i < 0 || i >= end)
-         throw new IllegalArgumentException("i is not in the range of tokens: 0-" + (end-1));
+    /**
+     * Utility class
+     */
+    private PathTokenizer() {
+    }
 
-      if (i == end-1)
-         return tokens.get(end-1);
+    /**
+     * Get the remaining path from some tokens
+     *
+     * @param tokens the tokens
+     * @param i the current location
+     * @param end the end index
+     *
+     * @return the remaining path
+     *
+     * @throws IllegalArgumentException for null tokens or i is out of range
+     */
+    protected static String getRemainingPath(List<String> tokens, int i, int end) {
+        if (tokens == null)
+            throw new IllegalArgumentException("Null tokens");
+        if (i < 0 || i >= end)
+            throw new IllegalArgumentException("i is not in the range of tokens: 0-" + (end - 1));
+        if (i == end - 1)
+            return tokens.get(end - 1);
+        StringBuilder buffer = new StringBuilder();
+        for (; i < end - 1; ++i) {
+            buffer.append(tokens.get(i));
+            buffer.append("/");
+        }
+        buffer.append(tokens.get(end - 1));
+        return buffer.toString();
+    }
 
-      StringBuilder buffer = new StringBuilder();
-      for (; i < end-1; ++i)
-      {
-         buffer.append(tokens.get(i));
-         buffer.append("/");
-      }
-      buffer.append(tokens.get(end-1));
-      return buffer.toString();
-   }
+    /**
+     * Get the tokens that comprise this path.
+     *
+     * @param path the path
+     *
+     * @return the tokens or null if the path is empty
+     *
+     * @throws IllegalArgumentException if the path is null
+     */
+    public static List<String> getTokens(String path) {
+        if (path == null)
+            throw new IllegalArgumentException("Null path");
+        List<String> list = new ArrayList<String>();
+        getTokens(list, path);
+        return list;
+    }
 
-   /**
-    * Get the tokens that comprise this path.
-    * 
-    * @param path the path
-    * @return the tokens or null if the path is empty
-    * @throws IllegalArgumentException if the path is null
-    */
-   public static List<String> getTokens(String path)
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-
-      List<String> list = new ArrayList<String>();
-      getTokens(list, path);
-      return list;
-   }
-
-   /**
-    * Get the tokens that comprise this path and append them to the list.
-    *
-    * @param path the path
-    * @return the tokens or null if the path is empty
-    * @throws IllegalArgumentException if the path is null
-    */
-   public static void getTokens(List<String> list, String path)
-   {
-      int start = -1, length = path.length(), state = STATE_INITIAL;
-      char ch;
-      for (int index = 0; index < length; index ++) {
-         ch = path.charAt(index);
-         switch (ch) {
-            case '/': {
-               switch (state) {
-                  case STATE_INITIAL: {
-                     // skip extra leading /
-                     continue;
-                  }
-                  case STATE_MAYBE_CURRENT_PATH: {
-                     // it's '.'
-                     list.add(CURRENT_PATH);
-                     state = STATE_INITIAL;
-                     continue;
-                  }
-                  case STATE_MAYBE_REVERSE_PATH: {
-                     // it's '..'
-                     list.add(REVERSE_PATH);
-                     state = STATE_INITIAL;
-                     continue;
-                  }
-                  case STATE_NORMAL: {
-                     // it's just a normal path segment
-                     list.add(path.substring(start, index));
-                     state = STATE_INITIAL;
-                     continue;
-                  }
-               }
-               continue;
+    /**
+     * Get the tokens that comprise this path and append them to the list.
+     *
+     * @param path the path
+     *
+     * @return the tokens or null if the path is empty
+     *
+     * @throws IllegalArgumentException if the path is null
+     */
+    public static void getTokens(List<String> list, String path) {
+        int start = -1, length = path.length(), state = STATE_INITIAL;
+        char ch;
+        for (int index = 0; index < length; index++) {
+            ch = path.charAt(index);
+            switch (ch) {
+                case '/': {
+                    switch (state) {
+                        case STATE_INITIAL: {
+                            // skip extra leading /
+                            continue;
+                        }
+                        case STATE_MAYBE_CURRENT_PATH: {
+                            // it's '.'
+                            list.add(CURRENT_PATH);
+                            state = STATE_INITIAL;
+                            continue;
+                        }
+                        case STATE_MAYBE_REVERSE_PATH: {
+                            // it's '..'
+                            list.add(REVERSE_PATH);
+                            state = STATE_INITIAL;
+                            continue;
+                        }
+                        case STATE_NORMAL: {
+                            // it's just a normal path segment
+                            list.add(path.substring(start, index));
+                            state = STATE_INITIAL;
+                            continue;
+                        }
+                    }
+                    continue;
+                }
+                case '.': {
+                    switch (state) {
+                        case STATE_INITIAL: {
+                            // . is the first char; might be a special token
+                            state = STATE_MAYBE_CURRENT_PATH;
+                            start = index;
+                            continue;
+                        }
+                        case STATE_MAYBE_CURRENT_PATH: {
+                            // the second . in a row...
+                            state = STATE_MAYBE_REVERSE_PATH;
+                            continue;
+                        }
+                        case STATE_MAYBE_REVERSE_PATH: {
+                            // the third . in a row, guess it's just a weird path name
+                            state = STATE_NORMAL;
+                            continue;
+                        }
+                    }
+                    continue;
+                }
+                default: {
+                    switch (state) {
+                        case STATE_INITIAL: {
+                            state = STATE_NORMAL;
+                            start = index;
+                            continue;
+                        }
+                        case STATE_MAYBE_CURRENT_PATH:
+                        case STATE_MAYBE_REVERSE_PATH: {
+                            state = STATE_NORMAL;
+                        }
+                    }
+                }
             }
-            case '.': {
-               switch (state) {
-                  case STATE_INITIAL: {
-                     // . is the first char; might be a special token
-                     state = STATE_MAYBE_CURRENT_PATH;
-                     start = index;
-                     continue;
-                  }
-                  case STATE_MAYBE_CURRENT_PATH: {
-                     // the second . in a row...
-                     state = STATE_MAYBE_REVERSE_PATH;
-                     continue;
-                  }
-                  case STATE_MAYBE_REVERSE_PATH: {
-                     // the third . in a row, guess it's just a weird path name
-                     state = STATE_NORMAL;
-                     continue;
-                  }
-               }
-               continue;
+        }
+        // handle the last token
+        switch (state) {
+            case STATE_INITIAL: {
+                // trailing /
+                break;
             }
-            default: {
-               switch (state) {
-                  case STATE_INITIAL: {
-                     state = STATE_NORMAL;
-                     start = index;
-                     continue;
-                  }
-                  case STATE_MAYBE_CURRENT_PATH:
-                  case STATE_MAYBE_REVERSE_PATH: {
-                     state = STATE_NORMAL;
-                  }
-               }
+            case STATE_MAYBE_CURRENT_PATH: {
+                list.add(CURRENT_PATH);
+                break;
             }
-         }
-      }
-      // handle the last token
-      switch (state) {
-         case STATE_INITIAL: {
-            // trailing /
-            break;
-         }
-         case STATE_MAYBE_CURRENT_PATH: {
-            list.add(CURRENT_PATH);
-            break;
-         }
-         case STATE_MAYBE_REVERSE_PATH: {
-            list.add(REVERSE_PATH);
-            break;
-         }
-         case STATE_NORMAL: {
-            list.add(path.substring(start));
-            break;
-         }
-      }
-      return;
-   }
+            case STATE_MAYBE_REVERSE_PATH: {
+                list.add(REVERSE_PATH);
+                break;
+            }
+            case STATE_NORMAL: {
+                list.add(path.substring(start));
+                break;
+            }
+        }
+        return;
+    }
 
-   /**
-    * Get the remaining path from some tokens
-    * 
-    * @param tokens the tokens
-    * @param i the current location
-    * @return the remaining path
-    * @throws IllegalArgumentException for null tokens or i is out of range
-    */
-   public static String getRemainingPath(List<String> tokens, int i)
-   {
-      if (tokens == null)
-         throw new IllegalArgumentException("Null tokens");
+    /**
+     * Get the remaining path from some tokens
+     *
+     * @param tokens the tokens
+     * @param i the current location
+     *
+     * @return the remaining path
+     *
+     * @throws IllegalArgumentException for null tokens or i is out of range
+     */
+    public static String getRemainingPath(List<String> tokens, int i) {
+        if (tokens == null)
+            throw new IllegalArgumentException("Null tokens");
+        return getRemainingPath(tokens, i, tokens.size());
+    }
 
-      return getRemainingPath(tokens, i, tokens.size());
-   }
+    /**
+     * Apply any . or .. paths in the path param.
+     *
+     * @param path the path
+     *
+     * @return simple path, containing no . or .. paths
+     */
+    public static String applySpecialPaths(String path) throws IllegalArgumentException {
+        List<String> tokens = getTokens(path);
+        if (tokens == null)
+            return null;
+        int i = 0;
+        for (int j = 0; j < tokens.size(); j++) {
+            String token = tokens.get(j);
+            if (isCurrentToken(token))
+                continue;
+            else if (isReverseToken(token))
+                i--;
+            else
+                tokens.set(i++, token);
+            if (i < 0)
+                throw new IllegalArgumentException(".. on root path");
+        }
+        return getRemainingPath(tokens, 0, i);
+    }
 
-   /**
-    * Apply any . or .. paths in the path param.
-    *
-    * @param path the path
-    * @return simple path, containing no . or .. paths
-    */
-   public static String applySpecialPaths(String path) throws IllegalArgumentException
-   {
-      List<String> tokens = getTokens(path);
-      if (tokens == null)
-         return null;
+    /**
+     * Apply any . or .. paths in the pathTokens parameter, returning the minimal token list.
+     *
+     * @param pathTokens the path tokens
+     *
+     * @return the simple path tokens
+     *
+     * @throws IllegalArgumentException if reverse path goes over the top path
+     */
+    public static List<String> applySpecialPaths(List<String> pathTokens) throws IllegalArgumentException {
+        final ArrayList<String> newTokens = new ArrayList<String>();
+        for (String pathToken : pathTokens) {
+            if (isCurrentToken(pathToken))
+                continue;
+            else if (isReverseToken(pathToken)) {
+                final int size = newTokens.size();
+                if (size == 0) {
+                    throw new IllegalArgumentException(".. on root path");
+                }
+                newTokens.remove(size - 1);
+            } else
+                newTokens.add(pathToken);
+        }
+        return newTokens;
+    }
 
-      int i = 0;
-      for(int j = 0; j < tokens.size(); j++)
-      {
-         String token = tokens.get(j);
+    /**
+     * Is current token.
+     *
+     * @param token the token to check
+     *
+     * @return true if token matches current path token
+     */
+    public static boolean isCurrentToken(String token) {
+        return CURRENT_PATH == token;
+    }
 
-         if (isCurrentToken(token))
-            continue;
-         else if (isReverseToken(token))
-            i--;
-         else
-            tokens.set(i++, token);
-
-         if (i < 0)
-            throw new IllegalArgumentException(".. on root path");
-      }
-      return getRemainingPath(tokens, 0, i);
-   }
-
-   /**
-    * Apply any . or .. paths in the pathTokens parameter, returning the minimal token list.
-    *
-    * @param pathTokens the path tokens
-    * @return the simple path tokens
-    * @throws IllegalArgumentException if reverse path goes over the top path
-    */
-   public static List<String> applySpecialPaths(List<String> pathTokens) throws IllegalArgumentException
-   {
-      final ArrayList<String> newTokens = new ArrayList<String>();
-      for (String pathToken : pathTokens)
-      {
-         if (isCurrentToken(pathToken))
-            continue;
-         else if (isReverseToken(pathToken))
-         {
-            final int size = newTokens.size();
-            if (size == 0) {
-               throw new IllegalArgumentException(".. on root path");
-            }
-            newTokens.remove(size - 1);
-         }
-         else
-            newTokens.add(pathToken);
-      }
-      return newTokens;
-   }
-
-   /**
-    * Is current token.
-    *
-    * @param token the token to check
-    * @return true if token matches current path token
-    */
-   public static boolean isCurrentToken(String token)
-   {
-      return CURRENT_PATH == token;
-   }
-
-   /**
-    * Is reverse token.
-    *
-    * @param token the token to check
-    * @return true if token matches reverse path token
-    */
-   public static boolean isReverseToken(String token)
-   {
-      return REVERSE_PATH == token;
-   }
+    /**
+     * Is reverse token.
+     *
+     * @param token the token to check
+     *
+     * @return true if token matches reverse path token
+     */
+    public static boolean isReverseToken(String token) {
+        return REVERSE_PATH == token;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixMatchFilter.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixMatchFilter.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixMatchFilter.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -30,87 +30,89 @@
 import org.jboss.vfs.VisitorAttributes;
 
 /**
- * Matches a file name against a list of suffixes. 
- * 
+ * Matches a file name against a list of suffixes.
+ *
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
  * @version $Revision: 44223 $
  */
-public class SuffixMatchFilter extends AbstractVirtualFileFilterWithAttributes
-{
-   private static Logger log = Logger.getLogger(SuffixMatchFilter.class);
-   /** The suffixes */
-   private Collection<String> suffixes;
-   private boolean trace;
+public class SuffixMatchFilter extends AbstractVirtualFileFilterWithAttributes {
 
-   /**
-    * Create a new SuffixMatchFilter,
-    * using {@link VisitorAttributes#DEFAULT}
-    * 
-    * @param suffix the suffix
-    * @throws IllegalArgumentException for a null suffix
-    */
-   public SuffixMatchFilter(String suffix)
-   {
-      this(suffix, null);
-   }
-   
-   /**
-    * Create a new SuffixMatchFilter.
-    * 
-    * @param suffix the suffix
-    * @param attributes the attributes, pass null to use {@link VisitorAttributes#DEFAULT}
-    * @throws IllegalArgumentException for a null suffix
-    */
-   @SuppressWarnings("unchecked")      
-   public SuffixMatchFilter(String suffix, VisitorAttributes attributes)
-   {
-      this(Collections.singleton(suffix), attributes);
-   }
-   /**
-    * Create a new SuffixMatchFilter.
-    * @param suffixes - the list of file suffixes to accept.
-    * @throws IllegalArgumentException for a null suffixes
-    */
-   public SuffixMatchFilter(Collection<String> suffixes)
-   {
-      this(suffixes, null);
-   }
-   /**
-    * Create a new SuffixMatchFilter.
-    * @param suffixes - the list of file suffixes to accept.
-    * @param attributes the attributes, pass null to use {@link VisitorAttributes#DEFAULT}
-    * @throws IllegalArgumentException for a null suffixes
-    */
-   public SuffixMatchFilter(Collection<String> suffixes, VisitorAttributes attributes)
-   {
-      super(attributes == null ? VisitorAttributes.DEFAULT : attributes);
-      if (suffixes == null)
-         throw new IllegalArgumentException("Null suffixes");
-      this.suffixes = new LinkedHashSet<String>();
-      this.suffixes.addAll(suffixes);
-      trace = log.isTraceEnabled();
-   }
+    private static Logger log = Logger.getLogger(SuffixMatchFilter.class);
+    /**
+     * The suffixes
+     */
+    private Collection<String> suffixes;
+    private boolean trace;
 
-   /**
-    * Accept any file that ends with one of the filter suffixes. This checks
-    * that the file.getName() endsWith a suffix.
-    * @return true if the file matches a suffix, false otherwise.
-    */
-   public boolean accepts(VirtualFile file)
-   {
-      String name = file.getName();
-      boolean accepts = false;
-      for(String suffix : suffixes)
-      {
-         if (name.endsWith(suffix))
-         {
-            accepts = true;
-            break;
-         }
-      }
-      if( trace )
-         log.trace(file+" accepted: "+accepts);
-      return accepts;
-   }
+    /**
+     * Create a new SuffixMatchFilter, using {@link VisitorAttributes#DEFAULT}
+     *
+     * @param suffix the suffix
+     *
+     * @throws IllegalArgumentException for a null suffix
+     */
+    public SuffixMatchFilter(String suffix) {
+        this(suffix, null);
+    }
+
+    /**
+     * Create a new SuffixMatchFilter.
+     *
+     * @param suffix the suffix
+     * @param attributes the attributes, pass null to use {@link VisitorAttributes#DEFAULT}
+     *
+     * @throws IllegalArgumentException for a null suffix
+     */
+    @SuppressWarnings("unchecked")
+    public SuffixMatchFilter(String suffix, VisitorAttributes attributes) {
+        this(Collections.singleton(suffix), attributes);
+    }
+
+    /**
+     * Create a new SuffixMatchFilter.
+     *
+     * @param suffixes - the list of file suffixes to accept.
+     *
+     * @throws IllegalArgumentException for a null suffixes
+     */
+    public SuffixMatchFilter(Collection<String> suffixes) {
+        this(suffixes, null);
+    }
+
+    /**
+     * Create a new SuffixMatchFilter.
+     *
+     * @param suffixes - the list of file suffixes to accept.
+     * @param attributes the attributes, pass null to use {@link VisitorAttributes#DEFAULT}
+     *
+     * @throws IllegalArgumentException for a null suffixes
+     */
+    public SuffixMatchFilter(Collection<String> suffixes, VisitorAttributes attributes) {
+        super(attributes == null ? VisitorAttributes.DEFAULT : attributes);
+        if (suffixes == null)
+            throw new IllegalArgumentException("Null suffixes");
+        this.suffixes = new LinkedHashSet<String>();
+        this.suffixes.addAll(suffixes);
+        trace = log.isTraceEnabled();
+    }
+
+    /**
+     * Accept any file that ends with one of the filter suffixes. This checks that the file.getName() endsWith a suffix.
+     *
+     * @return true if the file matches a suffix, false otherwise.
+     */
+    public boolean accepts(VirtualFile file) {
+        String name = file.getName();
+        boolean accepts = false;
+        for (String suffix : suffixes) {
+            if (name.endsWith(suffix)) {
+                accepts = true;
+                break;
+            }
+        }
+        if (trace)
+            log.trace(file + " accepted: " + accepts);
+        return accepts;
+    }
 }

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixesExcludeFilter.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixesExcludeFilter.java	2009-08-04 22:31:25 UTC (rev 91988)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/util/SuffixesExcludeFilter.java	2009-08-04 22:45:47 UTC (rev 91989)
@@ -28,41 +28,40 @@
 
 /**
  * Filters out a set of suffixes
- * 
+ *
  * @author adrian at jboss.org
  * @version $Revision: 44223 $
  */
-public class SuffixesExcludeFilter implements VirtualFileFilter
-{
-   /** The suffixes */
-   private Collection<String> suffixes;
-   
-   /**
-    * Create a new SuffixMatchFilter,
-    * 
-    * @param suffixes the suffixes
-    * @throws IllegalArgumentException for null suffixes
-    */
-   public SuffixesExcludeFilter(Collection<String> suffixes)
-   {
-      if (suffixes == null)
-         throw new IllegalArgumentException("Null suffixes");
-      for (String suffix : suffixes)
-      {
-         if (suffix == null)
-            throw new IllegalArgumentException("Null suffix in " + suffixes);
-      }
-      this.suffixes = suffixes;
-   }
+public class SuffixesExcludeFilter implements VirtualFileFilter {
 
-   public boolean accepts(VirtualFile file)
-   {
-      String name = file.getName();
-      for(String suffix : suffixes)
-      {
-         if (name.endsWith(suffix))
-            return false;
-      }
-      return true;
-   }
+    /**
+     * The suffixes
+     */
+    private Collection<String> suffixes;
+
+    /**
+     * Create a new SuffixMatchFilter,
+     *
+     * @param suffixes the suffixes
+     *
+     * @throws IllegalArgumentException for null suffixes
+     */
+    public SuffixesExcludeFilter(Collection<String> suffixes) {
+        if (suffixes == null)
+            throw new IllegalArgumentException("Null suffixes");
+        for (String suffix : suffixes) {
+            if (suffix == null)
+                throw new IllegalArgumentException("Null suffix in " + suffixes);
+        }
+        this.suffixes = suffixes;
+    }
+
+    public boolean accepts(VirtualFile file) {
+        String name = file.getName();
+        for (String suffix : suffixes) {
+            if (name.endsWith(suffix))
+                return false;
+        }
+        return true;
+    }
 }




More information about the jboss-cvs-commits mailing list