[jboss-cvs] JBossAS SVN: r69084 - in projects/vfs/tags: 2.0.0.Beta7 and 11 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 17 15:18:03 EST 2008


Author: alesj
Date: 2008-01-17 15:18:02 -0500 (Thu, 17 Jan 2008)
New Revision: 69084

Added:
   projects/vfs/tags/2.0.0.Beta7/
   projects/vfs/tags/2.0.0.Beta7/pom.xml
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFS.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFSUtils.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VirtualFile.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VFSContext.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java
Removed:
   projects/vfs/tags/2.0.0.Beta7/pom.xml
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFS.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFSUtils.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VirtualFile.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VFSContext.java
   projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java
   projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java
Log:
[maven-scm] copy for tag 2.0.0.Beta7

Copied: projects/vfs/tags/2.0.0.Beta7 (from rev 68940, projects/vfs/trunk)

Deleted: projects/vfs/tags/2.0.0.Beta7/pom.xml
===================================================================
--- projects/vfs/trunk/pom.xml	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/pom.xml	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,149 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <groupId>org.jboss</groupId>
-    <artifactId>jboss-parent</artifactId>
-    <version>3</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.jboss</groupId>
-  <artifactId>jboss-vfs</artifactId>
-  <packaging>jar</packaging>
-  <version>2.0.0-SNAPSHOT</version>
-  <name>JBoss VFS</name>
-  <url>http://www.jboss.org</url>
-  <description>A VFS library</description>
- <scm>
-    <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta6</connection>    
-    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta6</developerConnection>
-    <url>https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta6</url>
-  </scm>
-  <licenses>
-    <license>
-      <name>lgpl</name>
-      <url>http://repository.jboss.org/licenses/lgpl.txt</url>
-    </license>
-  </licenses>
-  <organization>
-    <name>JBoss, A division of Red Hat, Inc</name>
-    <url>http://www.jboss.org</url>
-  </organization>
-
-  <properties>
-    <version.jboss.common.core>2.2.3.GA</version.jboss.common.core>
-    <version.jboss.logging>2.0.4.GA</version.jboss.logging>
-    <version.jboss.test>1.0.4.GA</version.jboss.test>
-    <version.junit>3.8.1</version.junit>
-  </properties>
-
-  <build>
-    <sourceDirectory>src/main/java</sourceDirectory>
-    <testSourceDirectory>src/test/java</testSourceDirectory>
-    <finalName>${artifactId}</finalName>
-    <testResources>
-      <testResource>
-        <directory>src/test/resources</directory>
-      </testResource>
-    </testResources>
-    <plugins>
-      
-      <!-- define how we want compilation to take place
-        here, we accept most of the defaults but say that we want the
-        optimization flag set, and define the source and target to be 1.5,
-        these setting will be inherited by child projects -->
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.0</version>
-        <configuration>
-          <debug>true</debug>
-          <source>1.5</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-      <!-- define that we wish to create src jars -->
-      <plugin>
-        <artifactId>maven-source-plugin</artifactId>
-        <inherited>true</inherited>
-        <executions>
-          <execution>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.3</version>
-        <configuration>
-          <testFailureIgnore>true</testFailureIgnore>
-          <disableXmlReport>false</disableXmlReport>
-          <forkMode>once</forkMode> <!-- required to correctly run the PojoServer tests -->
-          <useSystemClassLoader>true</useSystemClassLoader>
-          <redirectTestOutputToFile>true</redirectTestOutputToFile>
-        </configuration>
-      </plugin>
-      <plugin>
-         <groupId>org.apache.maven.plugins</groupId>
-         <artifactId>maven-release-plugin</artifactId>
-         <configuration>
-           <tagBase>https://svn.jboss.org/repos/jbossas/projects/vfs/tags</tagBase>
-         </configuration>
-       </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-common-core</artifactId>
-      <version>${version.jboss.common.core}</version>
-    </dependency>
-    <dependency>
-      <groupId>jboss</groupId>
-      <artifactId>jboss-common-logging-spi</artifactId>
-      <version>${version.jboss.logging}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-test</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>jboss</groupId>
-          <artifactId>jboss-common-core</artifactId>
-        </exclusion>
-      </exclusions>
-      <version>${version.jboss.test}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>${version.junit}</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <repositories>
-    <repository>
-      <id>jboss</id>
-      <name>JBoss Repository</name>
-      <url>http://repository.jboss.org/maven2</url>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-    <repository>
-      <id>jboss-snapshots</id>
-      <name>JBoss Snapshot Repository</name>
-      <url>http://snapshots.jboss.org/maven2</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-  
-</project>

Copied: projects/vfs/tags/2.0.0.Beta7/pom.xml (from rev 69083, projects/vfs/trunk/pom.xml)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/pom.xml	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/pom.xml	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,149 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>3</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss</groupId>
+  <artifactId>jboss-vfs</artifactId>
+  <packaging>jar</packaging>
+  <version>2.0.0.Beta7</version>
+  <name>JBoss VFS</name>
+  <url>http://www.jboss.org</url>
+  <description>A VFS library</description>
+ <scm>
+    <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta7</connection>    
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta7</developerConnection>
+    <url>https://svn.jboss.org/repos/jbossas/projects/vfs/tags/2.0.0.Beta7</url>
+  </scm>
+  <licenses>
+    <license>
+      <name>lgpl</name>
+      <url>http://repository.jboss.org/licenses/lgpl.txt</url>
+    </license>
+  </licenses>
+  <organization>
+    <name>JBoss, A division of Red Hat, Inc</name>
+    <url>http://www.jboss.org</url>
+  </organization>
+
+  <properties>
+    <version.jboss.common.core>2.2.3.GA</version.jboss.common.core>
+    <version.jboss.logging>2.0.4.GA</version.jboss.logging>
+    <version.jboss.test>1.0.4.GA</version.jboss.test>
+    <version.junit>3.8.1</version.junit>
+  </properties>
+
+  <build>
+    <sourceDirectory>src/main/java</sourceDirectory>
+    <testSourceDirectory>src/test/java</testSourceDirectory>
+    <finalName>${artifactId}</finalName>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+      </testResource>
+    </testResources>
+    <plugins>
+      
+      <!-- define how we want compilation to take place
+        here, we accept most of the defaults but say that we want the
+        optimization flag set, and define the source and target to be 1.5,
+        these setting will be inherited by child projects -->
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0</version>
+        <configuration>
+          <debug>true</debug>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <!-- define that we wish to create src jars -->
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <inherited>true</inherited>
+        <executions>
+          <execution>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.3</version>
+        <configuration>
+          <testFailureIgnore>true</testFailureIgnore>
+          <disableXmlReport>false</disableXmlReport>
+          <forkMode>once</forkMode> <!-- required to correctly run the PojoServer tests -->
+          <useSystemClassLoader>true</useSystemClassLoader>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+        </configuration>
+      </plugin>
+      <plugin>
+         <groupId>org.apache.maven.plugins</groupId>
+         <artifactId>maven-release-plugin</artifactId>
+         <configuration>
+           <tagBase>https://svn.jboss.org/repos/jbossas/projects/vfs/tags</tagBase>
+         </configuration>
+       </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-common-core</artifactId>
+      <version>${version.jboss.common.core}</version>
+    </dependency>
+    <dependency>
+      <groupId>jboss</groupId>
+      <artifactId>jboss-common-logging-spi</artifactId>
+      <version>${version.jboss.logging}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-test</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+      </exclusions>
+      <version>${version.jboss.test}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${version.junit}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <repositories>
+    <repository>
+      <id>jboss</id>
+      <name>JBoss Repository</name>
+      <url>http://repository.jboss.org/maven2</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>jboss-snapshots</id>
+      <name>JBoss Snapshot Repository</name>
+      <url>http://snapshots.jboss.org/maven2</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+  
+</project>

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFS.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFS.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,341 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.virtual.plugins.vfs.helpers.WrappingVirtualFileHandlerVisitor;
-import org.jboss.virtual.plugins.context.VfsArchiveBrowserFactory;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactory;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.util.file.ArchiveBrowser;
-
-/**
- * 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 VFS
-{
-   /** The VFS Context */
-   private final VFSContext context;
-
-   static
-   {
-      init();
-   }
-
-   /**
-    * Initialize VFS protocol handlers package property. 
-    */
-   public static void init()
-   {
-      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"))
-      {
-         pkgs += "|org.jboss.virtual.protocol";
-         System.setProperty("java.protocol.handler.pkgs", pkgs);
-      }
-      // keep this until AOP and HEM uses VFS internally instead of the stupid ArchiveBrowser crap.
-      ArchiveBrowser.factoryFinder.put("vfsfile", new VfsArchiveBrowserFactory());
-      ArchiveBrowser.factoryFinder.put("vfsjar", new VfsArchiveBrowserFactory());
-      ArchiveBrowser.factoryFinder.put("vfs", new VfsArchiveBrowserFactory());      
-   }
-
-   /**
-    * Get the virtual file system for a root uri
-    * 
-    * @param rootURI the root URI
-    * @return the virtual file system
-    * @throws IOException if there is a problem accessing the VFS
-    * @throws IllegalArgumentException if the rootURL is null
-    */
-   public static VFS getVFS(URI rootURI) throws IOException
-   {
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
-      if (factory == null)
-         throw new IOException("No context factory for " + rootURI);
-      VFSContext context = factory.getVFS(rootURI);
-      return context.getVFS();
-   }
-
-   /**
-    * Get the root virtual file
-    * 
-    * @param rootURI the root uri
-    * @return the virtual file
-    * @throws IOException if there is a problem accessing the VFS
-    * @throws IllegalArgumentException if the rootURL
-    */
-   public static VirtualFile getRoot(URI rootURI) throws IOException
-   {
-      VFS vfs = getVFS(rootURI);
-      return vfs.getRoot();
-   }
-
-   /**
-    * Get a virtual file
-    * 
-    * @param rootURI the root uri
-    * @param name the path name
-    * @return the virtual file
-    * @throws IOException if there is a problem accessing the VFS
-    * @throws IllegalArgumentException if the rootURL or name is null
-    */
-   public static VirtualFile getVirtualFile(URI rootURI, String name) throws IOException
-   {
-      VFS vfs = getVFS(rootURI);
-      return vfs.findChild(name);
-   }
-
-   /**
-    * Get the virtual file system for a root url
-    * 
-    * @param rootURL the root url
-    * @return the virtual file system
-    * @throws IOException if there is a problem accessing the VFS
-    * @throws IllegalArgumentException if the rootURL is null
-    */
-   public static VFS getVFS(URL rootURL) throws IOException
-   {
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
-      if (factory == null)
-         throw new IOException("No context factory for " + rootURL);
-      VFSContext context = factory.getVFS(rootURL);
-      return context.getVFS();
-   }
-
-   /**
-    * Get the root virtual file
-    * 
-    * @param rootURL the root url
-    * @return the virtual file
-    * @throws IOException if there is a problem accessing the VFS
-    * @throws IllegalArgumentException if the rootURL
-    */
-   public static VirtualFile getRoot(URL rootURL) throws IOException
-   {
-      VFS vfs = getVFS(rootURL);
-      return vfs.getRoot();
-   }
-
-   /**
-    * Get a virtual file
-    * 
-    * @param rootURL the root url
-    * @param name the path name
-    * @return the virtual file
-    * @throws IOException if there is a problem accessing the VFS
-    * @throws IllegalArgumentException if the rootURL or name is null
-    */
-   public static VirtualFile getVirtualFile(URL rootURL, String name) throws IOException
-   {
-      VFS vfs = getVFS(rootURL);
-      return vfs.findChild(name);
-   }
-
-   /**
-    * Create a new VFS.
-    * 
-    * @param context the context
-    * @throws IllegalArgumentException for a null context
-    */
-   public VFS(VFSContext context)
-   {
-      if (context == null)
-         throw new IllegalArgumentException("Null name");
-      this.context = context;
-   }
-   
-   /**
-    * Get the root file of this VFS
-    * 
-    * @return the root
-    * @throws IOException for any problem accessing the VFS
-    */
-   public VirtualFile getRoot() throws IOException
-   {
-      VirtualFileHandler handler = context.getRoot();
-      return handler.getVirtualFile();
-   }
-   
-   /**
-    * Find a child from the root
-    * 
-    * @param path the child path
-    * @return the child
-    * @throws IOException for any problem accessing the VFS (including the child does not exist)
-    * @throws IllegalArgumentException if the path is null
-    */
-   public VirtualFile findChild(String path) throws IOException
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-      
-      VirtualFileHandler handler = context.getRoot();
-      path = VFSUtils.fixName(path);
-      VirtualFileHandler result = context.findChild(handler, path);
-      return result.getVirtualFile();
-   }
-   
-   /**
-    * Find a child from the root
-    * 
-    * @Deprecated use {@link #findChild(String)}
-    * @param path the child path
-    * @return the child
-    * @throws IOException for any problem accessing the VFS (including the child does not exist)
-    * @throws IllegalArgumentException if the path is null
-    */
-   @Deprecated
-   public VirtualFile findChildFromRoot(String path) throws IOException
-   {
-      return findChild(path);
-   }
-   
-   /**
-    * Get the children
-    * 
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the root is a leaf node
-    */
-   public List<VirtualFile> getChildren() throws IOException
-   {
-      return getRoot().getChildren(null);
-   }
-
-   /**
-    * 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 root is a leaf node
-    */
-   public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException
-   {
-      return getRoot().getChildren(filter);
-   }
-   
-   /**
-    * 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 root is a leaf node
-    */
-   public List<VirtualFile> getChildrenRecursively() throws IOException
-   {
-      return getRoot().getChildrenRecursively(null);
-   }
-   
-   /**
-    * 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 root is a leaf node
-    */
-   public List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException
-   {
-      return getRoot().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
-    * @throws IllegalStateException if the root is a leaf node
-    */
-   public void visit(VirtualFileVisitor visitor) throws IOException
-   {
-      VirtualFileHandler handler = context.getRoot();
-      if (handler.isLeaf())
-         throw new IllegalStateException("File cannot contain children: " + handler);
-      
-      WrappingVirtualFileHandlerVisitor wrapper = new WrappingVirtualFileHandlerVisitor(visitor);
-      context.visit(handler, wrapper);
-   }
-
-   /**
-    * 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
-    * @throws IllegalStateException if the root is a leaf node
-    */
-   protected void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException
-   {
-      if (file == null)
-         throw new IllegalArgumentException("Null file");
-
-      VirtualFileHandler handler = file.getHandler();
-      WrappingVirtualFileHandlerVisitor wrapper = new WrappingVirtualFileHandlerVisitor(visitor);
-      VFSContext handlerContext = handler.getVFSContext();
-      handlerContext.visit(handler, wrapper);
-   }
-
-   @Override
-   public String toString()
-   {
-      return context.toString();
-   }
-
-   @Override
-   public int hashCode()
-   {
-      return context.hashCode();
-   }
-   
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj == this)
-         return true;
-      if (obj == null || obj instanceof VFS == false)
-         return false;
-      VFS other = (VFS) obj;
-      return context.equals(other.context);
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFS.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFS.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFS.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,361 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.virtual.plugins.vfs.helpers.WrappingVirtualFileHandlerVisitor;
+import org.jboss.virtual.plugins.context.VfsArchiveBrowserFactory;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VFSContextFactory;
+import org.jboss.virtual.spi.VFSContextFactoryLocator;
+import org.jboss.virtual.spi.VirtualFileHandler;
+import org.jboss.util.file.ArchiveBrowser;
+
+/**
+ * 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 VFS
+{
+   /** The VFS Context */
+   private final VFSContext context;
+
+   static
+   {
+      init();
+   }
+
+   /**
+    * Initialize VFS protocol handlers package property. 
+    */
+   public static void init()
+   {
+      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"))
+      {
+         pkgs += "|org.jboss.virtual.protocol";
+         System.setProperty("java.protocol.handler.pkgs", pkgs);
+      }
+      // keep this until AOP and HEM uses VFS internally instead of the stupid ArchiveBrowser crap.
+      ArchiveBrowser.factoryFinder.put("vfsfile", new VfsArchiveBrowserFactory());
+      ArchiveBrowser.factoryFinder.put("vfsjar", new VfsArchiveBrowserFactory());
+      ArchiveBrowser.factoryFinder.put("vfs", new VfsArchiveBrowserFactory());      
+   }
+
+   /**
+    * Get the virtual file system for a root uri
+    * 
+    * @param rootURI the root URI
+    * @return the virtual file system
+    * @throws IOException if there is a problem accessing the VFS
+    * @throws IllegalArgumentException if the rootURL is null
+    */
+   public static VFS getVFS(URI rootURI) throws IOException
+   {
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
+      if (factory == null)
+         throw new IOException("No context factory for " + rootURI);
+      VFSContext context = factory.getVFS(rootURI);
+      return context.getVFS();
+   }
+
+   /**
+    * Get the root virtual file
+    * 
+    * @param rootURI the root uri
+    * @return the virtual file
+    * @throws IOException if there is a problem accessing the VFS
+    * @throws IllegalArgumentException if the rootURL
+    */
+   public static VirtualFile getRoot(URI rootURI) throws IOException
+   {
+      VFS vfs = getVFS(rootURI);
+      return vfs.getRoot();
+   }
+
+   /**
+    * Get a virtual file
+    * 
+    * @param rootURI the root uri
+    * @param name the path name
+    * @return the virtual file
+    * @throws IOException if there is a problem accessing the VFS
+    * @throws IllegalArgumentException if the rootURL or name is null
+    */
+   public static VirtualFile getVirtualFile(URI rootURI, String name) throws IOException
+   {
+      VFS vfs = getVFS(rootURI);
+      return vfs.findChild(name);
+   }
+
+   /**
+    * Get the virtual file system for a root url
+    * 
+    * @param rootURL the root url
+    * @return the virtual file system
+    * @throws IOException if there is a problem accessing the VFS
+    * @throws IllegalArgumentException if the rootURL is null
+    */
+   public static VFS getVFS(URL rootURL) throws IOException
+   {
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
+      if (factory == null)
+         throw new IOException("No context factory for " + rootURL);
+      VFSContext context = factory.getVFS(rootURL);
+      return context.getVFS();
+   }
+
+   /**
+    * Get the root virtual file
+    * 
+    * @param rootURL the root url
+    * @return the virtual file
+    * @throws IOException if there is a problem accessing the VFS
+    * @throws IllegalArgumentException if the rootURL
+    */
+   public static VirtualFile getRoot(URL rootURL) throws IOException
+   {
+      VFS vfs = getVFS(rootURL);
+      return vfs.getRoot();
+   }
+
+   /**
+    * Get a virtual file
+    * 
+    * @param rootURL the root url
+    * @param name the path name
+    * @return the virtual file
+    * @throws IOException if there is a problem accessing the VFS
+    * @throws IllegalArgumentException if the rootURL or name is null
+    */
+   public static VirtualFile getVirtualFile(URL rootURL, String name) throws IOException
+   {
+      VFS vfs = getVFS(rootURL);
+      return vfs.findChild(name);
+   }
+
+   /**
+    * Create a new VFS.
+    * 
+    * @param context the context
+    * @throws IllegalArgumentException for a null context
+    */
+   public VFS(VFSContext context)
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null name");
+      this.context = context;
+   }
+   
+   /**
+    * Get the root file of this VFS
+    * 
+    * @return the root
+    * @throws IOException for any problem accessing the VFS
+    */
+   public VirtualFile getRoot() throws IOException
+   {
+      VirtualFileHandler handler = context.getRoot();
+      return handler.getVirtualFile();
+   }
+   
+   /**
+    * Find a child from the root
+    *
+    * @param path the child path
+    * @return the child
+    * @throws IOException for any problem accessing the VFS (including the child does not exist)
+    * @throws IllegalArgumentException if the path is null
+    * @deprecated use getChild, and handle null if not found
+    */
+   @Deprecated
+   public VirtualFile findChild(String path) throws IOException
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+      
+      VirtualFileHandler handler = context.getRoot();
+      VirtualFileHandler result = context.getChild(handler, VFSUtils.fixName(path));
+      if (result == null)
+         throw new IOException("Child not found " + path + " for " + handler);
+      return result.getVirtualFile();
+   }
+   
+   /**
+   * Get a child
+   *
+   * @param path the child path
+   * @return the child or <code>null</code> if not found
+   * @throws IOException if a real problem occurs
+   */
+   public VirtualFile getChild(String path) throws IOException
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      VirtualFileHandler handler = context.getRoot();
+      VirtualFileHandler result = context.getChild(handler, VFSUtils.fixName(path));
+      return result != null ? result.getVirtualFile() : null;
+   }
+
+   /**
+    * Find a child from the root
+    * 
+    * @deprecated use {@link #findChild(String)}
+    * @param path the child path
+    * @return the child
+    * @throws IOException for any problem accessing the VFS (including the child does not exist)
+    * @throws IllegalArgumentException if the path is null
+    */
+   @Deprecated
+   public VirtualFile findChildFromRoot(String path) throws IOException
+   {
+      return findChild(path);
+   }
+   
+   /**
+    * Get the children
+    * 
+    * @return the children
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if the root is a leaf node
+    */
+   public List<VirtualFile> getChildren() throws IOException
+   {
+      return getRoot().getChildren(null);
+   }
+
+   /**
+    * 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 root is a leaf node
+    */
+   public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException
+   {
+      return getRoot().getChildren(filter);
+   }
+   
+   /**
+    * 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 root is a leaf node
+    */
+   public List<VirtualFile> getChildrenRecursively() throws IOException
+   {
+      return getRoot().getChildrenRecursively(null);
+   }
+   
+   /**
+    * 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 root is a leaf node
+    */
+   public List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException
+   {
+      return getRoot().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
+    * @throws IllegalStateException if the root is a leaf node
+    */
+   public void visit(VirtualFileVisitor visitor) throws IOException
+   {
+      VirtualFileHandler handler = context.getRoot();
+      if (handler.isLeaf())
+         throw new IllegalStateException("File cannot contain children: " + handler);
+      
+      WrappingVirtualFileHandlerVisitor wrapper = new WrappingVirtualFileHandlerVisitor(visitor);
+      context.visit(handler, wrapper);
+   }
+
+   /**
+    * 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
+    * @throws IllegalStateException if the root is a leaf node
+    */
+   protected void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+
+      VirtualFileHandler handler = file.getHandler();
+      WrappingVirtualFileHandlerVisitor wrapper = new WrappingVirtualFileHandlerVisitor(visitor);
+      VFSContext handlerContext = handler.getVFSContext();
+      handlerContext.visit(handler, wrapper);
+   }
+
+   @Override
+   public String toString()
+   {
+      return context.toString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      return context.hashCode();
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+         return true;
+      if (obj == null || obj instanceof VFS == false)
+         return false;
+      VFS other = (VFS) obj;
+      return context.equals(other.context);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFSUtils.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFSUtils.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,370 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.virtual.spi.LinkInfo;
-
-/**
- * VFS Utilities
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSUtils
-{
-   /** The log */
-   private static final Logger log = Logger.getLogger(VFSUtils.class);
-   /** */
-   public static final String VFS_LINK_PREFIX = ".vfslink";
-   /** */
-   public static final String VFS_LINK_NAME = "vfs.link.name";
-   public static final String VFS_LINK_TARGET = "vfs.link.target";
-
-   /**
-    * 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)
-   {
-      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();
-   }
-   
-   /**
-    * 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");
-      
-      Manifest manifest = getManifest(file);
-      if (manifest == null)
-         return;
-
-      Attributes mainAttributes = manifest.getMainAttributes();
-      String classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
-      
-      if (classPath == null)
-      {
-         if (log.isTraceEnabled())
-            log.trace("Manifest has no Class-Path for " + file.getPathName());
-         return;
-      }
-      
-      VirtualFile parent = file.getParent();
-      if (parent == null)
-         throw new IllegalStateException(file + " has no parent.");
-
-      URL parentURL;
-      URL vfsRootURL;
-      int rootPathLength;
-      try
-      {
-         parentURL = parent.toURL();
-         vfsRootURL = file.getVFS().getRoot().toURL();
-         rootPathLength = vfsRootURL.getPath().length();
-      }
-      catch(URISyntaxException e)
-      {
-         IOException ioe = new IOException("Failed to get parent URL for " + file);
-         ioe.initCause(e);
-         throw ioe;
-      }
-
-      StringTokenizer tokenizer = new StringTokenizer(classPath);
-      while (tokenizer.hasMoreTokens())
-      {
-         String path = tokenizer.nextToken();
-         try
-         {
-            URL libURL = new URL(parentURL, path);
-            String libPath = libURL.getPath();
-            // TODO, this occurs for inner jars. Doubtful that such a mf cp is valid
-            if( rootPathLength > libPath.length() )
-               throw new IOException("Invalid rootPath: "+vfsRootURL+", libPath: "+libPath);
-            String vfsLibPath = libPath.substring(rootPathLength);
-            VirtualFile vf = file.getVFS().findChild(vfsLibPath);
-            paths.add(vf);
-         }
-         catch (IOException e)
-         {
-            log.debug("Manifest Class-Path entry " + path + " ignored for " + file.getPathName() + " reason=" + e);
-         }
-      }
-   }
-
-   /**
-    * 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;
-      try
-      {
-         manifest = archive.findChild(JarFile.MANIFEST_NAME); 
-      }
-      catch (IOException ignored)
-      {
-         if (log.isTraceEnabled())
-            log.trace("Can't find manifest for " + archive.getPathName());
-         return null;
-      }
-      return readManifest(manifest);
-   }
-
-   /**
-    * 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
-   {
-      InputStream stream = manifest.openStream();
-      try
-      {
-         return new Manifest(stream);
-      }
-      finally
-      {
-         try
-         {
-            stream.close();
-         }
-         catch (IOException ignored)
-         {
-         }
-      }
-   }
-
-   /**
-     * Get a manifest from a virtual file system,
-     * assuming the root of the VFS is the root of an archive
-     *
-     * @param archive the vfs
-     * @return the manifest or null if not found
-     * @throws IOException if there is an error reading the manifest
-     * @throws IllegalArgumentException for a null archive
-     */
-    public static Manifest getManifest(VFS archive) throws IOException
-    {
-       VirtualFile root = archive.getRoot();
-       return getManifest(root);
-    }
-   
-   /**
-    * 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;
-   }
-
-   /**
-    * 
-    * @param uri
-    * @return name from uri's path
-    */
-   public static String getName(URI 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;
-   }
-
-   /**
-    * 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 = new HashMap<String, String>();
-      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;
-   }
-
-   /**
-    * Does a vf name contain the VFS link prefix
-    * @param name - the name portion of a virtual file
-    * @return true if the name starts with VFS_LINK_PREFIX, false otherwise
-    */
-   public static boolean isLink(String name)
-   {
-      return name.indexOf(VFS_LINK_PREFIX) >= 0;
-   }
-
-   /**
-    * Read the link information from the stream based on the type as determined
-    * from the name suffix.
-    * 
-    * @param is - input stream to the link file contents
-    * @param name - the name of the virtual file representing the link
-    * @param props the propertes 
-    * @return a list of the links read from the stream
-    * @throws IOException on failure to read/parse the stream
-    * @throws URISyntaxException for an error parsing a URI
-    */
-   public static List<LinkInfo> readLinkInfo(InputStream is, String name, Properties props)
-      throws IOException, URISyntaxException
-   {
-      List<LinkInfo> info = new ArrayList<LinkInfo>();
-      if( name.endsWith(".properties") )
-         parseLinkProperties(is, info, props);
-      else
-         throw new UnsupportedEncodingException("Unknown link format: "+name);
-      return info;
-   }
-
-   /**
-    * Parse a properties link file
-    * 
-    * @param is - input stream to the link file contents
-    * @param info the link infos
-    * @param props the propertes 
-    * @throws IOException on failure to read/parse the stream
-    * @throws URISyntaxException for an error parsing a URI
-    */
-   public static void parseLinkProperties(InputStream is, List<LinkInfo> info, Properties props)
-      throws IOException, URISyntaxException
-   {
-      props.load(is);
-      // Iterate over the property tuples
-      for(int n = 0; ; n ++)
-      {
-         String nameKey = VFS_LINK_NAME + "." + n;
-         String name = props.getProperty(nameKey);
-         String uriKey = VFS_LINK_TARGET + "." + n;
-         String uri = props.getProperty(uriKey);
-         // End when the value is null since a link may not have a name
-         if (uri == null)
-         {
-            break;
-         }
-         // Replace any system property references
-         uri = StringPropertyReplacer.replaceProperties(uri);
-         LinkInfo link = new LinkInfo(name, new URI(uri));
-         info.add(link);
-      }
-   }
-
-   /**
-    * 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
-   {
-      String urispec = url.toExternalForm();
-      // Escape any spaces
-      urispec = urispec.replaceAll(" ", "%20");
-      return new URI(urispec);
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFSUtils.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFSUtils.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VFSUtils.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,370 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.virtual.spi.LinkInfo;
+
+/**
+ * VFS Utilities
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSUtils
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(VFSUtils.class);
+   /** */
+   public static final String VFS_LINK_PREFIX = ".vfslink";
+   /** */
+   public static final String VFS_LINK_NAME = "vfs.link.name";
+   public static final String VFS_LINK_TARGET = "vfs.link.target";
+
+   /**
+    * 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)
+   {
+      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();
+   }
+   
+   /**
+    * 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");
+      
+      Manifest manifest = getManifest(file);
+      if (manifest == null)
+         return;
+
+      Attributes mainAttributes = manifest.getMainAttributes();
+      String classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
+      
+      if (classPath == null)
+      {
+         if (log.isTraceEnabled())
+            log.trace("Manifest has no Class-Path for " + file.getPathName());
+         return;
+      }
+      
+      VirtualFile parent = file.getParent();
+      if (parent == null)
+         throw new IllegalStateException(file + " has no parent.");
+
+      URL parentURL;
+      URL vfsRootURL;
+      int rootPathLength;
+      try
+      {
+         parentURL = parent.toURL();
+         vfsRootURL = file.getVFS().getRoot().toURL();
+         rootPathLength = vfsRootURL.getPath().length();
+      }
+      catch(URISyntaxException e)
+      {
+         IOException ioe = new IOException("Failed to get parent URL for " + file);
+         ioe.initCause(e);
+         throw ioe;
+      }
+
+      StringTokenizer tokenizer = new StringTokenizer(classPath);
+      while (tokenizer.hasMoreTokens())
+      {
+         String path = tokenizer.nextToken();
+         try
+         {
+            URL libURL = new URL(parentURL, path);
+            String libPath = libURL.getPath();
+            // TODO, this occurs for inner jars. Doubtful that such a mf cp is valid
+            if( rootPathLength > libPath.length() )
+               throw new IOException("Invalid rootPath: "+vfsRootURL+", libPath: "+libPath);
+            String vfsLibPath = libPath.substring(rootPathLength);
+            VirtualFile vf = file.getVFS().findChild(vfsLibPath);
+            paths.add(vf);
+         }
+         catch (IOException e)
+         {
+            log.debug("Manifest Class-Path entry " + path + " ignored for " + file.getPathName() + " reason=" + e);
+         }
+      }
+   }
+
+   /**
+    * 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;
+      try
+      {
+         manifest = archive.findChild(JarFile.MANIFEST_NAME);
+      }
+      catch (IOException ignored)
+      {
+         if (log.isTraceEnabled())
+            log.trace("Can't find manifest for " + archive.getPathName());
+         return null;
+      }
+      return readManifest(manifest);
+   }
+
+   /**
+    * 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
+   {
+      InputStream stream = manifest.openStream();
+      try
+      {
+         return new Manifest(stream);
+      }
+      finally
+      {
+         try
+         {
+            stream.close();
+         }
+         catch (IOException ignored)
+         {
+         }
+      }
+   }
+
+   /**
+     * Get a manifest from a virtual file system,
+     * assuming the root of the VFS is the root of an archive
+     *
+     * @param archive the vfs
+     * @return the manifest or null if not found
+     * @throws IOException if there is an error reading the manifest
+     * @throws IllegalArgumentException for a null archive
+     */
+    public static Manifest getManifest(VFS archive) throws IOException
+    {
+       VirtualFile root = archive.getRoot();
+       return getManifest(root);
+    }
+   
+   /**
+    * 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;
+   }
+
+   /**
+    * 
+    * @param uri
+    * @return name from uri's path
+    */
+   public static String getName(URI 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;
+   }
+
+   /**
+    * 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 = new HashMap<String, String>();
+      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;
+   }
+
+   /**
+    * Does a vf name contain the VFS link prefix
+    * @param name - the name portion of a virtual file
+    * @return true if the name starts with VFS_LINK_PREFIX, false otherwise
+    */
+   public static boolean isLink(String name)
+   {
+      return name.indexOf(VFS_LINK_PREFIX) >= 0;
+   }
+
+   /**
+    * Read the link information from the stream based on the type as determined
+    * from the name suffix.
+    * 
+    * @param is - input stream to the link file contents
+    * @param name - the name of the virtual file representing the link
+    * @param props the propertes 
+    * @return a list of the links read from the stream
+    * @throws IOException on failure to read/parse the stream
+    * @throws URISyntaxException for an error parsing a URI
+    */
+   public static List<LinkInfo> readLinkInfo(InputStream is, String name, Properties props)
+      throws IOException, URISyntaxException
+   {
+      List<LinkInfo> info = new ArrayList<LinkInfo>();
+      if( name.endsWith(".properties") )
+         parseLinkProperties(is, info, props);
+      else
+         throw new UnsupportedEncodingException("Unknown link format: "+name);
+      return info;
+   }
+
+   /**
+    * Parse a properties link file
+    * 
+    * @param is - input stream to the link file contents
+    * @param info the link infos
+    * @param props the propertes 
+    * @throws IOException on failure to read/parse the stream
+    * @throws URISyntaxException for an error parsing a URI
+    */
+   public static void parseLinkProperties(InputStream is, List<LinkInfo> info, Properties props)
+      throws IOException, URISyntaxException
+   {
+      props.load(is);
+      // Iterate over the property tuples
+      for(int n = 0; ; n ++)
+      {
+         String nameKey = VFS_LINK_NAME + "." + n;
+         String name = props.getProperty(nameKey);
+         String uriKey = VFS_LINK_TARGET + "." + n;
+         String uri = props.getProperty(uriKey);
+         // End when the value is null since a link may not have a name
+         if (uri == null)
+         {
+            break;
+         }
+         // Replace any system property references
+         uri = StringPropertyReplacer.replaceProperties(uri);
+         LinkInfo link = new LinkInfo(name, new URI(uri));
+         info.add(link);
+      }
+   }
+
+   /**
+    * 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
+   {
+      String urispec = url.toExternalForm();
+      // Escape any spaces
+      urispec = urispec.replaceAll(" ", "%20");
+      return new URI(urispec);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VirtualFile.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VirtualFile.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VirtualFile.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,410 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.virtual ;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.jboss.util.collection.WeakSet;
-import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
-import org.jboss.virtual.plugins.vfs.helpers.MatchAllVirtualFileFilter;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * A virtual file as seen by the user
- *
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision: 44334 $
- */
-public class VirtualFile implements Serializable
-{
-   private static final long serialVersionUID = 1L;
-
-   /** The virtual file handler */
-   private final VirtualFileHandler handler;
-
-   /** Whether we are closed */
-   private AtomicBoolean closed = new AtomicBoolean(false);
-
-   /** The open streams */
-   private transient final Set<InputStream> streams = Collections.synchronizedSet(new WeakSet());
-
-   /**
-    * Create a new VirtualFile.
-    *
-    * @param handler the handler
-    * @throws IllegalArgumentException if the handler is null
-    */
-   public VirtualFile(VirtualFileHandler handler)
-   {
-      if (handler == null)
-         throw new IllegalArgumentException("Null handler");
-      this.handler = handler;
-   }
-
-   /**
-    * Get the virtual file handler
-    *
-    * @return the handler
-    * @throws IllegalStateException if the file is closed
-    */
-   public VirtualFileHandler getHandler()
-   {
-      if (closed.get())
-         throw new IllegalStateException("The virtual file is closed");
-      return handler;
-   }
-
-   /**
-    * Get the simple VF name (X.java)
-    *
-    * @return the simple file name
-    * @throws IllegalStateException if the file is closed
-    */
-   public String getName()
-   {
-      return getHandler().getName();
-   }
-
-   /**
-    * Get the VFS relative path name (org/jboss/X.java)
-    *
-    * @return the VFS relative path name
-    * @throws IllegalStateException if the file is closed
-    */
-   public String getPathName()
-   {
-      return getHandler().getPathName();
-   }
-
-   /**
-    * Get the VF URL (file://root/org/jboss/X.java)
-    *
-    * @return the full URL to the VF in the VFS.
-    * @throws MalformedURLException if a url cannot be parsed
-    * @throws URISyntaxException if a uri cannot be parsed
-    * @throws IllegalStateException if the file is closed
-    */
-   public URL toURL() throws MalformedURLException, URISyntaxException
-   {
-      return getHandler().toVfsUrl();
-   }
-
-   /**
-    * Get the VF URI (file://root/org/jboss/X.java)
-    *
-    * @return the full URI to the VF in the VFS.
-    * @throws URISyntaxException if a uri cannot be parsed
-    * @throws IllegalStateException if the file is closed
-    * @throws MalformedURLException for a bad url
-    */
-   public URI toURI() throws MalformedURLException, URISyntaxException
-   {
-      return VFSUtils.toURI(toURL());
-   }
-
-   /**
-    * When the file was last modified
-    *
-    * @return the last modified time
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed
-    */
-   public long getLastModified() throws IOException
-   {
-      return getHandler().getLastModified();
-   }
-
-   /**
-    * Returns true if the file has been modified since this method was last called
-    * Last modified time is initialized at handler instantiation.
-    *
-    * @return true if modifed, false otherwise
-    * @throws IOException for any error
-    */
-   public boolean hasBeenModified() throws IOException
-   {
-      return getHandler().hasBeenModified();
-   }
-
-   /**
-    * Get the size
-    *
-    * @return the size
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed
-    */
-   public long getSize() throws IOException
-   {
-      return getHandler().getSize();
-   }
-
-   /**
-    * 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
-   {
-      return getHandler().exists();      
-   }
-
-   /**
-    * 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
-    * @throws IllegalStateException if the file is closed
-    */
-   public boolean isLeaf() throws IOException
-   {
-      return getHandler().isLeaf();
-   }
-
-   /**
-    * Whether it is hidden
-    *
-    * @return true when hidden
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed
-    */
-   public boolean isHidden() throws IOException
-   {
-      return getHandler().isHidden();
-   }
-
-   /**
-    * Access the file contents.
-    *
-    * @return an InputStream for the file contents.
-    * @throws IOException for any error accessing the file system
-    * @throws IllegalStateException if the file is closed
-    */
-   public InputStream openStream() throws IOException
-   {
-      InputStream result = getHandler().openStream();
-      streams.add(result);
-      return result;
-   }
-
-   /**
-    * Close the streams
-    */
-   public void closeStreams()
-   {
-      // Close the streams
-      for (InputStream stream : streams)
-      {
-         if (stream != null)
-         {
-            try
-            {
-               stream.close();
-            }
-            catch (IOException ignored)
-            {
-            }
-         }
-      }
-      streams.clear();
-   }
-
-   /**
-    * Close the file resources (stream, etc.)
-    */
-   public void close()
-   {
-      if (closed.getAndSet(true) == false)
-      {
-         closeStreams();
-         handler.close();
-      }
-   }
-
-   /**
-    * Get the VFS instance for this virtual file
-    *
-    * @return the VFS
-    * @throws IllegalStateException if the file is closed
-    */
-   public VFS getVFS()
-   {
-      VFSContext context = getHandler().getVFSContext();
-      return context.getVFS();
-   }
-
-   /**
-    * Get the parent
-    *
-    * @return the parent or null if there is no parent
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed
-    */
-   public VirtualFile getParent() throws IOException
-   {
-      VirtualFileHandler parent = getHandler().getParent();
-      if (parent != null)
-         return parent.getVirtualFile();
-      return null;
-   }
-
-   /**
-    * Get the children
-    *
-    * @return the children
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if the file is closed
-    */
-   public List<VirtualFile> getChildren() throws IOException
-   {
-      return getChildren(null);
-   }
-
-   /**
-    * 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 (isLeaf())
-         throw new IllegalStateException("File cannot contain children: " + this);
-
-      if (filter == null)
-         filter = MatchAllVirtualFileFilter.INSTANCE;
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, null);
-      visit(visitor);
-      return visitor.getMatched();
-   }
-
-   /**
-    * 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>
-    *
-    * 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 (isLeaf())
-         throw new IllegalStateException("File cannot contain children: " + this);
-
-      if (filter == null)
-         filter = MatchAllVirtualFileFilter.INSTANCE;
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, VisitorAttributes.RECURSE);
-      visit(visitor);
-      return visitor.getMatched();
-   }
-
-   /**
-    * 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 or it is a leaf node
-    */
-   public void visit(VirtualFileVisitor visitor) throws IOException
-   {
-      if (isLeaf())
-         throw new IllegalStateException("File cannot contain children: " + this);
-
-      getVFS().visit(this, visitor);
-   }
-
-   /**
-    * Find a child
-    *
-    * @param path the path
-    * @return the child
-    * @throws IOException for any problem accessing the VFS (including the child does not exist)
-    * @throws IllegalArgumentException if the path is null
-    * @throws IllegalStateException if the file is closed or it is a leaf node
-    */
-   public VirtualFile findChild(String path) throws IOException
-   {
-      VirtualFileHandler handler = getHandler();
-
-      if (handler.isLeaf())
-         throw new IllegalStateException("File cannot contain children: " + this);
-
-      path = VFSUtils.fixName(path);
-      VirtualFileHandler child = handler.findChild(path);
-      return child.getVirtualFile();
-   }
-
-   @Override
-   public String toString()
-   {
-      return handler.toString();
-   }
-
-   @Override
-   public int hashCode()
-   {
-      return handler.hashCode();
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj == this)
-         return true;
-      if (obj == null || obj instanceof VirtualFile == false)
-         return false;
-      VirtualFile other = (VirtualFile) obj;
-      return handler.equals(other.handler);
-   }
-
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VirtualFile.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/VirtualFile.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VirtualFile.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/VirtualFile.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,433 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.virtual ;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.jboss.util.collection.WeakSet;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+import org.jboss.virtual.plugins.vfs.helpers.MatchAllVirtualFileFilter;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * A virtual file as seen by the user
+ *
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision: 44334 $
+ */
+public class VirtualFile implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   /** The virtual file handler */
+   private final VirtualFileHandler handler;
+
+   /** Whether we are closed */
+   private AtomicBoolean closed = new AtomicBoolean(false);
+
+   /** The open streams */
+   private transient final Set<InputStream> streams = Collections.synchronizedSet(new WeakSet());
+
+   /**
+    * Create a new VirtualFile.
+    *
+    * @param handler the handler
+    * @throws IllegalArgumentException if the handler is null
+    */
+   public VirtualFile(VirtualFileHandler handler)
+   {
+      if (handler == null)
+         throw new IllegalArgumentException("Null handler");
+      this.handler = handler;
+   }
+
+   /**
+    * Get the virtual file handler
+    *
+    * @return the handler
+    * @throws IllegalStateException if the file is closed
+    */
+   public VirtualFileHandler getHandler()
+   {
+      if (closed.get())
+         throw new IllegalStateException("The virtual file is closed");
+      return handler;
+   }
+
+   /**
+    * Get the simple VF name (X.java)
+    *
+    * @return the simple file name
+    * @throws IllegalStateException if the file is closed
+    */
+   public String getName()
+   {
+      return getHandler().getName();
+   }
+
+   /**
+    * Get the VFS relative path name (org/jboss/X.java)
+    *
+    * @return the VFS relative path name
+    * @throws IllegalStateException if the file is closed
+    */
+   public String getPathName()
+   {
+      return getHandler().getPathName();
+   }
+
+   /**
+    * Get the VF URL (file://root/org/jboss/X.java)
+    *
+    * @return the full URL to the VF in the VFS.
+    * @throws MalformedURLException if a url cannot be parsed
+    * @throws URISyntaxException if a uri cannot be parsed
+    * @throws IllegalStateException if the file is closed
+    */
+   public URL toURL() throws MalformedURLException, URISyntaxException
+   {
+      return getHandler().toVfsUrl();
+   }
+
+   /**
+    * Get the VF URI (file://root/org/jboss/X.java)
+    *
+    * @return the full URI to the VF in the VFS.
+    * @throws URISyntaxException if a uri cannot be parsed
+    * @throws IllegalStateException if the file is closed
+    * @throws MalformedURLException for a bad url
+    */
+   public URI toURI() throws MalformedURLException, URISyntaxException
+   {
+      return VFSUtils.toURI(toURL());
+   }
+
+   /**
+    * When the file was last modified
+    *
+    * @return the last modified time
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if the file is closed
+    */
+   public long getLastModified() throws IOException
+   {
+      return getHandler().getLastModified();
+   }
+
+   /**
+    * Returns true if the file has been modified since this method was last called
+    * Last modified time is initialized at handler instantiation.
+    *
+    * @return true if modifed, false otherwise
+    * @throws IOException for any error
+    */
+   public boolean hasBeenModified() throws IOException
+   {
+      return getHandler().hasBeenModified();
+   }
+
+   /**
+    * Get the size
+    *
+    * @return the size
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if the file is closed
+    */
+   public long getSize() throws IOException
+   {
+      return getHandler().getSize();
+   }
+
+   /**
+    * 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
+   {
+      return getHandler().exists();      
+   }
+
+   /**
+    * 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
+    * @throws IllegalStateException if the file is closed
+    */
+   public boolean isLeaf() throws IOException
+   {
+      return getHandler().isLeaf();
+   }
+
+   /**
+    * Whether it is hidden
+    *
+    * @return true when hidden
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if the file is closed
+    */
+   public boolean isHidden() throws IOException
+   {
+      return getHandler().isHidden();
+   }
+
+   /**
+    * Access the file contents.
+    *
+    * @return an InputStream for the file contents.
+    * @throws IOException for any error accessing the file system
+    * @throws IllegalStateException if the file is closed
+    */
+   public InputStream openStream() throws IOException
+   {
+      InputStream result = getHandler().openStream();
+      streams.add(result);
+      return result;
+   }
+
+   /**
+    * Close the streams
+    */
+   public void closeStreams()
+   {
+      // Close the streams
+      for (InputStream stream : streams)
+      {
+         if (stream != null)
+         {
+            try
+            {
+               stream.close();
+            }
+            catch (IOException ignored)
+            {
+            }
+         }
+      }
+      streams.clear();
+   }
+
+   /**
+    * Close the file resources (stream, etc.)
+    */
+   public void close()
+   {
+      if (closed.getAndSet(true) == false)
+      {
+         closeStreams();
+         handler.close();
+      }
+   }
+
+   /**
+    * Get the VFS instance for this virtual file
+    *
+    * @return the VFS
+    * @throws IllegalStateException if the file is closed
+    */
+   public VFS getVFS()
+   {
+      VFSContext context = getHandler().getVFSContext();
+      return context.getVFS();
+   }
+
+   /**
+    * Get the parent
+    *
+    * @return the parent or null if there is no parent
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if the file is closed
+    */
+   public VirtualFile getParent() throws IOException
+   {
+      VirtualFileHandler parent = getHandler().getParent();
+      if (parent != null)
+         return parent.getVirtualFile();
+      return null;
+   }
+
+   /**
+    * Get the children
+    *
+    * @return the children
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if the file is closed
+    */
+   public List<VirtualFile> getChildren() throws IOException
+   {
+      return getChildren(null);
+   }
+
+   /**
+    * 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 (isLeaf())
+         throw new IllegalStateException("File cannot contain children: " + this);
+
+      if (filter == null)
+         filter = MatchAllVirtualFileFilter.INSTANCE;
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, null);
+      visit(visitor);
+      return visitor.getMatched();
+   }
+
+   /**
+    * 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>
+    *
+    * 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 (isLeaf())
+         throw new IllegalStateException("File cannot contain children: " + this);
+
+      if (filter == null)
+         filter = MatchAllVirtualFileFilter.INSTANCE;
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, VisitorAttributes.RECURSE);
+      visit(visitor);
+      return visitor.getMatched();
+   }
+
+   /**
+    * 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 or it is a leaf node
+    */
+   public void visit(VirtualFileVisitor visitor) throws IOException
+   {
+      if (isLeaf())
+         throw new IllegalStateException("File cannot contain children: " + this);
+
+      getVFS().visit(this, visitor);
+   }
+
+   /**
+    * Find a child
+    *
+    * @param path the path
+    * @return the child
+    * @throws IOException for any problem accessing the VFS (including the child does not exist)
+    * @throws IllegalArgumentException if the path is null
+    * @throws IllegalStateException if the file is closed or it is a leaf node
+    * @deprecated use getChild, and handle null if not found
+    */
+   @Deprecated
+   public VirtualFile findChild(String path) throws IOException
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      VirtualFileHandler handler = getHandler();      
+      if (handler.isLeaf())
+         throw new IllegalStateException("File cannot contain children: " + this);
+
+      VirtualFileHandler child = handler.getChild(VFSUtils.fixName(path));
+      if (child == null)
+         throw new IOException("Child not found " + path + " for " + handler);
+      return child.getVirtualFile();
+   }
+
+   /**
+    * Get a child
+    *
+    * @param path the path
+    * @return the child or <code>null</code> if not found
+    * @throws IOException for any problem accessing the VFS
+    * @throws IllegalArgumentException if the path is null
+    * @throws IllegalStateException if the file is closed or it is a leaf node
+    */
+   public VirtualFile getChild(String path) throws IOException
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      VirtualFileHandler handler = getHandler();
+      VirtualFileHandler child = handler.getChild(VFSUtils.fixName(path));
+      return child != null ? child.getVirtualFile() : null;
+   }
+
+   @Override
+   public String toString()
+   {
+      return handler.toString();
+   }
+
+   @Override
+   public int hashCode()
+   {
+      return handler.hashCode();
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+         return true;
+      if (obj == null || obj instanceof VirtualFile == false)
+         return false;
+      VirtualFile other = (VirtualFile) obj;
+      return handler.equals(other.handler);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,249 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.virtual.spi.VirtualFileHandlerVisitor;
-
-/**
- * AbstractVFSContext.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractVFSContext implements VFSContext
-{
-   /** The log */
-   protected final Logger log = Logger.getLogger(getClass());
-   
-   /** The VFS wrapper */
-   private VFS vfs;
-   
-   /** The root url */
-   private final URI rootURI;
-
-   /** Options associated with the root URL */
-   private Map<String, String> rootOptions;
-
-   /**
-    * Create a new AbstractVFSContext.
-    * 
-    * @param rootURI the root url
-    * @throws IllegalArgumentException if rootURI is null
-    */
-   protected AbstractVFSContext(URI rootURI)
-   {
-      if (rootURI == null)
-         throw new IllegalArgumentException("Null rootURI");
-      this.rootURI = rootURI;
-      String query = rootURI.getQuery();
-      rootOptions = VFSUtils.parseURLQuery(query);
-   }
-
-   /**
-    * Create a new AbstractVFSContext.
-    * 
-    * @param rootURL the root url
-    * @throws URISyntaxException for illegal URL
-    * @throws IllegalArgumentException if rootURI is null
-    */
-   protected AbstractVFSContext(URL rootURL) throws URISyntaxException
-   {
-      this(rootURL.toURI());
-   }
-
-   public VFS getVFS()
-   {
-      if (vfs == null)
-         vfs = new VFS(this);
-      return vfs;
-   }
-
-   public URI getRootURI()
-   {
-      return rootURI;
-   }
-
-   protected void addOption(String key, String value)
-   {
-      rootOptions.put(key, value);
-   }
-
-   public Map<String, String> getOptions()
-   {
-      return Collections.unmodifiableMap(rootOptions);
-   }
-
-   public List<VirtualFileHandler> getChildren(VirtualFileHandler parent, boolean ignoreErrors) throws IOException
-   {
-      if (parent == null)
-         throw new IllegalArgumentException("Null parent");
-      return parent.getChildren(ignoreErrors);
-   }
-
-   public VirtualFileHandler findChild(VirtualFileHandler parent, String path) throws IOException
-   {
-      if (parent == null)
-         throw new IllegalArgumentException("Null parent");
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-      return parent.findChild(path);
-   }
-
-   public void visit(VirtualFileHandler handler, VirtualFileHandlerVisitor visitor) throws IOException
-   {
-      if (handler == null)
-         throw new IllegalArgumentException("Null handler");
-      if (visitor == null)
-         throw new IllegalArgumentException("Null visitor");
-      
-      VisitorAttributes attributes = visitor.getAttributes();
-      boolean includeRoot = attributes.isIncludeRoot();
-      boolean leavesOnly = attributes.isLeavesOnly();
-      boolean ignoreErrors = attributes.isIgnoreErrors();
-      boolean includeHidden = attributes.isIncludeHidden();
-      VirtualFileFilter recurseFilter = attributes.getRecurseFilter();
-      visit(handler, visitor, includeRoot, leavesOnly, ignoreErrors,
-            includeHidden, recurseFilter);
-   }
-
-   /**
-    * Visit. the file system, recursive death checking is left to the visitor
-    * or otherwise a stack overflow.
-    * 
-    * @param handler the reference handler
-    * @param visitor the visitor
-    * @param includeRoot whether to visit the root
-    * @param leavesOnly whether to visit leaves only
-    * @param ignoreErrors whether to ignore errors
-    * @param includeHidden whether to include hidden files
-    * @param recurseFilter the recurse filter
-    * @throws IOException for any problem accessing the virtual file system
-    */
-   protected void visit(VirtualFileHandler handler, VirtualFileHandlerVisitor visitor,
-         boolean includeRoot, boolean leavesOnly, boolean ignoreErrors,
-         boolean includeHidden, VirtualFileFilter recurseFilter)
-      throws IOException
-   {
-      // Visit the root when asked
-      if (includeRoot)
-         visitor.visit(handler);
-      
-      // Visit the children
-      boolean trace = log.isTraceEnabled();
-      List<VirtualFileHandler> children;
-      try
-      {
-          children = getChildren(handler, ignoreErrors);
-      }
-      catch (IOException e)
-      {
-         if (ignoreErrors == false)
-            throw e;
-         if( trace )
-            log.trace("Ignored: " + e);
-         return;
-      }
-      
-      // Look through each child
-      for (VirtualFileHandler child : children)
-      {
-         // Ignore hidden if asked
-         if (includeHidden == false && child.isHidden())
-         {
-            if( trace )
-               log.trace("Ignoring hidden file: "+child);
-            continue;
-         }
-         
-         // Visit the leaf or non-leaves when asked
-         boolean isLeaf = child.isLeaf();
-         if (leavesOnly == false || isLeaf)
-            visitor.visit(child);
-         else if( trace )
-         {
-            log.trace("Skipping non-leaf file: "+child);
-         }
-
-         // Recurse when asked
-         VirtualFile file = child.getVirtualFile();
-         if ( isLeaf == false && recurseFilter != null && recurseFilter.accepts(file))
-         {
-            try
-            {
-               visit(child, visitor, false, leavesOnly, ignoreErrors, includeHidden, recurseFilter);
-            }
-            catch (StackOverflowError e)
-            {
-               log.debug("Original: " + child, e);
-               throw new IOException("Stack overflow, the file system is too complicated? " + child);
-            }
-         }
-      }
-   }
-   
-   @Override
-   public String toString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append(getClass().getSimpleName());
-      buffer.append('@');
-      buffer.append(System.identityHashCode(this));
-      buffer.append('[');
-      buffer.append(rootURI);
-      buffer.append(']');
-      return buffer.toString();
-   }
-   
-   @Override
-   public int hashCode()
-   {
-      return rootURI.hashCode();
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (this == obj)
-         return true;
-      if (obj == null || obj instanceof VFSContext == false)
-         return false;
-      VFSContext other = (VFSContext) obj;
-      return rootURI.equals(other.getRootURI());
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,248 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+import org.jboss.virtual.spi.VirtualFileHandlerVisitor;
+
+/**
+ * AbstractVFSContext.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractVFSContext implements VFSContext
+{
+   /** The log */
+   protected final Logger log = Logger.getLogger(getClass());
+   
+   /** The VFS wrapper */
+   private VFS vfs;
+   
+   /** The root url */
+   private final URI rootURI;
+
+   /** Options associated with the root URL */
+   private Map<String, String> rootOptions;
+
+   /**
+    * Create a new AbstractVFSContext.
+    * 
+    * @param rootURI the root url
+    * @throws IllegalArgumentException if rootURI is null
+    */
+   protected AbstractVFSContext(URI rootURI)
+   {
+      if (rootURI == null)
+         throw new IllegalArgumentException("Null rootURI");
+      this.rootURI = rootURI;
+      String query = rootURI.getQuery();
+      rootOptions = VFSUtils.parseURLQuery(query);
+   }
+
+   /**
+    * Create a new AbstractVFSContext.
+    * 
+    * @param rootURL the root url
+    * @throws URISyntaxException for illegal URL
+    * @throws IllegalArgumentException if rootURI is null
+    */
+   protected AbstractVFSContext(URL rootURL) throws URISyntaxException
+   {
+      this(rootURL.toURI());
+   }
+
+   public VFS getVFS()
+   {
+      if (vfs == null)
+         vfs = new VFS(this);
+      return vfs;
+   }
+
+   public URI getRootURI()
+   {
+      return rootURI;
+   }
+
+   protected void addOption(String key, String value)
+   {
+      rootOptions.put(key, value);
+   }
+
+   public Map<String, String> getOptions()
+   {
+      return Collections.unmodifiableMap(rootOptions);
+   }
+
+   public List<VirtualFileHandler> getChildren(VirtualFileHandler parent, boolean ignoreErrors) throws IOException
+   {
+      if (parent == null)
+         throw new IllegalArgumentException("Null parent");
+      return parent.getChildren(ignoreErrors);
+   }
+
+   public VirtualFileHandler getChild(VirtualFileHandler parent, String path) throws IOException
+   {
+      if (parent == null)
+         throw new IllegalArgumentException("Null parent");
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+      return parent.getChild(path);
+   }
+
+   public void visit(VirtualFileHandler handler, VirtualFileHandlerVisitor visitor) throws IOException
+   {
+      if (handler == null)
+         throw new IllegalArgumentException("Null handler");
+      if (visitor == null)
+         throw new IllegalArgumentException("Null visitor");
+      
+      VisitorAttributes attributes = visitor.getAttributes();
+      boolean includeRoot = attributes.isIncludeRoot();
+      boolean leavesOnly = attributes.isLeavesOnly();
+      boolean ignoreErrors = attributes.isIgnoreErrors();
+      boolean includeHidden = attributes.isIncludeHidden();
+      VirtualFileFilter recurseFilter = attributes.getRecurseFilter();
+      visit(handler, visitor, includeRoot, leavesOnly, ignoreErrors, includeHidden, recurseFilter);
+   }
+
+   /**
+    * Visit. the file system, recursive death checking is left to the visitor
+    * or otherwise a stack overflow.
+    * 
+    * @param handler the reference handler
+    * @param visitor the visitor
+    * @param includeRoot whether to visit the root
+    * @param leavesOnly whether to visit leaves only
+    * @param ignoreErrors whether to ignore errors
+    * @param includeHidden whether to include hidden files
+    * @param recurseFilter the recurse filter
+    * @throws IOException for any problem accessing the virtual file system
+    */
+   protected void visit(VirtualFileHandler handler, VirtualFileHandlerVisitor visitor,
+         boolean includeRoot, boolean leavesOnly, boolean ignoreErrors,
+         boolean includeHidden, VirtualFileFilter recurseFilter)
+      throws IOException
+   {
+      // Visit the root when asked
+      if (includeRoot)
+         visitor.visit(handler);
+      
+      // Visit the children
+      boolean trace = log.isTraceEnabled();
+      List<VirtualFileHandler> children;
+      try
+      {
+          children = getChildren(handler, ignoreErrors);
+      }
+      catch (IOException e)
+      {
+         if (ignoreErrors == false)
+            throw e;
+         if( trace )
+            log.trace("Ignored: " + e);
+         return;
+      }
+      
+      // Look through each child
+      for (VirtualFileHandler child : children)
+      {
+         // Ignore hidden if asked
+         if (includeHidden == false && child.isHidden())
+         {
+            if( trace )
+               log.trace("Ignoring hidden file: "+child);
+            continue;
+         }
+         
+         // Visit the leaf or non-leaves when asked
+         boolean isLeaf = child.isLeaf();
+         if (leavesOnly == false || isLeaf)
+            visitor.visit(child);
+         else if( trace )
+         {
+            log.trace("Skipping non-leaf file: "+child);
+         }
+
+         // Recurse when asked
+         VirtualFile file = child.getVirtualFile();
+         if ( isLeaf == false && recurseFilter != null && recurseFilter.accepts(file))
+         {
+            try
+            {
+               visit(child, visitor, false, leavesOnly, ignoreErrors, includeHidden, recurseFilter);
+            }
+            catch (StackOverflowError e)
+            {
+               log.debug("Original: " + child, e);
+               throw new IOException("Stack overflow, the file system is too complicated? " + child);
+            }
+         }
+      }
+   }
+   
+   @Override
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName());
+      buffer.append('@');
+      buffer.append(System.identityHashCode(this));
+      buffer.append('[');
+      buffer.append(rootURI);
+      buffer.append(']');
+      return buffer.toString();
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return rootURI.hashCode();
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (obj == null || obj instanceof VFSContext == false)
+         return false;
+      VFSContext other = (VFSContext) obj;
+      return rootURI.equals(other.getRootURI());
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,483 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamField;
-import java.io.ObjectInputStream.GetField;
-import java.io.ObjectOutputStream.PutField;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactory;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * AbstractVirtualFileHandler.
- * 
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractVirtualFileHandler implements VirtualFileHandler
-{
-   /** The log */
-   protected static final Logger log = Logger.getLogger(AbstractVirtualFileHandler.class);
-   /** serialVersionUID */
-   private static final long serialVersionUID = 1L;
-   /** The class serial fields */
-   private static final ObjectStreamField[] serialPersistentFields = {
-      new ObjectStreamField("rootURI", URI.class),
-      new ObjectStreamField("parent", VirtualFileHandler.class),
-      new ObjectStreamField("name", String.class),
-      new ObjectStreamField("vfsUrl", URL.class)
-   };
-
-   /** The VFS context
-    * @serialField rootURI URI the VFS context rootURI
-    */
-   private VFSContext context;
-   
-   /** The parent
-    * @serialField parent VirtualFileHandler the virtual file parent
-    */
-   private VirtualFileHandler parent;
-
-   /** The name
-    * @serialField name String the virtual file name
-    */
-   private String name;
-
-   /** The vfsPath */
-   private transient String vfsPath;
-
-   /** The vfs URL */
-   private URL vfsUrl;
-
-   /** The reference count */
-   private transient AtomicInteger references = new AtomicInteger(0);
-
-   /** The cached last modified */
-   protected transient long cachedLastModified;
-
-   /**
-    * Create a new handler
-    * 
-    * @param context the context
-    * @param parent the parent
-    * @param name the name
-    * @throws IllegalArgumentException if the context or name is null;
-    */
-   protected AbstractVirtualFileHandler(VFSContext context, VirtualFileHandler parent, String name)
-   {
-      if (context == null)
-         throw new IllegalArgumentException("Null context");
-      if (name == null)
-         throw new IllegalArgumentException("Null name");
-      this.context = context;
-      this.parent = parent;
-      this.name = VFSUtils.fixName(name);
-   }
-
-   /**
-    * Check if parent exists.
-    */
-   protected void checkParentExists()
-   {
-      if (parent == null)
-         throw new IllegalArgumentException("Parent must exist!");
-   }
-
-   /**
-    * Get child url.
-    *
-    * @param childPath the child path
-    * @param isDirectory is directory
-    * @return full child URL
-    * @throws IOException for any io error
-    * @throws URISyntaxException for any uri error
-    */
-   protected URL getChildVfsUrl(String childPath, boolean isDirectory) throws IOException, URISyntaxException
-   {
-      checkParentExists();
-      URL parentVfsUrl = getParent().toVfsUrl();
-      String vfsUrlString = parentVfsUrl.toString();
-      if (vfsUrlString.length() > 0 && vfsUrlString.endsWith("/") == false)
-         vfsUrlString += "/";
-      vfsUrlString += childPath;
-      if (isDirectory && vfsUrlString.endsWith("/") == false)
-         vfsUrlString += "/";
-      return new URL(vfsUrlString);
-   }
-
-   /**
-    * Get child path name.
-    *
-    * @param childPath the child path
-    * @param isDirectory is directory
-    * @return full child URL
-    * @throws IOException for any io error
-    */
-   protected String getChildPathName(String childPath, boolean isDirectory) throws IOException
-   {
-      checkParentExists();
-      String childPathName = getParent().getPathName();
-      if (childPathName.length() > 0 && childPathName.endsWith("/") == false)
-         childPathName += "/";
-      childPathName += childPath;
-      if (isDirectory && childPathName.endsWith("/") == false)
-         childPathName += "/";
-      return childPathName;
-   }
-
-   public boolean hasBeenModified() throws IOException
-   {
-      boolean hasBeenModified = false;
-      long last = getLastModified();
-      if (cachedLastModified != last)
-      {
-         hasBeenModified = cachedLastModified != 0;
-         cachedLastModified = last;
-      }
-      return hasBeenModified;
-   }
-
-   public String getName()
-   {
-      return name;
-   }
-
-   public String getPathName()
-   {
-      if (vfsPath == null)
-      {
-         StringBuilder pathName = new StringBuilder();
-         initPath(pathName);
-         vfsPath = pathName.toString();
-      }
-      return vfsPath;
-   }
-
-   /**
-    * todo This is a hack until we can fix http://jira.jboss.com/jira/browse/JBMICROCONT-164
-    *
-    * @param path
-    */
-   public void setPathName(String path)
-   {
-      this.vfsPath = path;
-   }
-
-   public URL toURL() throws MalformedURLException, URISyntaxException
-   {
-      return toURI().toURL();
-   }
-
-   public URL toVfsUrl() throws MalformedURLException, URISyntaxException
-   {
-      return vfsUrl;
-   }
-
-   /**
-    * Get VFS url.
-    *
-    * @return vfs url
-    */
-   protected URL getVfsUrl()
-   {
-      return vfsUrl;
-   }
-
-   /**
-    * Set the vfs URL.
-    *
-    * @param vfsUrl vfs url
-    */
-   protected void setVfsUrl(URL vfsUrl)
-   {
-      this.vfsUrl = vfsUrl;
-   }
-
-   /**
-    * Initialise the path into the path name
-    * 
-    * @param pathName the path name
-    * @return whether it added anything
-    */
-   private boolean initPath(StringBuilder pathName)
-   {
-      if (parent != null)
-      {
-         if (parent instanceof AbstractVirtualFileHandler)
-         {
-            AbstractVirtualFileHandler handler = (AbstractVirtualFileHandler) parent;
-            if (handler.initPath(pathName))
-               pathName.append('/');
-         }
-         else
-         {
-            pathName.append(parent.getPathName());
-         }
-         pathName.append(getName());
-         return true;
-      }
-      return false;
-   }
-   
-   public VirtualFile getVirtualFile()
-   {
-      checkClosed();
-      increment();
-      return new VirtualFile(this);
-   }
-   
-   public VirtualFileHandler getParent() throws IOException
-   {
-      checkClosed();
-      return parent;
-   }
-   
-   public VFSContext getVFSContext()
-   {
-      checkClosed();
-      return context;
-   }
-
-   /**
-    * Increment the reference count
-    * 
-    * @return the resulting count
-    */
-   protected int increment()
-   {
-      return references.incrementAndGet();
-   }
-
-   /**
-    * Decrement the reference count
-    * 
-    * @return the resulting count
-    */
-   protected int decrement()
-   {
-      return references.decrementAndGet();
-   }
-
-   /**
-    * Check whether we are closed
-    * 
-    * @throws IllegalStateException when closed
-    */
-   protected void checkClosed() throws IllegalStateException 
-   {
-      if (references.get() < 0)
-         throw new IllegalStateException("Closed " + this);
-   }
-   
-   public void close() 
-   {
-      if (decrement() == 0)
-         doClose();
-   }
-
-   /**
-    * The real close
-    */
-   protected void doClose()
-   {
-      // nothing
-   }
-
-   /**
-    * Structured implementation of find child
-    * 
-    * @param path the path
-    * @return the handler
-    * @throws IOException for any error accessing the virtual file system
-    * @throws IllegalArgumentException for a null name
-    */
-   public VirtualFileHandler structuredFindChild(String path) throws IOException
-   {
-      checkClosed();
-
-      // Parse the path
-      String[] tokens = PathTokenizer.getTokens(path);
-      if (tokens == null || tokens.length == 0)
-         return this;
-
-      // Go through each context starting from ours 
-      // check the parents are not leaves.
-      VirtualFileHandler current = this;
-      for (int i = 0; i < tokens.length; ++i)
-      {
-         if (current.isLeaf())
-            throw new IOException("File cannot have children: " + current);
-
-         if (PathTokenizer.isReverseToken(tokens[i]))
-         {
-            VirtualFileHandler parent = current.getParent();
-            if (parent == null)
-               throw new IOException("Using reverse path on top file handler: " + current + ", " + path);
-            else
-               current = parent;
-         }
-         else if (current instanceof StructuredVirtualFileHandler)
-         {
-            StructuredVirtualFileHandler structured = (StructuredVirtualFileHandler) current;
-            current = structured.createChildHandler(tokens[i]);
-         }
-         else
-         {
-            String remainingPath = PathTokenizer.getRemainingPath(tokens, i);
-            return current.findChild(remainingPath);
-         }
-      }
-      
-      // The last one is the result
-      return current;
-   }
-
-   /**
-    * Simple implementation of findChild
-    * 
-    * @param path the path
-    * @return the handler
-    * @throws IOException for any error accessing the virtual file system
-    * @throws IllegalArgumentException for a null name
-    */
-   public VirtualFileHandler simpleFindChild(String path) throws IOException
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-
-      if (path.length() == 0)
-         return this;
-
-      // check for reverse .. path
-      String appliedPath = PathTokenizer.applyReversePaths(path);
-      List<VirtualFileHandler> children = getChildren(false);
-      for (VirtualFileHandler child : children)
-      {
-         if (child.getName().equals(appliedPath))
-            return child;
-      }
-      throw new IOException("Child not found " + path + " for " + this);
-   }
-
-   @Override
-   public String toString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append(getClass().getSimpleName());
-      buffer.append('@');
-      buffer.append(System.identityHashCode(this));
-      buffer.append("[path=").append(getPathName());
-      buffer.append(" context=").append(context.getRootURI());
-      buffer.append(" real=").append(safeToURLString());
-      buffer.append(']');
-      return buffer.toString();
-   }
-   
-   @Override
-   public int hashCode()
-   {
-      return getPathName().hashCode();
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (this == obj)
-         return true;
-      if (obj == null || obj instanceof VirtualFileHandler == false)
-         return false;
-      VirtualFileHandler other = (VirtualFileHandler) obj;
-      if (getVFSContext().equals(other.getVFSContext()) == false)
-         return false;
-      if (getPathName().equals(other.getPathName()) == false)
-         return false;
-      return true;
-   }
-
-   /*
-   @Override
-   protected void finalize() throws Throwable
-   {
-      close();
-   }
-   */
-   
-   /**
-    * Safely get a url version of the string
-    * 
-    * @return the string or unknown if there is an error
-    */
-   private String safeToURLString()
-   {
-      try
-      {
-         return toURI().toString();
-      }
-      catch (URISyntaxException ignored)
-      {
-         return "<unknown>";
-      }
-   }
-
-   private void writeObject(ObjectOutputStream out)
-      throws IOException
-   {
-      PutField fields = out.putFields();
-      fields.put("rootURI", this.getVFSContext().getRootURI());
-      fields.put("parent", parent);
-      fields.put("name", name);
-      fields.put("vfsUrl", vfsUrl);
-      out.writeFields();
-   }
-
-   private void readObject(ObjectInputStream in)
-      throws IOException, ClassNotFoundException
-   {
-      // Read in the serialPersistentFields
-      GetField fields = in.readFields();
-      URI rootURI = (URI) fields.get("rootURI", null);
-      this.parent = (VirtualFileHandler) fields.get("parent", null);
-      this.name = (String) fields.get("name", null);
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
-      this.context = factory.getVFS(rootURI);
-      this.references = new AtomicInteger(0);
-      this.vfsUrl = (URL)fields.get("vfsUrl", null);
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,483 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.io.ObjectInputStream.GetField;
+import java.io.ObjectOutputStream.PutField;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VFSContextFactory;
+import org.jboss.virtual.spi.VFSContextFactoryLocator;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractVirtualFileHandler.
+ * 
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractVirtualFileHandler implements VirtualFileHandler
+{
+   /** The log */
+   protected static final Logger log = Logger.getLogger(AbstractVirtualFileHandler.class);
+   /** serialVersionUID */
+   private static final long serialVersionUID = 1L;
+   /** The class serial fields */
+   private static final ObjectStreamField[] serialPersistentFields = {
+      new ObjectStreamField("rootURI", URI.class),
+      new ObjectStreamField("parent", VirtualFileHandler.class),
+      new ObjectStreamField("name", String.class),
+      new ObjectStreamField("vfsUrl", URL.class)
+   };
+
+   /** The VFS context
+    * @serialField rootURI URI the VFS context rootURI
+    */
+   private VFSContext context;
+   
+   /** The parent
+    * @serialField parent VirtualFileHandler the virtual file parent
+    */
+   private VirtualFileHandler parent;
+
+   /** The name
+    * @serialField name String the virtual file name
+    */
+   private String name;
+
+   /** The vfsPath */
+   private transient String vfsPath;
+
+   /** The vfs URL */
+   private URL vfsUrl;
+
+   /** The reference count */
+   private transient AtomicInteger references = new AtomicInteger(0);
+
+   /** The cached last modified */
+   protected transient long cachedLastModified;
+
+   /**
+    * Create a new handler
+    * 
+    * @param context the context
+    * @param parent the parent
+    * @param name the name
+    * @throws IllegalArgumentException if the context or name is null;
+    */
+   protected AbstractVirtualFileHandler(VFSContext context, VirtualFileHandler parent, String name)
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null context");
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      this.context = context;
+      this.parent = parent;
+      this.name = VFSUtils.fixName(name);
+   }
+
+   /**
+    * Check if parent exists.
+    */
+   protected void checkParentExists()
+   {
+      if (parent == null)
+         throw new IllegalArgumentException("Parent must exist!");
+   }
+
+   /**
+    * Get child url.
+    *
+    * @param childPath the child path
+    * @param isDirectory is directory
+    * @return full child URL
+    * @throws IOException for any io error
+    * @throws URISyntaxException for any uri error
+    */
+   protected URL getChildVfsUrl(String childPath, boolean isDirectory) throws IOException, URISyntaxException
+   {
+      checkParentExists();
+      URL parentVfsUrl = getParent().toVfsUrl();
+      String vfsUrlString = parentVfsUrl.toString();
+      if (vfsUrlString.length() > 0 && vfsUrlString.endsWith("/") == false)
+         vfsUrlString += "/";
+      vfsUrlString += childPath;
+      if (isDirectory && vfsUrlString.endsWith("/") == false)
+         vfsUrlString += "/";
+      return new URL(vfsUrlString);
+   }
+
+   /**
+    * Get child path name.
+    *
+    * @param childPath the child path
+    * @param isDirectory is directory
+    * @return full child URL
+    * @throws IOException for any io error
+    */
+   protected String getChildPathName(String childPath, boolean isDirectory) throws IOException
+   {
+      checkParentExists();
+      String childPathName = getParent().getPathName();
+      if (childPathName.length() > 0 && childPathName.endsWith("/") == false)
+         childPathName += "/";
+      childPathName += childPath;
+      if (isDirectory && childPathName.endsWith("/") == false)
+         childPathName += "/";
+      return childPathName;
+   }
+
+   public boolean hasBeenModified() throws IOException
+   {
+      boolean hasBeenModified = false;
+      long last = getLastModified();
+      if (cachedLastModified != last)
+      {
+         hasBeenModified = cachedLastModified != 0;
+         cachedLastModified = last;
+      }
+      return hasBeenModified;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public String getPathName()
+   {
+      if (vfsPath == null)
+      {
+         StringBuilder pathName = new StringBuilder();
+         initPath(pathName);
+         vfsPath = pathName.toString();
+      }
+      return vfsPath;
+   }
+
+   /**
+    * todo This is a hack until we can fix http://jira.jboss.com/jira/browse/JBMICROCONT-164
+    *
+    * @param path
+    */
+   public void setPathName(String path)
+   {
+      this.vfsPath = path;
+   }
+
+   public URL toURL() throws MalformedURLException, URISyntaxException
+   {
+      return toURI().toURL();
+   }
+
+   public URL toVfsUrl() throws MalformedURLException, URISyntaxException
+   {
+      return vfsUrl;
+   }
+
+   /**
+    * Get VFS url.
+    *
+    * @return vfs url
+    */
+   protected URL getVfsUrl()
+   {
+      return vfsUrl;
+   }
+
+   /**
+    * Set the vfs URL.
+    *
+    * @param vfsUrl vfs url
+    */
+   protected void setVfsUrl(URL vfsUrl)
+   {
+      this.vfsUrl = vfsUrl;
+   }
+
+   /**
+    * Initialise the path into the path name
+    * 
+    * @param pathName the path name
+    * @return whether it added anything
+    */
+   private boolean initPath(StringBuilder pathName)
+   {
+      if (parent != null)
+      {
+         if (parent instanceof AbstractVirtualFileHandler)
+         {
+            AbstractVirtualFileHandler handler = (AbstractVirtualFileHandler) parent;
+            if (handler.initPath(pathName))
+               pathName.append('/');
+         }
+         else
+         {
+            pathName.append(parent.getPathName());
+         }
+         pathName.append(getName());
+         return true;
+      }
+      return false;
+   }
+   
+   public VirtualFile getVirtualFile()
+   {
+      checkClosed();
+      increment();
+      return new VirtualFile(this);
+   }
+   
+   public VirtualFileHandler getParent() throws IOException
+   {
+      checkClosed();
+      return parent;
+   }
+   
+   public VFSContext getVFSContext()
+   {
+      checkClosed();
+      return context;
+   }
+
+   /**
+    * Increment the reference count
+    * 
+    * @return the resulting count
+    */
+   protected int increment()
+   {
+      return references.incrementAndGet();
+   }
+
+   /**
+    * Decrement the reference count
+    * 
+    * @return the resulting count
+    */
+   protected int decrement()
+   {
+      return references.decrementAndGet();
+   }
+
+   /**
+    * Check whether we are closed
+    * 
+    * @throws IllegalStateException when closed
+    */
+   protected void checkClosed() throws IllegalStateException 
+   {
+      if (references.get() < 0)
+         throw new IllegalStateException("Closed " + this);
+   }
+   
+   public void close() 
+   {
+      if (decrement() == 0)
+         doClose();
+   }
+
+   /**
+    * The real close
+    */
+   protected void doClose()
+   {
+      // nothing
+   }
+
+   /**
+    * Structured implementation of get child
+    *
+    * @param path the path
+    * @return the handler or <code>null</code> if it doesn't exist
+    * @throws IOException for any error accessing the virtual file system
+    * @throws IllegalArgumentException for a null name
+    */
+   public VirtualFileHandler structuredFindChild(String path) throws IOException
+   {
+      checkClosed();
+
+      // Parse the path
+      String[] tokens = PathTokenizer.getTokens(path);
+      if (tokens == null || tokens.length == 0)
+         return this;
+
+      // Go through each context starting from ours
+      // check the parents are not leaves.
+      VirtualFileHandler current = this;
+      for (int i = 0; i < tokens.length; ++i)
+      {
+         if (current == null || current.isLeaf())
+            return null;
+
+         if (PathTokenizer.isReverseToken(tokens[i]))
+         {
+            VirtualFileHandler parent = current.getParent();
+            if (parent == null) // TODO - still IOE or null?
+               throw new IOException("Using reverse path on top file handler: " + current + ", " + path);
+            else
+               current = parent;
+         }
+         else if (current instanceof StructuredVirtualFileHandler)
+         {
+            StructuredVirtualFileHandler structured = (StructuredVirtualFileHandler) current;
+            current = structured.createChildHandler(tokens[i]);
+         }
+         else
+         {
+            String remainingPath = PathTokenizer.getRemainingPath(tokens, i);
+            return current.getChild(remainingPath);
+         }
+      }
+
+      // The last one is the result
+      return current;
+   }
+
+   /**
+    * Simple implementation of findChild
+    * 
+    * @param path the path
+    * @return the handler
+    * @throws IOException for any error accessing the virtual file system
+    * @throws IllegalArgumentException for a null name
+    */
+   public VirtualFileHandler simpleFindChild(String path) throws IOException
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      if (path.length() == 0)
+         return this;
+
+      // check for reverse .. path
+      String appliedPath = PathTokenizer.applyReversePaths(path);
+      List<VirtualFileHandler> children = getChildren(false);
+      for (VirtualFileHandler child : children)
+      {
+         if (child.getName().equals(appliedPath))
+            return child;
+      }
+      return null;
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName());
+      buffer.append('@');
+      buffer.append(System.identityHashCode(this));
+      buffer.append("[path=").append(getPathName());
+      buffer.append(" context=").append(context.getRootURI());
+      buffer.append(" real=").append(safeToURLString());
+      buffer.append(']');
+      return buffer.toString();
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return getPathName().hashCode();
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (obj == null || obj instanceof VirtualFileHandler == false)
+         return false;
+      VirtualFileHandler other = (VirtualFileHandler) obj;
+      if (getVFSContext().equals(other.getVFSContext()) == false)
+         return false;
+      if (getPathName().equals(other.getPathName()) == false)
+         return false;
+      return true;
+   }
+
+   /*
+   @Override
+   protected void finalize() throws Throwable
+   {
+      close();
+   }
+   */
+   
+   /**
+    * Safely get a url version of the string
+    * 
+    * @return the string or unknown if there is an error
+    */
+   private String safeToURLString()
+   {
+      try
+      {
+         return toURI().toString();
+      }
+      catch (URISyntaxException ignored)
+      {
+         return "<unknown>";
+      }
+   }
+
+   private void writeObject(ObjectOutputStream out)
+      throws IOException
+   {
+      PutField fields = out.putFields();
+      fields.put("rootURI", this.getVFSContext().getRootURI());
+      fields.put("parent", parent);
+      fields.put("name", name);
+      fields.put("vfsUrl", vfsUrl);
+      out.writeFields();
+   }
+
+   private void readObject(ObjectInputStream in)
+      throws IOException, ClassNotFoundException
+   {
+      // Read in the serialPersistentFields
+      GetField fields = in.readFields();
+      URI rootURI = (URI) fields.get("rootURI", null);
+      this.parent = (VirtualFileHandler) fields.get("parent", null);
+      this.name = (String) fields.get("name", null);
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
+      this.context = factory.getVFS(rootURI);
+      this.references = new AtomicInteger(0);
+      this.vfsUrl = (URL)fields.get("vfsUrl", null);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.virtual.plugins.context;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * A delegating VirtualFileHandler that allows for overriding the delegate
- * parent and name. One usecase is a link which roots another VFSContext
- * under a different parent and name.
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class DelegatingHandler extends AbstractVirtualFileHandler
-{
-   /** Serialization */
-   private static final long serialVersionUID = 1;
-   
-   /** The delegate */
-   private VirtualFileHandler delegate;
-
-   /**
-    * Create a DelegatingHandler
-    * 
-    * @param context - the context for the parent
-    * @param parent - the parent of the delegate in this VFS
-    * @param name - the name of the delegate in this VFS
-    * @param delegate - the handler delegate
-    */
-   public DelegatingHandler(VFSContext context, VirtualFileHandler parent, String name, VirtualFileHandler delegate)
-   {
-      super(context, parent, name);
-      if (delegate == null)
-         throw new IllegalArgumentException("Null delegate");
-      this.delegate = delegate;
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return delegate.findChild(path);
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      return delegate.getChildren(ignoreErrors);
-   }
-
-   public long getLastModified() throws IOException
-   {
-      return delegate.getLastModified();
-   }
-
-   public long getSize() throws IOException
-   {
-      return delegate.getSize();
-   }
-
-   public boolean isLeaf() throws IOException
-   {
-      return delegate.isLeaf();
-   }
-
-   public boolean exists() throws IOException
-   {
-      return delegate.exists();
-   }
-
-   public boolean isHidden() throws IOException
-   {
-      return delegate.isHidden();
-   }
-
-   public InputStream openStream() throws IOException
-   {
-      return delegate.openStream();
-   }
-
-   public URI toURI() throws URISyntaxException
-   {
-      return delegate.toURI();
-   }
-
-   public URL toURL() throws URISyntaxException, MalformedURLException
-   {
-      return delegate.toURL();
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.virtual.plugins.context;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * A delegating VirtualFileHandler that allows for overriding the delegate
+ * parent and name. One usecase is a link which roots another VFSContext
+ * under a different parent and name.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class DelegatingHandler extends AbstractVirtualFileHandler
+{
+   /** Serialization */
+   private static final long serialVersionUID = 1;
+   
+   /** The delegate */
+   private VirtualFileHandler delegate;
+
+   /**
+    * Create a DelegatingHandler
+    * 
+    * @param context - the context for the parent
+    * @param parent - the parent of the delegate in this VFS
+    * @param name - the name of the delegate in this VFS
+    * @param delegate - the handler delegate
+    */
+   public DelegatingHandler(VFSContext context, VirtualFileHandler parent, String name, VirtualFileHandler delegate)
+   {
+      super(context, parent, name);
+      if (delegate == null)
+         throw new IllegalArgumentException("Null delegate");
+      this.delegate = delegate;
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return delegate.getChild(path);
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      return delegate.getChildren(ignoreErrors);
+   }
+
+   public long getLastModified() throws IOException
+   {
+      return delegate.getLastModified();
+   }
+
+   public long getSize() throws IOException
+   {
+      return delegate.getSize();
+   }
+
+   public boolean isLeaf() throws IOException
+   {
+      return delegate.isLeaf();
+   }
+
+   public boolean exists() throws IOException
+   {
+      return delegate.exists();
+   }
+
+   public boolean isHidden() throws IOException
+   {
+      return delegate.isHidden();
+   }
+
+   public InputStream openStream() throws IOException
+   {
+      return delegate.openStream();
+   }
+
+   public URI toURI() throws URISyntaxException
+   {
+      return delegate.toURI();
+   }
+
+   public URL toURL() throws URISyntaxException, MalformedURLException
+   {
+      return delegate.toURL();
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context;
-
-import java.io.IOException;
-
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * A handler that has structure, i.e. you want
- * to go through the path in individual elements
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public interface StructuredVirtualFileHandler
-{
-   /**
-    * Create a virtual file context
-    * 
-    * @param name the name
-    * @return the handler
-    * @throws IOException for any error accessing the virtual file system
-    * @throws IllegalArgumentException for a null name
-    */
-   VirtualFileHandler createChildHandler(String name) throws IOException;
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context;
+
+import java.io.IOException;
+
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * A handler that has structure, i.e. you want
+ * to go through the path in individual elements
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface StructuredVirtualFileHandler
+{
+   /**
+    * Create a virtual file context
+    * 
+    * @param name the name
+    * @return the handler
+    * @throws IOException for any error accessing the virtual file system
+    * @throws IllegalArgumentException for a null name
+    */
+   VirtualFileHandler createChildHandler(String name) throws IOException;
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,227 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.file;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.virtual.plugins.context.AbstractURLHandler;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * FileHandler.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public class FileHandler extends AbstractURLHandler implements StructuredVirtualFileHandler
-{
-   private static final long serialVersionUID = 1;
-   /** The file */
-   private transient File file;
-   /** The child cache */
-   private transient Map<String, VirtualFileHandler> childCache = Collections.synchronizedMap(new HashMap<String, VirtualFileHandler>());
-
-   /**
-    * Create a new FileHandler.
-    * 
-    * @param context the context
-    * @param parent the parent
-    * @param file the file
-    * @param url the url
-    * @throws IOException for an error accessing the file system
-    * @throws IllegalArgumentException for a null context, url
-    */
-   public FileHandler(FileSystemContext context, VirtualFileHandler parent, File file, URL url) throws IOException
-   {
-      super(context, parent, url, file.getName());
-
-      this.file = file;
-      if (file.exists() == false)
-         throw new FileNotFoundException("File does not exist: " + file.getCanonicalPath());
-      setVfsUrl(new URL("vfs" + url));
-   }
-   /**
-    * Create a new FileHandler
-    *  
-    * @param context the context
-    * @param parent the parent
-    * @param file the file
-    * @param uri the uri
-    * @throws IOException for an error accessing the file system
-    * @throws IllegalArgumentException for a null context, uri
-    */
-   public FileHandler(FileSystemContext context, VirtualFileHandler parent, File file, URI uri) throws IOException
-   {
-      this(context, parent, file, uri.toURL());
-   }
-
-   public URL toVfsUrl() throws MalformedURLException, URISyntaxException
-   {
-      if (getVfsUrl() == null)
-      {
-         setVfsUrl(new URL("vfs" + getURL()));
-      }
-      return getVfsUrl();
-   }
-
-   @Override
-   public FileSystemContext getVFSContext()
-   {
-      return (FileSystemContext) super.getVFSContext();
-   }
-   
-   /**
-    * Get the file for this file handler
-    * 
-    * @return the file
-    */
-   protected File getFile()
-   {
-      checkClosed();
-      return file;
-   }
-   
-   @Override
-   public long getLastModified()
-   {
-      return getFile().lastModified();
-   }
-
-   @Override
-   public long getSize()
-   {
-      return getFile().length();
-   }
-
-   public boolean isLeaf()
-   {
-      return getFile().isFile();
-   }
-
-   public boolean isHidden()
-   {
-      return getFile().isHidden();
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      File parent = getFile();
-      File[] files = parent.listFiles();
-      if (files == null)
-         throw new IOException("Error listing files: " + parent.getCanonicalPath());
-      // We need to validate the files list due to jdk bug 6192331
-      List<File> tmpFiles = new ArrayList<File>();
-      for (File file : files)
-      {
-         if( file.canRead() == true )
-            tmpFiles.add(file);
-      }
-      if (tmpFiles.isEmpty())
-         return Collections.emptyList();
-
-      files = tmpFiles.toArray(new File[tmpFiles.size()]);
-      FileSystemContext context = getVFSContext();
-      
-      List<VirtualFileHandler> result = new ArrayList<VirtualFileHandler>();
-      Map<String, VirtualFileHandler> newCache = Collections.synchronizedMap(new HashMap<String, VirtualFileHandler>());
-      Map<String, VirtualFileHandler> oldCache = childCache;
-      // fill up a new cache with old entries
-      // old entries no longer existing in directory are purged by not being added to new cache
-      // we cache handlers so that things like JARs are recreated (optimization)
-      for (File file : files)
-      {
-         try
-         {
-            VirtualFileHandler handler;
-            handler = oldCache.get(file.getName());
-            // if underlying file has been modified then create a new handler instead of using the cached one
-            if (handler != null && handler.hasBeenModified())
-            {
-               handler = null;
-            }
-            if (handler == null)
-            {
-               handler = context.createVirtualFileHandler(this, file);
-            }
-            result.add(handler);
-            newCache.put(file.getName(), handler);
-         }
-         catch (IOException e)
-         {
-            if (ignoreErrors)
-               log.trace("Ignored: " + e);
-            else
-               throw e;
-         }
-      }
-      // cleanup old entries
-      childCache = newCache;
-      return result;
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      FileSystemContext context = getVFSContext();
-      File parentFile = getFile();
-      File child = new File(parentFile, name);
-      VirtualFileHandler handler = childCache.get(name);
-      // if a child has already been created use that
-      // if the child has been modified on disk then create a new handler
-      if (handler != null && handler.hasBeenModified())
-      {
-         handler = null;
-      }
-      if (handler == null)
-      {
-         handler = context.createVirtualFileHandler(this, child);
-         childCache.put(name, handler);
-      }
-      return handler;
-   }
-
-   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
-   {
-      in.defaultReadObject();
-      // Initialize the transient values
-      this.file = new File(getURL().getPath());
-      this.childCache = Collections.synchronizedMap(new HashMap<String, VirtualFileHandler>());
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,227 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.file;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.virtual.plugins.context.AbstractURLHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * FileHandler.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class FileHandler extends AbstractURLHandler implements StructuredVirtualFileHandler
+{
+   private static final long serialVersionUID = 1;
+   /** The file */
+   private transient File file;
+   /** The child cache */
+   private transient Map<String, VirtualFileHandler> childCache = Collections.synchronizedMap(new HashMap<String, VirtualFileHandler>());
+
+   /**
+    * Create a new FileHandler.
+    * 
+    * @param context the context
+    * @param parent the parent
+    * @param file the file
+    * @param url the url
+    * @throws IOException for an error accessing the file system
+    * @throws IllegalArgumentException for a null context, url
+    */
+   public FileHandler(FileSystemContext context, VirtualFileHandler parent, File file, URL url) throws IOException
+   {
+      super(context, parent, url, file.getName());
+
+      this.file = file;
+      if (file.exists() == false)
+         throw new FileNotFoundException("File does not exist: " + file.getCanonicalPath());
+      setVfsUrl(new URL("vfs" + url));
+   }
+   /**
+    * Create a new FileHandler
+    *  
+    * @param context the context
+    * @param parent the parent
+    * @param file the file
+    * @param uri the uri
+    * @throws IOException for an error accessing the file system
+    * @throws IllegalArgumentException for a null context, uri
+    */
+   public FileHandler(FileSystemContext context, VirtualFileHandler parent, File file, URI uri) throws IOException
+   {
+      this(context, parent, file, uri.toURL());
+   }
+
+   public URL toVfsUrl() throws MalformedURLException, URISyntaxException
+   {
+      if (getVfsUrl() == null)
+      {
+         setVfsUrl(new URL("vfs" + getURL()));
+      }
+      return getVfsUrl();
+   }
+
+   @Override
+   public FileSystemContext getVFSContext()
+   {
+      return (FileSystemContext) super.getVFSContext();
+   }
+   
+   /**
+    * Get the file for this file handler
+    * 
+    * @return the file
+    */
+   protected File getFile()
+   {
+      checkClosed();
+      return file;
+   }
+   
+   @Override
+   public long getLastModified()
+   {
+      return getFile().lastModified();
+   }
+
+   @Override
+   public long getSize()
+   {
+      return getFile().length();
+   }
+
+   public boolean isLeaf()
+   {
+      return getFile().isFile();
+   }
+
+   public boolean isHidden()
+   {
+      return getFile().isHidden();
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      File parent = getFile();
+      File[] files = parent.listFiles();
+      if (files == null)
+         throw new IOException("Error listing files: " + parent.getCanonicalPath());
+      // We need to validate the files list due to jdk bug 6192331
+      List<File> tmpFiles = new ArrayList<File>();
+      for (File file : files)
+      {
+         if( file.canRead() == true )
+            tmpFiles.add(file);
+      }
+      if (tmpFiles.isEmpty())
+         return Collections.emptyList();
+
+      files = tmpFiles.toArray(new File[tmpFiles.size()]);
+      FileSystemContext context = getVFSContext();
+      
+      List<VirtualFileHandler> result = new ArrayList<VirtualFileHandler>();
+      Map<String, VirtualFileHandler> newCache = Collections.synchronizedMap(new HashMap<String, VirtualFileHandler>());
+      Map<String, VirtualFileHandler> oldCache = childCache;
+      // fill up a new cache with old entries
+      // old entries no longer existing in directory are purged by not being added to new cache
+      // we cache handlers so that things like JARs are recreated (optimization)
+      for (File file : files)
+      {
+         try
+         {
+            VirtualFileHandler handler;
+            handler = oldCache.get(file.getName());
+            // if underlying file has been modified then create a new handler instead of using the cached one
+            if (handler != null && handler.hasBeenModified())
+            {
+               handler = null;
+            }
+            if (handler == null)
+            {
+               handler = context.createVirtualFileHandler(this, file);
+            }
+            result.add(handler);
+            newCache.put(file.getName(), handler);
+         }
+         catch (IOException e)
+         {
+            if (ignoreErrors)
+               log.trace("Ignored: " + e);
+            else
+               throw e;
+         }
+      }
+      // cleanup old entries
+      childCache = newCache;
+      return result;
+   }
+
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      FileSystemContext context = getVFSContext();
+      File parentFile = getFile();
+      File child = new File(parentFile, name);
+      VirtualFileHandler handler = childCache.get(name);
+      // if a child has already been created use that
+      // if the child has been modified on disk then create a new handler
+      if (handler != null && handler.hasBeenModified())
+      {
+         handler = null;
+      }
+      if (handler == null)
+      {
+         handler = context.createVirtualFileHandler(this, child);
+         childCache.put(name, handler);
+      }
+      return handler;
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+
+   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+   {
+      in.defaultReadObject();
+      // Initialize the transient values
+      this.file = new File(getURL().getPath());
+      this.childCache = Collections.synchronizedMap(new HashMap<String, VirtualFileHandler>());
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,225 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.file;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.plugins.context.AbstractURLHandler;
-import org.jboss.virtual.plugins.context.DelegatingHandler;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
-import org.jboss.virtual.spi.LinkInfo;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactory;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * A handler for link directories.
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public class LinkHandler extends AbstractURLHandler implements StructuredVirtualFileHandler
-{
-   private static final long serialVersionUID = 1;
-   /** The link information */
-   private List<LinkInfo> links;
-   /** The link targets */
-   private HashMap<String, VirtualFileHandler> linkTargets = new HashMap<String, VirtualFileHandler>(3);
-
-   class ParentOfLink extends AbstractURLHandler implements StructuredVirtualFileHandler
-   {
-      private static final long serialVersionUID = 1;
-
-      private HashMap<String, VirtualFileHandler> children = new HashMap<String, VirtualFileHandler>(1);
-
-      public ParentOfLink(VFSContext context, VirtualFileHandler parent, URL url, String name)
-      {
-         super(context, parent, url, name);
-         try
-         {
-            setVfsUrl(new URL("vfs" + url.toString()));
-         }
-         catch (MalformedURLException e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-
-      void addChild(VirtualFileHandler child, String name)
-      {
-         children.put(name, child);
-      }
-
-      public VirtualFileHandler findChild(String path) throws IOException
-      {
-         return structuredFindChild(path);
-      }
-
-      public VirtualFileHandler createChildHandler(String name) throws IOException
-      {
-         return children.get(name);
-      }
-
-      public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-      {
-         return null;
-      }
-
-      public boolean isLeaf() throws IOException
-      {
-         return false;
-      }
-   }
-
-   /**
-    * Create a new LinkHandler.
-    * 
-    * @param context the context
-    * @param parent the parent
-    * @param uri the uri
-    * @param name the name
-    * @param links the links
-    * @throws IOException for an error accessing the file system
-    * @throws IllegalArgumentException for a null context, url
-    * @throws URISyntaxException if the uri cannot be parsed
-    */
-   public LinkHandler(FileSystemContext context, VirtualFileHandler parent, URI uri, String name,
-         List<LinkInfo> links)
-      throws IOException, URISyntaxException
-   {
-      // TODO: This URL is not consistent with the getName, but does point to the raw link file
-      super(context, parent, uri.toURL(), name);
-      this.links = links;
-      setVfsUrl(new URL("vfs" + uri.toURL().toString()));
-      // Create handlers for the links and add
-      for(LinkInfo link : links)
-      {
-         String linkName = link.getName();
-         if( linkName == null )
-            linkName = VFSUtils.getName(link.getLinkTarget());
-         if( linkName != null )
-         {
-            String[] paths = PathTokenizer.getTokens(linkName);
-            int n = 0;
-            VirtualFileHandler linkParent = this;
-            String atom;
-            // Look for an existing parent           
-            for(; n < paths.length-1; n ++)
-            {
-               atom = paths[n];
-               try
-               {
-                  linkParent = linkParent.findChild(atom);
-               }
-               catch(IOException e)
-               {
-                  break;
-               }
-            }
-            // Create any missing parents
-            for(; n < paths.length-1; n ++)
-            {
-               atom = paths[n];
-               URL polURL = new URL(linkParent.toURI().toURL(), atom);
-               ParentOfLink pol = new ParentOfLink(this.getVFSContext(), linkParent, polURL, atom);
-               if( linkParent == this )
-               {
-                  linkTargets.put(atom, pol);
-               }
-               else
-               {
-                  ParentOfLink prevPOL = (ParentOfLink) linkParent;
-                  prevPOL.addChild(pol, atom);
-               }
-               linkParent = pol;
-            }
-               
-            // Create the link handler
-            atom = paths[n];
-            VirtualFileHandler linkHandler = createLinkHandler(linkParent, atom, link.getLinkTarget());
-            if( linkParent == this )
-            {
-               linkTargets.put(atom, linkHandler);
-            }
-            else if (linkParent instanceof ParentOfLink)
-            {
-               ParentOfLink prevPOL = (ParentOfLink) linkParent;
-               prevPOL.addChild(linkHandler, atom);
-            }            
-         }
-      }
-   }
-
-   public boolean isLeaf()
-   {
-      return false;
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      return new ArrayList<VirtualFileHandler>(linkTargets.values());
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      VirtualFileHandler handler = linkTargets.get(name);
-      if( handler == null )
-      {
-         throw new FileNotFoundException("Failed to find link for: "+name+", parent: "+this);
-      }
-      return handler;
-   }
-
-   @Override
-   protected void doClose()
-   {
-      super.doClose();
-      links.clear();
-   }
-   
-   protected VirtualFileHandler createLinkHandler(VirtualFileHandler parent, String name, URI linkURI)
-      throws IOException
-   {
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(linkURI);
-      VFSContext context = factory.getVFS(linkURI);
-      VirtualFileHandler rootHandler = context.getRoot();
-      // Wrap the handler in a delegate so we can change the parent and name
-      // TODO: if the factory caches contexts the root handler may not point to the link
-      return new DelegatingHandler(this.getVFSContext(), parent, name, rootHandler);
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,223 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.file;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.plugins.context.AbstractURLHandler;
+import org.jboss.virtual.plugins.context.DelegatingHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
+import org.jboss.virtual.spi.LinkInfo;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VFSContextFactory;
+import org.jboss.virtual.spi.VFSContextFactoryLocator;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * A handler for link directories.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class LinkHandler extends AbstractURLHandler implements StructuredVirtualFileHandler
+{
+   private static final long serialVersionUID = 1;
+   /** The link information */
+   private List<LinkInfo> links;
+   /** The link targets */
+   private HashMap<String, VirtualFileHandler> linkTargets = new HashMap<String, VirtualFileHandler>(3);
+
+   class ParentOfLink extends AbstractURLHandler implements StructuredVirtualFileHandler
+   {
+      private static final long serialVersionUID = 1;
+
+      private HashMap<String, VirtualFileHandler> children = new HashMap<String, VirtualFileHandler>(1);
+
+      public ParentOfLink(VFSContext context, VirtualFileHandler parent, URL url, String name)
+      {
+         super(context, parent, url, name);
+         try
+         {
+            setVfsUrl(new URL("vfs" + url.toString()));
+         }
+         catch (MalformedURLException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+
+      void addChild(VirtualFileHandler child, String name)
+      {
+         children.put(name, child);
+      }
+
+      public VirtualFileHandler createChildHandler(String name) throws IOException
+      {
+         return children.get(name);
+      }
+
+      public VirtualFileHandler getChild(String path) throws IOException
+      {
+         return structuredFindChild(path);
+      }
+
+      public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+      {
+         return null;
+      }
+
+      public boolean isLeaf() throws IOException
+      {
+         return false;
+      }
+   }
+
+   /**
+    * Create a new LinkHandler.
+    * 
+    * @param context the context
+    * @param parent the parent
+    * @param uri the uri
+    * @param name the name
+    * @param links the links
+    * @throws IOException for an error accessing the file system
+    * @throws IllegalArgumentException for a null context, url
+    * @throws URISyntaxException if the uri cannot be parsed
+    */
+   public LinkHandler(FileSystemContext context, VirtualFileHandler parent, URI uri, String name,
+         List<LinkInfo> links)
+      throws IOException, URISyntaxException
+   {
+      // TODO: This URL is not consistent with the getName, but does point to the raw link file
+      super(context, parent, uri.toURL(), name);
+      this.links = links;
+      setVfsUrl(new URL("vfs" + uri.toURL().toString()));
+      // Create handlers for the links and add
+      for(LinkInfo link : links)
+      {
+         String linkName = link.getName();
+         if( linkName == null )
+            linkName = VFSUtils.getName(link.getLinkTarget());
+         if( linkName != null )
+         {
+            String[] paths = PathTokenizer.getTokens(linkName);
+            int n = 0;
+            VirtualFileHandler linkParent = this;
+            String atom;
+            // Look for an existing parent
+            VirtualFileHandler previous;
+            for(; n < paths.length-1; n ++)
+            {
+               previous = linkParent;
+               atom = paths[n];
+               linkParent = previous.getChild(atom);
+               if (linkParent == null)
+               {
+                  linkParent = previous;
+                  break;
+               }
+            }
+            // Create any missing parents
+            for(; n < paths.length-1; n ++)
+            {
+               atom = paths[n];
+               URL polURL = new URL(linkParent.toURI().toURL(), atom);
+               ParentOfLink pol = new ParentOfLink(this.getVFSContext(), linkParent, polURL, atom);
+               if( linkParent == this )
+               {
+                  linkTargets.put(atom, pol);
+               }
+               else if (linkParent instanceof ParentOfLink)
+               {
+                  ParentOfLink prevPOL = (ParentOfLink) linkParent;
+                  prevPOL.addChild(pol, atom);
+               }
+               else
+               {
+                  throw new IOException("Link parent not ParentOfLink.");
+               }
+               linkParent = pol;
+            }
+               
+            // Create the link handler
+            atom = paths[n];
+            VirtualFileHandler linkHandler = createLinkHandler(linkParent, atom, link.getLinkTarget());
+            if( linkParent == this )
+            {
+               linkTargets.put(atom, linkHandler);
+            }
+            else if (linkParent instanceof ParentOfLink)
+            {
+               ParentOfLink prevPOL = (ParentOfLink) linkParent;
+               prevPOL.addChild(linkHandler, atom);
+            }            
+         }
+      }
+   }
+
+   public boolean isLeaf()
+   {
+      return false;
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      return new ArrayList<VirtualFileHandler>(linkTargets.values());
+   }
+
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      return linkTargets.get(name);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+
+   @Override
+   protected void doClose()
+   {
+      super.doClose();
+      links.clear();
+   }
+   
+   protected VirtualFileHandler createLinkHandler(VirtualFileHandler parent, String name, URI linkURI)
+      throws IOException
+   {
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(linkURI);
+      VFSContext context = factory.getVFS(linkURI);
+      VirtualFileHandler rootHandler = context.getRoot();
+      // Wrap the handler in a delegate so we can change the parent and name
+      // TODO: if the factory caches contexts the root handler may not point to the link
+      return new DelegatingHandler(this.getVFSContext(), parent, name, rootHandler);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,363 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.jar;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.jar.JarFile;
-import java.util.jar.JarEntry;
-import java.util.zip.ZipEntry;
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
-import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * AbstractStructuredJarHandler.
- *
- * @param <T> exact extra wrapper type
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class AbstractStructuredJarHandler<T> extends AbstractJarHandler implements StructuredVirtualFileHandler
-{
-   /**
-    * serialVersionUID
-    */
-   private static final long serialVersionUID = 1;
-
-   /**
-    * The jar entries
-    */
-   private transient List<VirtualFileHandler> entries;
-   private transient Map<String, VirtualFileHandler> entryMap;
-
-   /**
-    * Force no copy nested jar handler.
-    */
-   private static boolean forceNoCopy;
-
-   static
-   {
-      forceNoCopy = AccessController.doPrivileged(new CheckForceNoCopy());
-      if (forceNoCopy)
-         log.info("VFS force NoCopyNestedJarHandler is enabled.");
-   }
-
-   /**
-    * Create a new JarHandler.
-    *
-    * @param context the context
-    * @param parent  the parent
-    * @param url     the url
-    * @param jar     the jar
-    * @param entry   the entry
-    * @param name    the name
-    * @throws java.io.IOException              for an error accessing the file system
-    * @throws IllegalArgumentException for a null context, url or vfsPath
-    */
-   protected AbstractStructuredJarHandler(VFSContext context, VirtualFileHandler parent, URL url, JarFile jar, ZipEntry entry, String name) throws IOException
-   {
-      super(context, parent, url, jar, entry, name);
-   }
-
-   /**
-    * Initialise the jar file
-    *
-    * @throws java.io.IOException for any error reading the jar file
-    * @throws IllegalArgumentException for a null jarFile
-    */
-   protected void initJarFile() throws IOException
-   {
-      /* This cannot be checked because of serialization
-      if (this.jar != null)
-         throw new IllegalStateException("jarFile has already been set");
-      */
-      Enumeration<ZipEntryWrapper<T>> enumeration = new JarEntryEnumeration(getJar().entries());
-      initJarFile(enumeration);
-   }
-
-   /**
-    * Initialise the jar file.
-    *
-    * @param enumeration jar entry enumeration
-    * @throws IOException for any error
-    */
-   protected void initJarFile(Enumeration<ZipEntryWrapper<T>> enumeration) throws IOException
-   {
-      if (enumeration.hasMoreElements() == false)
-      {
-         entries = Collections.emptyList();
-         entryMap = Collections.emptyMap();
-         return;
-      }
-
-      // Go through and create a structured representation of the jar
-      Map<String, VirtualFileHandler> parentMap = new HashMap<String, VirtualFileHandler>();
-      List<ArrayList<ZipEntryWrapper<T>>> levelMapList = new ArrayList<ArrayList<ZipEntryWrapper<T>>>();
-      entries = new ArrayList<VirtualFileHandler>();
-      entryMap = new HashMap<String, VirtualFileHandler>();
-      boolean trace = log.isTraceEnabled();
-      while (enumeration.hasMoreElements())
-      {
-         ZipEntryWrapper<T> wrapper = enumeration.nextElement();
-         extraWrapperInfo(wrapper);
-         String[] paths = wrapper.getName().split("/");
-         int depth = paths.length;
-         if (depth >= levelMapList.size())
-         {
-            for (int n = levelMapList.size(); n <= depth; n++)
-               levelMapList.add(new ArrayList<ZipEntryWrapper<T>>());
-         }
-         ArrayList<ZipEntryWrapper<T>> levelMap = levelMapList.get(depth);
-         levelMap.add(wrapper);
-         if (trace)
-            log.trace("added " + wrapper.getName() + " at depth " + depth);
-      }
-      // Process each level to build the handlers in parent first order
-      int level = 0;
-      for (ArrayList<ZipEntryWrapper<T>> levels : levelMapList)
-      {
-         if (trace)
-            log.trace("Level(" + level++ + "): " + levels);
-         for (ZipEntryWrapper<T> wrapper : levels)
-         {
-            String name = wrapper.getName();
-            int slash = wrapper.isDirectory() ? name.lastIndexOf('/', name.length() - 2) :
-                    name.lastIndexOf('/', name.length() - 1);
-            VirtualFileHandler parent = this;
-            if (slash >= 0)
-            {
-               // Need to include the slash in the name to match the ZipEntry.name
-               String parentName = name.substring(0, slash + 1);
-               parent = parentMap.get(parentName);
-               if (parent == null)
-               {
-                  // Build up the parent(s)
-                  parent = buildParents(parentName, parentMap, wrapper);
-               }
-            }
-            // Get the entry name without any directory '/' ending
-            int start = slash + 1;
-            int end = wrapper.isDirectory() ? name.length() - 1 : name.length();
-            String entryName = name.substring(start, end);
-            VirtualFileHandler handler = createVirtualFileHandler(parent, wrapper, entryName);
-            if (wrapper.isDirectory())
-            {
-               parentMap.put(name, handler);
-               if (trace)
-                  log.trace("Added parent: " + name);
-            }
-            if (parent == this)
-            {
-               // This is an immeadiate child of the jar handler
-               entries.add(handler);
-               entryMap.put(entryName, handler);
-            }
-            else if (parent instanceof HierarchyVirtualFileHandler)
-            {
-               HierarchyVirtualFileHandler ehandler = (HierarchyVirtualFileHandler) parent;
-               ehandler.addChild(handler);
-            }
-         }
-      }
-   }
-
-   /**
-    * Handle additional information about wrapper.
-    *
-    * @param wrapper the zip entry wrapper
-    * @throws IOException for any error
-    */
-   protected void extraWrapperInfo(ZipEntryWrapper<T> wrapper) throws IOException
-   {
-   }
-
-   /**
-    * Create any missing parents.
-    *
-    * @param parentName full vfs path name of parent
-    * @param parentMap  initJarFile parentMap
-    * @param wrapper    ZipEntryWrapper missing a parent
-    * @return the VirtualFileHandler for the parent
-    * @throws java.io.IOException for any IO error
-    */
-   protected VirtualFileHandler buildParents(String parentName, Map<String, VirtualFileHandler> parentMap, ZipEntryWrapper<T> wrapper)
-           throws IOException
-   {
-      VirtualFileHandler parent = this;
-      String[] paths = PathTokenizer.getTokens(parentName);
-      StringBuilder pathName = new StringBuilder();
-      for (String path : paths)
-      {
-         VirtualFileHandler next;
-         pathName.append(path);
-         pathName.append('/');
-         try
-         {
-            next = parent.findChild(path);
-         }
-         catch (IOException e)
-         {
-            // Create a synthetic parent
-            URL url = getURL(parent, path, true);
-            next = new SynthenticDirEntryHandler(getVFSContext(), parent, path, wrapper.getTime(), url);
-            if (parent == this)
-            {
-               // This is an immeadiate child of the jar handler
-               entries.add(next);
-               entryMap.put(path, next);
-            }
-            else if (parent instanceof HierarchyVirtualFileHandler)
-            {
-               HierarchyVirtualFileHandler ehandler = (HierarchyVirtualFileHandler) parent;
-               ehandler.addChild(next);
-            }
-         }
-         parentMap.put(pathName.toString(), next);
-         parent = next;
-      }
-      return parent;
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      checkClosed();
-      if (entries == null)
-         return Collections.emptyList();
-      else
-         return Collections.unmodifiableList(entries);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      VirtualFileHandler child = entryMap.get(name);
-      if (child == null)
-         throw new FileNotFoundException(this + " has no child: " + name);
-      return child;
-   }
-
-   /**
-    * Create a new virtual file handler
-    *
-    * @param parent the parent
-    * @param wrapper  the entry wrapper
-    * @param entryName - the entry name without any trailing '/'
-    * @return the handler
-    * @throws java.io.IOException              for any error accessing the file system
-    * @throws IllegalArgumentException for a null parent or entry
-    */
-   protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, ZipEntryWrapper<T> wrapper, String entryName)
-           throws IOException
-   {
-      if (parent == null)
-         throw new IllegalArgumentException("Null parent");
-      if (wrapper == null)
-         throw new IllegalArgumentException("Null entry wrapper");
-
-      ZipEntry entry = wrapper.getEntry();
-      URL url = getURL(parent, entryName, entry.isDirectory());
-      VFSContext context = parent.getVFSContext();
-
-      VirtualFileHandler vfh;
-      if (JarUtils.isArchive(entry.getName()))
-      {
-         String flag = context.getOptions().get("useNoCopyJarHandler");
-         boolean useNoCopyJarHandler = Boolean.valueOf(flag);
-
-         if (useNoCopyJarHandler || forceNoCopy)
-            vfh = new NoCopyNestedJarHandler(context, parent, getJar(), entry, url, entryName);
-         else
-            vfh = NestedJarHandler.create(context, parent, getJar(), entry, url, entryName);
-      }
-      else
-      {
-         vfh = new JarEntryHandler(context, parent, getJar(), entry, entryName, url);
-      }
-
-      return vfh;
-   }
-
-   /**
-    * Restore the jar file
-    *
-    * @param in the input stream
-    * @throws IOException for any error reading the jar file
-    * @throws ClassNotFoundException for any jar class finding errors
-    */
-   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
-   {
-      // Initial the parent jar entries
-      initJarFile();
-   }
-
-   private class JarEntryEnumeration implements Enumeration<ZipEntryWrapper<T>>
-   {
-      private Enumeration<JarEntry> enumeration;
-
-      public JarEntryEnumeration(Enumeration<JarEntry> enumeration)
-      {
-         if (enumeration == null)
-            throw new IllegalArgumentException("Null enumeration");
-         this.enumeration = enumeration;
-      }
-
-      public boolean hasMoreElements()
-      {
-         return enumeration.hasMoreElements();
-      }
-
-      public ZipEntryWrapper<T> nextElement()
-      {
-         JarEntry entry = enumeration.nextElement();
-         return new ZipEntryWrapper<T>(entry);
-      }
-   }
-
-   /**
-    * Check if force no copy system property exists.
-    */
-   private static class CheckForceNoCopy implements PrivilegedAction<Boolean>
-   {
-      public Boolean run()
-      {
-         String forceString = System.getProperty("jboss.vfs.forceNoCopy", "false");
-         return Boolean.valueOf(forceString);
-      }
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,361 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.jar;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractStructuredJarHandler.
+ *
+ * @param <T> exact extra wrapper type
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractStructuredJarHandler<T> extends AbstractJarHandler implements StructuredVirtualFileHandler
+{
+   /**
+    * serialVersionUID
+    */
+   private static final long serialVersionUID = 1;
+
+   /**
+    * The jar entries
+    */
+   private transient List<VirtualFileHandler> entries;
+   private transient Map<String, VirtualFileHandler> entryMap;
+
+   /**
+    * Force no copy nested jar handler.
+    */
+   private static boolean forceNoCopy;
+
+   static
+   {
+      forceNoCopy = AccessController.doPrivileged(new CheckForceNoCopy());
+      if (forceNoCopy)
+         log.info("VFS force NoCopyNestedJarHandler is enabled.");
+   }
+
+   /**
+    * Create a new JarHandler.
+    *
+    * @param context the context
+    * @param parent  the parent
+    * @param url     the url
+    * @param jar     the jar
+    * @param entry   the entry
+    * @param name    the name
+    * @throws java.io.IOException              for an error accessing the file system
+    * @throws IllegalArgumentException for a null context, url or vfsPath
+    */
+   protected AbstractStructuredJarHandler(VFSContext context, VirtualFileHandler parent, URL url, JarFile jar, ZipEntry entry, String name) throws IOException
+   {
+      super(context, parent, url, jar, entry, name);
+   }
+
+   /**
+    * Initialise the jar file
+    *
+    * @throws java.io.IOException for any error reading the jar file
+    * @throws IllegalArgumentException for a null jarFile
+    */
+   protected void initJarFile() throws IOException
+   {
+      /* This cannot be checked because of serialization
+      if (this.jar != null)
+         throw new IllegalStateException("jarFile has already been set");
+      */
+      Enumeration<ZipEntryWrapper<T>> enumeration = new JarEntryEnumeration(getJar().entries());
+      initJarFile(enumeration);
+   }
+
+   /**
+    * Initialise the jar file.
+    *
+    * @param enumeration jar entry enumeration
+    * @throws IOException for any error
+    */
+   protected void initJarFile(Enumeration<ZipEntryWrapper<T>> enumeration) throws IOException
+   {
+      if (enumeration.hasMoreElements() == false)
+      {
+         entries = Collections.emptyList();
+         entryMap = Collections.emptyMap();
+         return;
+      }
+
+      // Go through and create a structured representation of the jar
+      Map<String, VirtualFileHandler> parentMap = new HashMap<String, VirtualFileHandler>();
+      List<ArrayList<ZipEntryWrapper<T>>> levelMapList = new ArrayList<ArrayList<ZipEntryWrapper<T>>>();
+      entries = new ArrayList<VirtualFileHandler>();
+      entryMap = new HashMap<String, VirtualFileHandler>();
+      boolean trace = log.isTraceEnabled();
+      while (enumeration.hasMoreElements())
+      {
+         ZipEntryWrapper<T> wrapper = enumeration.nextElement();
+         extraWrapperInfo(wrapper);
+         String[] paths = wrapper.getName().split("/");
+         int depth = paths.length;
+         if (depth >= levelMapList.size())
+         {
+            for (int n = levelMapList.size(); n <= depth; n++)
+               levelMapList.add(new ArrayList<ZipEntryWrapper<T>>());
+         }
+         ArrayList<ZipEntryWrapper<T>> levelMap = levelMapList.get(depth);
+         levelMap.add(wrapper);
+         if (trace)
+            log.trace("added " + wrapper.getName() + " at depth " + depth);
+      }
+      // Process each level to build the handlers in parent first order
+      int level = 0;
+      for (ArrayList<ZipEntryWrapper<T>> levels : levelMapList)
+      {
+         if (trace)
+            log.trace("Level(" + level++ + "): " + levels);
+         for (ZipEntryWrapper<T> wrapper : levels)
+         {
+            String name = wrapper.getName();
+            int slash = wrapper.isDirectory() ? name.lastIndexOf('/', name.length() - 2) :
+                    name.lastIndexOf('/', name.length() - 1);
+            VirtualFileHandler parent = this;
+            if (slash >= 0)
+            {
+               // Need to include the slash in the name to match the ZipEntry.name
+               String parentName = name.substring(0, slash + 1);
+               parent = parentMap.get(parentName);
+               if (parent == null)
+               {
+                  // Build up the parent(s)
+                  parent = buildParents(parentName, parentMap, wrapper);
+               }
+            }
+            // Get the entry name without any directory '/' ending
+            int start = slash + 1;
+            int end = wrapper.isDirectory() ? name.length() - 1 : name.length();
+            String entryName = name.substring(start, end);
+            VirtualFileHandler handler = createVirtualFileHandler(parent, wrapper, entryName);
+            if (wrapper.isDirectory())
+            {
+               parentMap.put(name, handler);
+               if (trace)
+                  log.trace("Added parent: " + name);
+            }
+            if (parent == this)
+            {
+               // This is an immeadiate child of the jar handler
+               entries.add(handler);
+               entryMap.put(entryName, handler);
+            }
+            else if (parent instanceof HierarchyVirtualFileHandler)
+            {
+               HierarchyVirtualFileHandler ehandler = (HierarchyVirtualFileHandler) parent;
+               ehandler.addChild(handler);
+            }
+         }
+      }
+   }
+
+   /**
+    * Handle additional information about wrapper.
+    *
+    * @param wrapper the zip entry wrapper
+    * @throws IOException for any error
+    */
+   protected void extraWrapperInfo(ZipEntryWrapper<T> wrapper) throws IOException
+   {
+   }
+
+   /**
+    * Create any missing parents.
+    *
+    * @param parentName full vfs path name of parent
+    * @param parentMap  initJarFile parentMap
+    * @param wrapper    ZipEntryWrapper missing a parent
+    * @return the VirtualFileHandler for the parent
+    * @throws java.io.IOException for any IO error
+    */
+   protected VirtualFileHandler buildParents(String parentName, Map<String, VirtualFileHandler> parentMap, ZipEntryWrapper<T> wrapper)
+           throws IOException
+   {
+      VirtualFileHandler parent = this;
+      String[] paths = PathTokenizer.getTokens(parentName);
+      StringBuilder pathName = new StringBuilder();
+      for (String path : paths)
+      {
+         VirtualFileHandler next;
+         pathName.append(path);
+         pathName.append('/');
+         next = parent.getChild(path);
+         if (next == null)
+            next = createSynthenticParent(parent, path, wrapper);
+         parentMap.put(pathName.toString(), next);
+         parent = next;
+      }
+      return parent;
+   }
+
+   protected VirtualFileHandler createSynthenticParent(VirtualFileHandler parent, String path, ZipEntryWrapper<T> wrapper)
+         throws IOException
+   {
+      VirtualFileHandler next;// Create a synthetic parent
+      URL url = getURL(parent, path, true);
+      next = new SynthenticDirEntryHandler(getVFSContext(), parent, path, wrapper.getTime(), url);
+      if (parent == this)
+      {
+         // This is an immeadiate child of the jar handler
+         entries.add(next);
+         entryMap.put(path, next);
+      }
+      else if (parent instanceof HierarchyVirtualFileHandler)
+      {
+         HierarchyVirtualFileHandler ehandler = (HierarchyVirtualFileHandler) parent;
+         ehandler.addChild(next);
+      }
+      return next;
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      checkClosed();
+      if (entries == null)
+         return Collections.emptyList();
+      else
+         return Collections.unmodifiableList(entries);
+   }
+
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      return entryMap.get(name);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+
+   /**
+    * Create a new virtual file handler
+    *
+    * @param parent the parent
+    * @param wrapper  the entry wrapper
+    * @param entryName - the entry name without any trailing '/'
+    * @return the handler
+    * @throws java.io.IOException              for any error accessing the file system
+    * @throws IllegalArgumentException for a null parent or entry
+    */
+   protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, ZipEntryWrapper<T> wrapper, String entryName)
+           throws IOException
+   {
+      if (parent == null)
+         throw new IllegalArgumentException("Null parent");
+      if (wrapper == null)
+         throw new IllegalArgumentException("Null entry wrapper");
+
+      ZipEntry entry = wrapper.getEntry();
+      URL url = getURL(parent, entryName, entry.isDirectory());
+      VFSContext context = parent.getVFSContext();
+
+      VirtualFileHandler vfh;
+      if (JarUtils.isArchive(entry.getName()))
+      {
+         String flag = context.getOptions().get("useNoCopyJarHandler");
+         boolean useNoCopyJarHandler = Boolean.valueOf(flag);
+
+         if (useNoCopyJarHandler || forceNoCopy)
+            vfh = new NoCopyNestedJarHandler(context, parent, getJar(), entry, url, entryName);
+         else
+            vfh = NestedJarHandler.create(context, parent, getJar(), entry, url, entryName);
+      }
+      else
+      {
+         vfh = new JarEntryHandler(context, parent, getJar(), entry, entryName, url);
+      }
+
+      return vfh;
+   }
+
+   /**
+    * Restore the jar file
+    *
+    * @param in the input stream
+    * @throws IOException for any error reading the jar file
+    * @throws ClassNotFoundException for any jar class finding errors
+    */
+   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+   {
+      // Initial the parent jar entries
+      initJarFile();
+   }
+
+   private class JarEntryEnumeration implements Enumeration<ZipEntryWrapper<T>>
+   {
+      private Enumeration<JarEntry> enumeration;
+
+      public JarEntryEnumeration(Enumeration<JarEntry> enumeration)
+      {
+         if (enumeration == null)
+            throw new IllegalArgumentException("Null enumeration");
+         this.enumeration = enumeration;
+      }
+
+      public boolean hasMoreElements()
+      {
+         return enumeration.hasMoreElements();
+      }
+
+      public ZipEntryWrapper<T> nextElement()
+      {
+         JarEntry entry = enumeration.nextElement();
+         return new ZipEntryWrapper<T>(entry);
+      }
+   }
+
+   /**
+    * Check if force no copy system property exists.
+    */
+   private static class CheckForceNoCopy implements PrivilegedAction<Boolean>
+   {
+      public Boolean run()
+      {
+         String forceString = System.getProperty("jboss.vfs.forceNoCopy", "false");
+         return Boolean.valueOf(forceString);
+      }
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,132 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.jar;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVFSContext;
-import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * JarContext.
- * 
- * @author Scott.Stark at jboss.org
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class JarContext extends AbstractVFSContext
-{
-   /** The root file */
-   private final VirtualFileHandler root;
-   
-   /** A reference to the virtual file of the root to stop it getting closed */
-   private final VirtualFile rootFile;
-   
-   /**
-    * Create a new JarContext.
-    * 
-    * @param rootURL the root url
-    * @throws IOException for an error accessing the file system
-    * @throws URISyntaxException for an error parsing the URI
-    */
-   public JarContext(URL rootURL) throws IOException, URISyntaxException
-   {
-      super(rootURL);
-      root = createVirtualFileHandler(null, rootURL);
-      rootFile = root.getVirtualFile();
-   }
-
-   public VirtualFileHandler getRoot() throws IOException
-   {
-      return root;
-   }
-
-   /**
-    * Create a new virtual file handler
-    * 
-    * @param parent the parent
-    * @param url the url
-    * @return the handler
-    * @throws IOException for any error accessing the file system
-    * @throws IllegalArgumentException for a null entry or url
-    */
-   protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, URL url) throws IOException
-   {
-      if (url == null)
-         throw new IllegalArgumentException("Null url");
-
-      String urlStr = url.toString();
-      String jarName = extractJarName(urlStr);
-      String entryPath = urlStr;
-      entryPath = entryPath(entryPath);
-      JarHandler jar =  new JarHandler(this, parent, url, jarName);
-      if (entryPath == null)
-         return jar;
-      
-      // todo This is a hack until we can fix http://jira.jboss.com/jira/browse/JBMICROCONT-164
-      AbstractVirtualFileHandler result = (AbstractVirtualFileHandler)jar.findChild(entryPath);
-      result.setPathName("");
-      return result;
-   }
-
-   public static String entryPath(String entryName)
-   {
-      int index;
-      index = entryName.indexOf("!/");
-      if (index != -1)
-      {
-         entryName = entryName.substring(index + 2);
-      }
-      else
-      {
-         entryName = null;
-      }
-      if (entryName == null || "".equals(entryName.trim()))
-         return null;
-      
-      return entryName;
-   }
-
-   public static String extractJarName(String urlStr)
-   {
-      String jarName = urlStr;
-      int index = jarName.indexOf('!');
-      if (index != -1)
-         jarName = jarName.substring(0, index);
-      index = jarName.lastIndexOf('/');
-      if (index != -1 && index < jarName.length()-1)
-         jarName = jarName.substring(index+1);
-      return jarName;
-   }
-
-   @Override
-   protected void finalize() throws Throwable
-   {
-      if (rootFile != null)
-         rootFile.close();
-      super.finalize();
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,132 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.jar;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.AbstractVFSContext;
+import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * JarContext.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JarContext extends AbstractVFSContext
+{
+   /** The root file */
+   private final VirtualFileHandler root;
+   
+   /** A reference to the virtual file of the root to stop it getting closed */
+   private final VirtualFile rootFile;
+   
+   /**
+    * Create a new JarContext.
+    * 
+    * @param rootURL the root url
+    * @throws IOException for an error accessing the file system
+    * @throws URISyntaxException for an error parsing the URI
+    */
+   public JarContext(URL rootURL) throws IOException, URISyntaxException
+   {
+      super(rootURL);
+      root = createVirtualFileHandler(null, rootURL);
+      rootFile = root.getVirtualFile();
+   }
+
+   public VirtualFileHandler getRoot() throws IOException
+   {
+      return root;
+   }
+
+   /**
+    * Create a new virtual file handler
+    * 
+    * @param parent the parent
+    * @param url the url
+    * @return the handler
+    * @throws IOException for any error accessing the file system
+    * @throws IllegalArgumentException for a null entry or url
+    */
+   protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, URL url) throws IOException
+   {
+      if (url == null)
+         throw new IllegalArgumentException("Null url");
+
+      String urlStr = url.toString();
+      String jarName = extractJarName(urlStr);
+      String entryPath = urlStr;
+      entryPath = entryPath(entryPath);
+      JarHandler jar =  new JarHandler(this, parent, url, jarName);
+      if (entryPath == null)
+         return jar;
+      
+      // todo This is a hack until we can fix http://jira.jboss.com/jira/browse/JBMICROCONT-164
+      AbstractVirtualFileHandler result = (AbstractVirtualFileHandler)jar.getChild(entryPath);
+      result.setPathName("");
+      return result;
+   }
+
+   public static String entryPath(String entryName)
+   {
+      int index;
+      index = entryName.indexOf("!/");
+      if (index != -1)
+      {
+         entryName = entryName.substring(index + 2);
+      }
+      else
+      {
+         entryName = null;
+      }
+      if (entryName == null || "".equals(entryName.trim()))
+         return null;
+      
+      return entryName;
+   }
+
+   public static String extractJarName(String urlStr)
+   {
+      String jarName = urlStr;
+      int index = jarName.indexOf('!');
+      if (index != -1)
+         jarName = jarName.substring(0, index);
+      index = jarName.lastIndexOf('/');
+      if (index != -1 && index < jarName.length()-1)
+         jarName = jarName.substring(index+1);
+      return jarName;
+   }
+
+   @Override
+   protected void finalize() throws Throwable
+   {
+      if (rootFile != null)
+         rootFile.close();
+      super.finalize();
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,256 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.jar;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * A nested jar contents implementation used to represent a jar within a jar.
- *
- * @author Ales.Justin at jboss.org
- * @author Scott.Stark at jboss.org
- */
-public class JarEntryContents extends AbstractJarHandler implements StructuredVirtualFileHandler, HierarchyVirtualFileHandler
-{
-   /**
-    * serialVersionUID
-    */
-   private static final long serialVersionUID = 1L;
-
-   private URL entryURL;
-   private byte[] contents;
-   private boolean isJar;
-   private NestedJarFromStream njar;
-   private InputStream openStream;
-
-   private List<VirtualFileHandler> entryChildren;
-   private transient Map<String, VirtualFileHandler> entryMap;
-
-   JarEntryContents(VFSContext context, VirtualFileHandler parent, ZipEntry entry, String entryName, URL jarURL, URL entryURL, byte[] contents)
-           throws IOException
-   {
-      super(context, parent, jarURL, null, entry, entryName);
-      try
-      {
-         setPathName(getChildPathName(entryName, false));
-         setVfsUrl(getChildVfsUrl(entryName, false));
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-      this.entryURL = entryURL;
-      this.isJar = JarUtils.isArchive(getName());
-      this.contents = contents;
-   }
-
-   protected void initCacheLastModified()
-   {
-   }
-
-   /**
-    * Add a child to an entry
-    *
-    * @param child the child
-    */
-   public synchronized void addChild(VirtualFileHandler child)
-   {
-      if (entryChildren == null)
-         entryChildren = new ArrayList<VirtualFileHandler>();
-      entryChildren.add(child);
-      if (entryMap != null)
-         entryMap.put(child.getName(), child);
-   }
-
-   /**
-    * TODO: removing the entry/jar that resulted in this needs
-    * to be detected.
-    */
-   public boolean exists() throws IOException
-   {
-      return true;
-   }
-
-   public boolean isHidden() throws IOException
-   {
-      return false;
-   }
-
-   byte[] getContents()
-   {
-      return contents;
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      List<VirtualFileHandler> children;
-
-      if (isJar)
-      {
-         initNestedJar();
-         children = njar.getChildren(ignoreErrors);
-      }
-      else
-      {
-         children = entryChildren;
-      }
-
-      if (children == null)
-         return Collections.emptyList();
-      else
-         return Collections.unmodifiableList(children);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-
-      if ("".equals(path))
-         return this;
-
-      if (isJar)
-      {
-         initNestedJar();
-         return njar.findChild(path);
-      }
-      else if (getEntry().isDirectory())
-      {
-         return structuredFindChild(path);
-      }
-      throw new FileNotFoundException("JarEntryContents(" + getName() + ") has no children");
-   }
-
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      if (entryChildren == null)
-         throw new FileNotFoundException(this + " has no children");
-      if (entryMap == null)
-      {
-         entryMap = new HashMap<String, VirtualFileHandler>();
-         for (VirtualFileHandler child : entryChildren)
-            entryMap.put(child.getName(), child);
-      }
-      VirtualFileHandler child = entryMap.get(name);
-      if (child == null)
-         throw new FileNotFoundException(this + " has no child: " + name);
-      return child;
-   }
-
-   // Convience attribute accessors
-   public long getLastModified()
-   {
-      return getEntry().getTime();
-   }
-
-   public long getSize()
-   {
-      return getEntry().getSize();
-   }
-
-   public boolean isLeaf()
-   {
-      return isJar == false && getEntry().isDirectory() == false;
-   }
-
-   // Stream accessor
-   public synchronized InputStream openStream() throws IOException
-   {
-      initNestedJar();
-      if (njar != null)
-         openStream = njar.openStream();
-      else
-         openStream = new ByteArrayInputStream(contents);
-      return openStream;
-   }
-
-   public synchronized void close()
-   {
-      if (openStream != null)
-      {
-         try
-         {
-            openStream.close();
-         }
-         catch (IOException e)
-         {
-            log.error("close error", e);
-         }
-         openStream = null;
-      }
-   }
-
-   public URI toURI() throws URISyntaxException
-   {
-      return entryURL.toURI();
-   }
-
-   public String toString()
-   {
-      StringBuffer tmp = new StringBuffer(super.toString());
-      tmp.append('[');
-      tmp.append("name=");
-      tmp.append(getName());
-      tmp.append(",size=");
-      tmp.append(getSize());
-      tmp.append(",time=");
-      tmp.append(getLastModified());
-      tmp.append(",URI=");
-      try
-      {
-         tmp.append(toURI());
-      }
-      catch (URISyntaxException ignored)
-      {
-      }
-      tmp.append(']');
-      return tmp.toString();
-   }
-
-   protected synchronized void initNestedJar() throws IOException
-   {
-      if (isJar && njar == null)
-      {
-         ByteArrayInputStream bais = new ByteArrayInputStream(contents);
-         ZipInputStream zis = new ZipInputStream(bais);
-         njar = new NestedJarFromStream(getVFSContext(), getParent(), zis, entryURL, null, getEntry(), getName());
-      }
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,275 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.jar;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * A nested jar contents implementation used to represent a jar within a jar.
+ *
+ * @author Ales.Justin at jboss.org
+ * @author Scott.Stark at jboss.org
+ */
+public class JarEntryContents extends AbstractJarHandler implements StructuredVirtualFileHandler, HierarchyVirtualFileHandler
+{
+   /**
+    * serialVersionUID
+    */
+   private static final long serialVersionUID = 1L;
+
+   private URL entryURL;
+   private byte[] contents;
+   private boolean isJar;
+   private NestedJarFromStream njar;
+   private InputStream openStream;
+
+   private List<VirtualFileHandler> entryChildren;
+   private transient Map<String, VirtualFileHandler> entryMap;
+
+   JarEntryContents(VFSContext context, VirtualFileHandler parent, ZipEntry entry, String entryName, URL jarURL, URL entryURL, byte[] contents)
+           throws IOException
+   {
+      super(context, parent, jarURL, null, entry, entryName);
+      try
+      {
+         setPathName(getChildPathName(entryName, false));
+         setVfsUrl(getChildVfsUrl(entryName, false));
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+      this.entryURL = entryURL;
+      this.isJar = JarUtils.isArchive(getName());
+      this.contents = contents;
+   }
+
+   protected void initCacheLastModified()
+   {
+   }
+
+   /**
+    * Add a child to an entry
+    *
+    * @param child the child
+    */
+   public synchronized void addChild(VirtualFileHandler child)
+   {
+      if (entryChildren == null)
+         entryChildren = new ArrayList<VirtualFileHandler>();
+      entryChildren.add(child);
+      if (entryMap != null)
+         entryMap.put(child.getName(), child);
+   }
+
+   /**
+    * TODO: removing the entry/jar that resulted in this needs
+    * to be detected.
+    */
+   public boolean exists() throws IOException
+   {
+      return true;
+   }
+
+   public boolean isHidden() throws IOException
+   {
+      return false;
+   }
+
+   byte[] getContents()
+   {
+      return contents;
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      List<VirtualFileHandler> children;
+
+      if (isJar)
+      {
+         initNestedJar();
+         children = njar.getChildren(ignoreErrors);
+      }
+      else
+      {
+         children = entryChildren;
+      }
+
+      if (children == null)
+         return Collections.emptyList();
+      else
+         return Collections.unmodifiableList(children);
+   }
+
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      return findChildHandler(name, true);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      if ("".equals(path))
+         return this;
+
+      if (isJar)
+      {
+         initNestedJar();
+         return njar.getChild(path);
+      }
+      else if (getEntry().isDirectory())
+      {
+         return structuredFindChild(path);
+      }
+      return null;
+   }
+
+   /**
+    * Find the handler.
+    * TODO: synchronization on lazy entryMap creation
+    *
+    * @param name the path name
+    * @param allowNull do we allow nulls
+    * @return handler or <code>null</code> is it doesn't exist
+    * @throws IOException for any error
+    */
+   protected synchronized VirtualFileHandler findChildHandler(String name, boolean allowNull) throws IOException
+   {
+      if (entryChildren == null)
+      {
+         if (allowNull)
+            return null;
+         throw new FileNotFoundException(this + " has no children");
+      }
+
+      if (entryMap == null)
+      {
+         entryMap = new HashMap<String, VirtualFileHandler>();
+         for (VirtualFileHandler child : entryChildren)
+            entryMap.put(child.getName(), child);
+      }
+      VirtualFileHandler child = entryMap.get(name);
+      if (child == null && allowNull == false)
+         throw new FileNotFoundException(this + " has no child: " + name);
+      return child;
+   }
+
+   // Convience attribute accessors
+   public long getLastModified()
+   {
+      return getEntry().getTime();
+   }
+
+   public long getSize()
+   {
+      return getEntry().getSize();
+   }
+
+   public boolean isLeaf()
+   {
+      return isJar == false && getEntry().isDirectory() == false;
+   }
+
+   // Stream accessor
+   public synchronized InputStream openStream() throws IOException
+   {
+      initNestedJar();
+      if (njar != null)
+         openStream = njar.openStream();
+      else
+         openStream = new ByteArrayInputStream(contents);
+      return openStream;
+   }
+
+   public synchronized void close()
+   {
+      if (openStream != null)
+      {
+         try
+         {
+            openStream.close();
+         }
+         catch (IOException e)
+         {
+            log.error("close error", e);
+         }
+         openStream = null;
+      }
+   }
+
+   public URI toURI() throws URISyntaxException
+   {
+      return entryURL.toURI();
+   }
+
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer(super.toString());
+      tmp.append('[');
+      tmp.append("name=");
+      tmp.append(getName());
+      tmp.append(",size=");
+      tmp.append(getSize());
+      tmp.append(",time=");
+      tmp.append(getLastModified());
+      tmp.append(",URI=");
+      try
+      {
+         tmp.append(toURI());
+      }
+      catch (URISyntaxException ignored)
+      {
+      }
+      tmp.append(']');
+      return tmp.toString();
+   }
+
+   protected synchronized void initNestedJar() throws IOException
+   {
+      if (isJar && njar == null)
+      {
+         ByteArrayInputStream bais = new ByteArrayInputStream(contents);
+         ZipInputStream zis = new ZipInputStream(bais);
+         njar = new NestedJarFromStream(getVFSContext(), getParent(), zis, entryURL, null, getEntry(), getName());
+      }
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,170 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.jar;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * JarEntryHandler.
- *
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public class JarEntryHandler extends AbstractJarHandler implements StructuredVirtualFileHandler, HierarchyVirtualFileHandler
-{
-   /**
-    * serialVersionUID
-    */
-   private static final long serialVersionUID = 1L;
-
-   private List<VirtualFileHandler> entryChildren;
-   private transient Map<String, VirtualFileHandler> entryMap;
-
-   /**
-    * Create a new JarHandler.
-    *
-    * @param context   the context
-    * @param parent    the parent
-    * @param jar       the jar file
-    * @param entry     the entry
-    * @param entryName the entry name
-    * @param url       the url
-    * @throws IOException              for an error accessing the file system
-    * @throws IllegalArgumentException for a null context, url, jar or entry
-    */
-   public JarEntryHandler(VFSContext context, VirtualFileHandler parent, JarFile jar, ZipEntry entry, String entryName, URL url)
-         throws IOException
-   {
-      super(context, parent, url, jar, entry, entryName);
-      try
-      {
-         setVfsUrl(getChildVfsUrl(entryName, entry.isDirectory()));
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   @Override
-   protected void initCacheLastModified()
-   {
-      // complete
-   }
-
-   @Override
-   public boolean hasBeenModified() throws IOException
-   {
-      return false; // right now, jar entries should always 
-   }
-
-   /**
-    * Add a child to an entry
-    *
-    * @param child the child
-    */
-   public void addChild(VirtualFileHandler child)
-   {
-      if (entryChildren == null)
-         entryChildren = new ArrayList<VirtualFileHandler>();
-      entryChildren.add(child);
-   }
-
-   @Override
-   public long getLastModified()
-   {
-      return getEntry().getTime();
-   }
-
-   @Override
-   public long getSize()
-   {
-      return getEntry().getSize();
-   }
-
-   public boolean isLeaf()
-   {
-      return getEntry().isDirectory() == false;
-   }
-
-   public boolean isHidden()
-   {
-      checkClosed();
-      return false;
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      checkClosed();
-      if (entryChildren == null)
-         return Collections.emptyList();
-      return Collections.unmodifiableList(entryChildren);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   @Override
-   public InputStream openStream() throws IOException
-   {
-      return getJar().getInputStream(getEntry());
-   }
-
-   /**
-    * TODO: synchronization on lazy entryMap creation
-    */
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      if (entryChildren == null)
-         throw new FileNotFoundException(this + " has no children");
-      if (entryMap == null)
-      {
-         entryMap = new HashMap<String, VirtualFileHandler>();
-         for (VirtualFileHandler child : entryChildren)
-            entryMap.put(child.getName(), child);
-      }
-      VirtualFileHandler child = entryMap.get(name);
-      if (child == null)
-         throw new FileNotFoundException(this + " has no child: " + name);
-      return child;
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,186 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.jar;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * JarEntryHandler.
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class JarEntryHandler extends AbstractJarHandler implements StructuredVirtualFileHandler, HierarchyVirtualFileHandler
+{
+   /**
+    * serialVersionUID
+    */
+   private static final long serialVersionUID = 1L;
+
+   private List<VirtualFileHandler> entryChildren;
+   private transient Map<String, VirtualFileHandler> entryMap;
+
+   /**
+    * Create a new JarHandler.
+    *
+    * @param context   the context
+    * @param parent    the parent
+    * @param jar       the jar file
+    * @param entry     the entry
+    * @param entryName the entry name
+    * @param url       the url
+    * @throws IOException              for an error accessing the file system
+    * @throws IllegalArgumentException for a null context, url, jar or entry
+    */
+   public JarEntryHandler(VFSContext context, VirtualFileHandler parent, JarFile jar, ZipEntry entry, String entryName, URL url)
+         throws IOException
+   {
+      super(context, parent, url, jar, entry, entryName);
+      try
+      {
+         setVfsUrl(getChildVfsUrl(entryName, entry.isDirectory()));
+      }
+      catch (URISyntaxException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   @Override
+   protected void initCacheLastModified()
+   {
+      // complete
+   }
+
+   @Override
+   public boolean hasBeenModified() throws IOException
+   {
+      return false; // right now, jar entries should always 
+   }
+
+   /**
+    * Add a child to an entry
+    *
+    * @param child the child
+    */
+   public void addChild(VirtualFileHandler child)
+   {
+      if (entryChildren == null)
+         entryChildren = new ArrayList<VirtualFileHandler>();
+      entryChildren.add(child);
+   }
+
+   @Override
+   public long getLastModified()
+   {
+      return getEntry().getTime();
+   }
+
+   @Override
+   public long getSize()
+   {
+      return getEntry().getSize();
+   }
+
+   public boolean isLeaf()
+   {
+      return getEntry().isDirectory() == false;
+   }
+
+   public boolean isHidden()
+   {
+      checkClosed();
+      return false;
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      checkClosed();
+      if (entryChildren == null)
+         return Collections.emptyList();
+      return Collections.unmodifiableList(entryChildren);
+   }
+
+   @Override
+   public InputStream openStream() throws IOException
+   {
+      return getJar().getInputStream(getEntry());
+   }
+
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      return findChildHandler(name, true);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+
+   /**
+    * Find the handler.
+    * TODO: synchronization on lazy entryMap creation
+    *
+    * @param name the path name
+    * @param allowNull do we allow nulls
+    * @return handler or <code>null</code> is it doesn't exist
+    * @throws IOException for any error
+    */
+   protected synchronized VirtualFileHandler findChildHandler(String name, boolean allowNull) throws IOException
+   {
+      if (entryChildren == null)
+      {
+         if (allowNull)
+            return null;
+         throw new FileNotFoundException(this + " has no children");
+      }
+
+      if (entryMap == null)
+      {
+         entryMap = new HashMap<String, VirtualFileHandler>();
+         for (VirtualFileHandler child : entryChildren)
+            entryMap.put(child.getName(), child);
+      }
+      VirtualFileHandler child = entryMap.get(name);
+      if (child == null && allowNull == false)
+         throw new FileNotFoundException(this + " has no child: " + name);
+      return child;
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2005 Your Corporation. All Rights Reserved.
- */
-package org.jboss.virtual.plugins.context.jar;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * A nested jar implementation used to represent a jar within a jar.
- *
- * @author Ales.Justin at jboss.org
- * @author Scott.Stark at jboss.org
- * @version $Revision: 44334 $
- */
-public class NestedJarFromStream extends AbstractStructuredJarHandler<byte[]>
-{
-   /**
-    * serialVersionUID
-    */
-   private static final long serialVersionUID = 1L;
-
-   private transient ZipInputStream zis;
-   private URL jarURL;
-   private URL entryURL;
-   private long lastModified;
-   private long size;
-   private AtomicBoolean inited = new AtomicBoolean(false);
-
-   /**
-    * Create a nested jar from the parent zip inputstream/zip entry.
-    *
-    * @param context   - the context containing the jar
-    * @param parent    - the jar handler for this nested jar
-    * @param zis       - the jar zip input stream
-    * @param jarURL    - the URL to use as the jar URL
-    * @param jar       - the parent jar file for the nested jar
-    * @param entry     - the zip entry
-    * @param entryName - the entry name
-    * @throws IOException for any error
-    */
-   public NestedJarFromStream(VFSContext context, VirtualFileHandler parent, ZipInputStream zis, URL jarURL, JarFile jar, ZipEntry entry, String entryName) throws IOException
-   {
-      super(context, parent, jarURL, jar, entry, entryName);
-      this.jarURL = jarURL;
-      this.lastModified = entry.getTime();
-      this.size = entry.getSize();
-      this.zis = zis;
-      try
-      {
-         setPathName(getChildPathName(entryName, false));
-         setVfsUrl(getChildVfsUrl(entryName, false));
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   protected void initCacheLastModified()
-   {
-      cachedLastModified = lastModified;
-   }
-
-   /**
-    * Initialize entries.
-    *
-    * @throws IOException for any error
-    */
-   protected void init() throws IOException
-   {
-      if (inited.get() == false)
-      {
-         inited.set(true);
-         try
-         {
-            initJarFile(new ZisEnumeration());
-         }
-         finally
-         {
-            close();
-         }
-      }
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      init();
-      return super.getChildren(ignoreErrors);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      init();
-      return super.findChild(path);
-   }
-
-   protected void extraWrapperInfo(ZipEntryWrapper<byte[]> wrapper) throws IOException
-   {
-      byte[] contents;
-      int size = (int)wrapper.getSize();
-      if (size > 0)
-      {
-         ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
-         byte[] tmp = new byte[1024];
-         while (zis.available() > 0)
-         {
-            int length = zis.read(tmp);
-            if (length > 0)
-               baos.write(tmp, 0, length);
-         }
-         contents = baos.toByteArray();
-      }
-      else
-         contents = new byte[0];
-      wrapper.setExtra(contents);
-   }
-
-   protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, ZipEntryWrapper<byte[]> wrapper, String entryName) throws IOException
-   {
-      try
-      {
-         String url = toURI().toASCIIString() + "!/" + wrapper.getName();
-         URL jecURL = new URL(url);
-         VFSContext context = parent.getVFSContext();
-         byte[] contents = wrapper.getExtra();
-         return new JarEntryContents(context, parent, wrapper.getEntry(), entryName, toURL(), jecURL, contents);
-      }
-      catch (Throwable t)
-      {
-         IOException ioe = new IOException("Exception while reading nested jar entry: " + this);
-         ioe.initCause(t);
-         ioe.setStackTrace(t.getStackTrace());
-         throw ioe;
-      }
-   }
-
-   /**
-    * TODO: removing the entry/jar that resulted in this needs
-    * to be detected.
-    */
-   public boolean exists() throws IOException
-   {
-      return true;
-   }
-
-   public boolean isHidden()
-   {
-      return false;
-   }
-
-   public long getSize()
-   {
-      return size;
-   }
-
-   public long getLastModified() throws IOException
-   {
-      return lastModified;
-   }
-
-   // Stream accessor
-   public InputStream openStream() throws IOException
-   {
-      return zis;
-   }
-
-   public void close()
-   {
-      if (zis != null)
-      {
-         try
-         {
-            zis.close();
-         }
-         catch (IOException e)
-         {
-            log.error("close error", e);
-         }
-         zis = null;
-      }
-   }
-
-   public URI toURI() throws URISyntaxException
-   {
-      try
-      {
-         if (entryURL == null)
-            entryURL = new URL(jarURL, getName());
-      }
-      catch (MalformedURLException e)
-      {
-         throw new URISyntaxException("Failed to create relative jarURL", e.getMessage());
-      }
-      return entryURL.toURI();
-   }
-
-   public String toString()
-   {
-      StringBuffer tmp = new StringBuffer(super.toString());
-      tmp.append('[');
-      tmp.append("name=");
-      tmp.append(getName());
-      tmp.append(",size=");
-      tmp.append(getSize());
-      tmp.append(",lastModified=");
-      tmp.append(lastModified);
-      tmp.append(",URI=");
-      try
-      {
-         tmp.append(toURI());
-      }
-      catch (URISyntaxException e)
-      {
-      }
-      tmp.append(']');
-      return tmp.toString();
-   }
-
-   protected void initJarFile() throws IOException
-   {
-      // todo - deserialize
-   }
-
-   private class ZisEnumeration implements Enumeration<ZipEntryWrapper<byte[]>>
-   {
-      private boolean moved = true;
-      private ZipEntry next = null;
-
-      public boolean hasMoreElements()
-      {
-         if (zis == null)
-            return false;
-         
-         try
-         {
-            if (moved)
-            {
-               next = zis.getNextEntry();
-               moved = false;
-            }
-            return next != null;
-         }
-         catch (IOException e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-
-      public ZipEntryWrapper<byte[]> nextElement()
-      {
-         moved = true;
-         return new ZipEntryWrapper<byte[]>(next);
-      }
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.jboss.virtual.plugins.context.jar;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * A nested jar implementation used to represent a jar within a jar.
+ *
+ * @author Ales.Justin at jboss.org
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 44334 $
+ */
+public class NestedJarFromStream extends AbstractStructuredJarHandler<byte[]>
+{
+   /**
+    * serialVersionUID
+    */
+   private static final long serialVersionUID = 1L;
+
+   private transient ZipInputStream zis;
+   private URL jarURL;
+   private URL entryURL;
+   private long lastModified;
+   private long size;
+   private AtomicBoolean inited = new AtomicBoolean(false);
+
+   /**
+    * Create a nested jar from the parent zip inputstream/zip entry.
+    *
+    * @param context   - the context containing the jar
+    * @param parent    - the jar handler for this nested jar
+    * @param zis       - the jar zip input stream
+    * @param jarURL    - the URL to use as the jar URL
+    * @param jar       - the parent jar file for the nested jar
+    * @param entry     - the zip entry
+    * @param entryName - the entry name
+    * @throws IOException for any error
+    */
+   public NestedJarFromStream(VFSContext context, VirtualFileHandler parent, ZipInputStream zis, URL jarURL, JarFile jar, ZipEntry entry, String entryName) throws IOException
+   {
+      super(context, parent, jarURL, jar, entry, entryName);
+      this.jarURL = jarURL;
+      this.lastModified = entry.getTime();
+      this.size = entry.getSize();
+      this.zis = zis;
+      try
+      {
+         setPathName(getChildPathName(entryName, false));
+         setVfsUrl(getChildVfsUrl(entryName, false));
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   protected void initCacheLastModified()
+   {
+      cachedLastModified = lastModified;
+   }
+
+   /**
+    * Initialize entries.
+    *
+    * @throws IOException for any error
+    */
+   protected void init() throws IOException
+   {
+      if (inited.get() == false)
+      {
+         inited.set(true);
+         try
+         {
+            initJarFile(new ZisEnumeration());
+         }
+         finally
+         {
+            close();
+         }
+      }
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      init();
+      return super.getChildren(ignoreErrors);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      init();
+      return super.getChild(path);
+   }
+
+   protected void extraWrapperInfo(ZipEntryWrapper<byte[]> wrapper) throws IOException
+   {
+      byte[] contents;
+      int size = (int)wrapper.getSize();
+      if (size > 0)
+      {
+         ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
+         byte[] tmp = new byte[1024];
+         while (zis.available() > 0)
+         {
+            int length = zis.read(tmp);
+            if (length > 0)
+               baos.write(tmp, 0, length);
+         }
+         contents = baos.toByteArray();
+      }
+      else
+         contents = new byte[0];
+      wrapper.setExtra(contents);
+   }
+
+   protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, ZipEntryWrapper<byte[]> wrapper, String entryName) throws IOException
+   {
+      try
+      {
+         String url = toURI().toASCIIString() + "!/" + wrapper.getName();
+         URL jecURL = new URL(url);
+         VFSContext context = parent.getVFSContext();
+         byte[] contents = wrapper.getExtra();
+         return new JarEntryContents(context, parent, wrapper.getEntry(), entryName, toURL(), jecURL, contents);
+      }
+      catch (Throwable t)
+      {
+         IOException ioe = new IOException("Exception while reading nested jar entry: " + this);
+         ioe.initCause(t);
+         ioe.setStackTrace(t.getStackTrace());
+         throw ioe;
+      }
+   }
+
+   /**
+    * TODO: removing the entry/jar that resulted in this needs
+    * to be detected.
+    */
+   public boolean exists() throws IOException
+   {
+      return true;
+   }
+
+   public boolean isHidden()
+   {
+      return false;
+   }
+
+   public long getSize()
+   {
+      return size;
+   }
+
+   public long getLastModified() throws IOException
+   {
+      return lastModified;
+   }
+
+   // Stream accessor
+   public InputStream openStream() throws IOException
+   {
+      return zis;
+   }
+
+   public void close()
+   {
+      if (zis != null)
+      {
+         try
+         {
+            zis.close();
+         }
+         catch (IOException e)
+         {
+            log.error("close error", e);
+         }
+         zis = null;
+      }
+   }
+
+   public URI toURI() throws URISyntaxException
+   {
+      try
+      {
+         if (entryURL == null)
+            entryURL = new URL(jarURL, getName());
+      }
+      catch (MalformedURLException e)
+      {
+         throw new URISyntaxException("Failed to create relative jarURL", e.getMessage());
+      }
+      return entryURL.toURI();
+   }
+
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer(super.toString());
+      tmp.append('[');
+      tmp.append("name=");
+      tmp.append(getName());
+      tmp.append(",size=");
+      tmp.append(getSize());
+      tmp.append(",lastModified=");
+      tmp.append(lastModified);
+      tmp.append(",URI=");
+      try
+      {
+         tmp.append(toURI());
+      }
+      catch (URISyntaxException e)
+      {
+      }
+      tmp.append(']');
+      return tmp.toString();
+   }
+
+   protected void initJarFile() throws IOException
+   {
+      // todo - deserialize
+   }
+
+   private class ZisEnumeration implements Enumeration<ZipEntryWrapper<byte[]>>
+   {
+      private boolean moved = true;
+      private ZipEntry next = null;
+
+      public boolean hasMoreElements()
+      {
+         if (zis == null)
+            return false;
+         
+         try
+         {
+            if (moved)
+            {
+               next = zis.getNextEntry();
+               moved = false;
+            }
+            return next != null;
+         }
+         catch (IOException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+
+      public ZipEntryWrapper<byte[]> nextElement()
+      {
+         moved = true;
+         return new ZipEntryWrapper<byte[]>(next);
+      }
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,137 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.jar;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Nested Jar Handler.
- * 
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class NoCopyNestedJarHandler extends AbstractJarHandler
-{
-   /** serialVersionUID */
-   private static final long serialVersionUID = 1L;
-
-   /** The nested jar */
-   private NestedJarFromStream njar;
-
-   /**
-    * Create a new NestedJarHandler.
-    * 
-    * @param context the context
-    * @param parent the parent
-    * @param parentJar the parent jar file
-    * @param entry the jar entry
-    * @param url the url
-    * @param entryName the entry name
-    * @throws IOException for an error accessing the file system
-    * @throws IllegalArgumentException for a null context, url or vfsPath
-    */
-   public NoCopyNestedJarHandler(VFSContext context, VirtualFileHandler parent, JarFile parentJar, ZipEntry entry, URL url, String entryName) throws IOException
-   {
-      super(context, parent, url, parentJar, entry, entryName);
-      
-      try
-      {
-         setPathName(getChildPathName(entryName, false));
-         setVfsUrl(getChildVfsUrl(entryName, false));
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException(e);
-      }
-
-      try
-      {
-         InputStream is = parentJar.getInputStream(entry);
-         ZipInputStream zis;
-         if(is instanceof ZipInputStream)
-         {
-            zis = (ZipInputStream) is;
-         }
-         else
-         {
-            zis = new ZipInputStream(is);
-         }
-         njar = new NestedJarFromStream(context, parent, zis, url, parentJar, entry, entryName);
-      }
-      catch (IOException original)
-      {
-         // Fix the context of the error message
-         IOException e = new IOException("Error opening jar file: " + url + " reason=" + original.getMessage());
-         e.setStackTrace(original.getStackTrace());
-         throw e;
-      }
-   }
-   
-   protected void initCacheLastModified()
-   {
-   }
-
-   @Override
-   public long getLastModified() throws IOException
-   {
-      return getEntry().getTime();
-   }
-
-   @Override
-   public long getSize() throws IOException
-   {
-      return getEntry().getSize();
-   }
-
-   @Override
-   public InputStream openStream() throws IOException
-   {
-      return getJar().getInputStream(getEntry());
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-
-      if ("".equals(path))
-         return this;
-
-      return njar.findChild(path);
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      return njar.getChildren(ignoreErrors);
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,137 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.jar;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Nested Jar Handler.
+ * 
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class NoCopyNestedJarHandler extends AbstractJarHandler
+{
+   /** serialVersionUID */
+   private static final long serialVersionUID = 1L;
+
+   /** The nested jar */
+   private NestedJarFromStream njar;
+
+   /**
+    * Create a new NestedJarHandler.
+    * 
+    * @param context the context
+    * @param parent the parent
+    * @param parentJar the parent jar file
+    * @param entry the jar entry
+    * @param url the url
+    * @param entryName the entry name
+    * @throws IOException for an error accessing the file system
+    * @throws IllegalArgumentException for a null context, url or vfsPath
+    */
+   public NoCopyNestedJarHandler(VFSContext context, VirtualFileHandler parent, JarFile parentJar, ZipEntry entry, URL url, String entryName) throws IOException
+   {
+      super(context, parent, url, parentJar, entry, entryName);
+      
+      try
+      {
+         setPathName(getChildPathName(entryName, false));
+         setVfsUrl(getChildVfsUrl(entryName, false));
+      }
+      catch (URISyntaxException e)
+      {
+         throw new RuntimeException(e);
+      }
+
+      try
+      {
+         InputStream is = parentJar.getInputStream(entry);
+         ZipInputStream zis;
+         if(is instanceof ZipInputStream)
+         {
+            zis = (ZipInputStream) is;
+         }
+         else
+         {
+            zis = new ZipInputStream(is);
+         }
+         njar = new NestedJarFromStream(context, parent, zis, url, parentJar, entry, entryName);
+      }
+      catch (IOException original)
+      {
+         // Fix the context of the error message
+         IOException e = new IOException("Error opening jar file: " + url + " reason=" + original.getMessage());
+         e.setStackTrace(original.getStackTrace());
+         throw e;
+      }
+   }
+   
+   protected void initCacheLastModified()
+   {
+   }
+
+   @Override
+   public long getLastModified() throws IOException
+   {
+      return getEntry().getTime();
+   }
+
+   @Override
+   public long getSize() throws IOException
+   {
+      return getEntry().getSize();
+   }
+
+   @Override
+   public InputStream openStream() throws IOException
+   {
+      return getJar().getInputStream(getEntry());
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      if ("".equals(path))
+         return this;
+
+      return njar.getChild(path);
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      return njar.getChildren(ignoreErrors);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,181 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.jar;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.virtual.plugins.context.AbstractURLHandler;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * SynthenticDirEntryHandler represents non-existent directory jar entry.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
- */
-public class SynthenticDirEntryHandler extends AbstractURLHandler
-      implements StructuredVirtualFileHandler, HierarchyVirtualFileHandler
-{
-   /**
-    * serialVersionUID
-    */
-   private static final long serialVersionUID = 1L;
-
-   /**
-    * The jar file
-    */
-   private long lastModified;
-   private List<VirtualFileHandler> entryChildren;
-   private transient Map<String, VirtualFileHandler> entryMap;
-
-   /**
-    * Create a new SynthenticDirEntryHandler.
-    *
-    * @param context      the context
-    * @param parent       the parent
-    * @param entryName    - the simple name for the dir
-    * @param lastModified the timestamp for the dir
-    * @param url          the full url
-    * @throws IOException              for an error accessing the file system
-    * @throws IllegalArgumentException for a null context, url, jar or entry
-    */
-   public SynthenticDirEntryHandler(VFSContext context, VirtualFileHandler parent,
-                                    String entryName, long lastModified, URL url)
-         throws IOException
-   {
-      super(context, parent, url, entryName);
-      try
-      {
-         URL parentVfsUrl = parent.toVfsUrl();
-         String vfsParentUrl = parentVfsUrl.toString();
-         setVfsUrl(getChildVfsUrl(entryName, vfsParentUrl.endsWith("/") == false));
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException(e);
-      }
-      this.lastModified = lastModified;
-   }
-
-   /**
-    * Add a child to an entry
-    *
-    * @param child the child file handler
-    */
-   public synchronized void addChild(VirtualFileHandler child)
-   {
-      if (entryChildren == null)
-         entryChildren = new ArrayList<VirtualFileHandler>();
-      entryChildren.add(child);
-      if (entryMap != null)
-         entryMap.put(child.getName(), child);
-   }
-
-   @Override
-   public long getLastModified()
-   {
-      return lastModified;
-   }
-
-   @Override
-   public long getSize()
-   {
-      return 0;
-   }
-
-   /**
-    * TODO: removing the entry/jar that resulted in this needs
-    * to be detected.
-    */
-   public boolean exists() throws IOException
-   {
-      return true;
-   }
-
-   public boolean isLeaf()
-   {
-      return false;
-   }
-
-   public boolean isHidden()
-   {
-      checkClosed();
-      return false;
-   }
-
-   @Override
-   public InputStream openStream() throws IOException
-   {
-      throw new IOException("Directories cannot be opened");
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      checkClosed();
-      if (entryChildren == null)
-         return Collections.emptyList();
-      return Collections.unmodifiableList(entryChildren);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   /**
-    * Create a child handler for the given name. This looks to the entryMap
-    * for an existing child.
-    *
-    * @param name - the simple name of an immeadiate child.
-    * @return the VirtualFileHandler previously added via addChild.
-    * @throws IOException - thrown if there are no children or the
-    *                     name does not match a child
-    */
-   public synchronized VirtualFileHandler createChildHandler(String name)
-         throws IOException
-   {
-      if (entryChildren == null)
-         throw new FileNotFoundException(this + " has no children");
-      if (entryMap == null)
-      {
-         entryMap = new HashMap<String, VirtualFileHandler>();
-         for (VirtualFileHandler child : entryChildren)
-            entryMap.put(child.getName(), child);
-      }
-      VirtualFileHandler child = entryMap.get(name);
-      if (child == null)
-         throw new FileNotFoundException(this + " has no child: " + name);
-      return child;
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,199 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.jar;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.virtual.plugins.context.AbstractURLHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * SynthenticDirEntryHandler represents non-existent directory jar entry.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class SynthenticDirEntryHandler extends AbstractURLHandler
+      implements StructuredVirtualFileHandler, HierarchyVirtualFileHandler
+{
+   /**
+    * serialVersionUID
+    */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * The jar file
+    */
+   private long lastModified;
+   private List<VirtualFileHandler> entryChildren;
+   private transient Map<String, VirtualFileHandler> entryMap;
+
+   /**
+    * Create a new SynthenticDirEntryHandler.
+    *
+    * @param context      the context
+    * @param parent       the parent
+    * @param entryName    - the simple name for the dir
+    * @param lastModified the timestamp for the dir
+    * @param url          the full url
+    * @throws IOException              for an error accessing the file system
+    * @throws IllegalArgumentException for a null context, url, jar or entry
+    */
+   public SynthenticDirEntryHandler(VFSContext context, VirtualFileHandler parent,
+                                    String entryName, long lastModified, URL url)
+         throws IOException
+   {
+      super(context, parent, url, entryName);
+      try
+      {
+         URL parentVfsUrl = parent.toVfsUrl();
+         String vfsParentUrl = parentVfsUrl.toString();
+         setVfsUrl(getChildVfsUrl(entryName, vfsParentUrl.endsWith("/") == false));
+      }
+      catch (URISyntaxException e)
+      {
+         throw new RuntimeException(e);
+      }
+      this.lastModified = lastModified;
+   }
+
+   /**
+    * Add a child to an entry
+    *
+    * @param child the child file handler
+    */
+   public synchronized void addChild(VirtualFileHandler child)
+   {
+      if (entryChildren == null)
+         entryChildren = new ArrayList<VirtualFileHandler>();
+      entryChildren.add(child);
+      if (entryMap != null)
+         entryMap.put(child.getName(), child);
+   }
+
+   @Override
+   public long getLastModified()
+   {
+      return lastModified;
+   }
+
+   @Override
+   public long getSize()
+   {
+      return 0;
+   }
+
+   /**
+    * TODO: removing the entry/jar that resulted in this needs
+    * to be detected.
+    */
+   public boolean exists() throws IOException
+   {
+      return true;
+   }
+
+   public boolean isLeaf()
+   {
+      return false;
+   }
+
+   public boolean isHidden()
+   {
+      checkClosed();
+      return false;
+   }
+
+   @Override
+   public InputStream openStream() throws IOException
+   {
+      throw new IOException("Directories cannot be opened");
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      checkClosed();
+      if (entryChildren == null)
+         return Collections.emptyList();
+      return Collections.unmodifiableList(entryChildren);
+   }
+
+   /**
+    * Create a child handler for the given name. This looks to the entryMap
+    * for an existing child.
+    *
+    * @param name - the simple name of an immeadiate child.
+    * @return the VirtualFileHandler previously added via addChild.
+    * @throws IOException - thrown if there are no children or the
+    *                     name does not match a child
+    */
+   public synchronized VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      return findChildHandler(name, true);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+
+   /**
+    * Find the handler.
+    * TODO: synchronization on lazy entryMap creation
+    *
+    * @param name the path name
+    * @param allowNull do we allow nulls
+    * @return handler or <code>null</code> is it doesn't exist
+    * @throws IOException for any error
+    */
+   protected synchronized VirtualFileHandler findChildHandler(String name, boolean allowNull) throws IOException
+   {
+      if (entryChildren == null)
+      {
+         if (allowNull)
+            return null;
+         throw new FileNotFoundException(this + " has no children");
+      }
+
+      if (entryMap == null)
+      {
+         entryMap = new HashMap<String, VirtualFileHandler>();
+         for (VirtualFileHandler child : entryChildren)
+            entryMap.put(child.getName(), child);
+      }
+      VirtualFileHandler child = entryMap.get(name);
+      if (child == null && allowNull == false)
+         throw new FileNotFoundException(this + " has no child: " + name);
+      return child;
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,209 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.virtual.plugins.context.memory;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactory;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Singelton implementation of a MemoryContextFactory.
- * The roots are indexed as the 'host' part of the URLs they are stored under 
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class MemoryContextFactory implements VFSContextFactory
-{
-   private static final String[] PROTOCOLS = {"vfsmemory"};
-   
-   private static MemoryContextFactory instance = new MemoryContextFactory();
-   private Map<String, MemoryContext> registry = new ConcurrentHashMap<String, MemoryContext>();
-   
-   private MemoryContextFactory()
-   {
-   }
-   
-   /**
-    * Gets the singleton instance
-    * @return The singleton instance 
-    */
-   public static MemoryContextFactory getInstance()
-   {
-      return instance;
-   }
-   
-   public String[] getProtocols()
-   {
-      return PROTOCOLS;
-   }
-
-   public VFSContext getVFS(URL rootURL) throws IOException
-   {
-      return createRoot(rootURL);
-   }
-
-   public VFSContext getVFS(URI rootURI) throws IOException
-   {
-      return createRoot(rootURI.toURL());
-   }
-
-   /**
-    * Gets hold of a root MemoryContext
-    * @param host The name of the root
-    * @return the found root MemoryContext, or null if none exists for the name 
-    */
-   public MemoryContext find(String host)
-   {
-      return registry.get(host);
-   }
-   
-   /**
-    * Creates a new root MemoryContext, or returns an already exixting one of one already 
-    * exists for the name
-    * @param url The url of the root, we use the 'host' part of the name for indexing the context  
-    * @return The found or created context
-    * @throws IllegalArgumentException If the url parameter contains a path
-    */
-   public VFSContext createRoot(URL url)
-   {
-      try
-      {
-         if (url.getPath() != null && url.getPath().length() > 0)
-         {
-            throw new IllegalArgumentException("Root can not contain '/'");
-         }
-         
-         String rootName = url.getHost();
-         MemoryContext ctx = registry.get(rootName);
-         if (ctx == null)
-         {
-            URL ctxURL = new URL("vfsmemory://" + rootName);
-            ctx = new MemoryContext(ctxURL);
-            registry.put(rootName, ctx);
-         }
-//         ctx.createDirectory(url);
-         return ctx;
-      }
-      catch(MalformedURLException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   /**
-    * Creates a 'directory' within the context determined by the url host part
-    * @param url The url of the directory we want tot create
-    * @return The created directory
-    * @throws IllegalArgumentException if there is no root matching the host part of the url 
-    */
-   public VirtualFileHandler createDirectory(URL url)
-   {
-      String rootName = url.getHost();
-      MemoryContext ctx = registry.get(rootName);
-      if (ctx == null)
-      {
-         throw new IllegalArgumentException("No MemoryContext exists for " + rootName);
-      }
-
-      return ctx.createDirectory(url);
-   }
-   
-   /**
-    * Creates a 'file' within the context determined by the url host part
-    * @param url The url of the directory we want tot create
-    * @param contents The contents of the file
-    * @return The created file
-    * @throws IllegalArgumentException if there is no root matching the host part of the url 
-    */
-   public VirtualFileHandler putFile(URL url, byte[] contents)
-   {
-      String rootName = url.getHost();
-      MemoryContext ctx = registry.get(rootName);
-      if (ctx == null)
-      {
-         throw new RuntimeException("No MemoryContext exists for " + rootName);
-      }
-      
-      return ctx.putFile(url, contents);
-   }
-   
-   /**
-    * Deletes a root MemoryContext 
-    * @param url of the root context we want to delete
-    * @return true if we deleted a root MemoryContext, false otherwise
-    * @throws IllegalArgumentException If the url parameter contains a path
-    */
-   public boolean deleteRoot(URL url)
-   {
-      if (url.getPath() != null && url.getPath().length() > 0)
-      {
-         throw new IllegalArgumentException("Root can not contain '/'");
-      }
-
-      String rootName = url.getHost();
-      return (registry.remove(rootName) != null);
-   }
-
-   /**
-    * Deletes a 'file' or a 'directory' 
-    * @param url of the 'file' or 'directory' we want to delete 
-    * @return true if we deleted a 'file' or 'directory', false otherwise
-    */
-   public boolean delete(URL url)
-   {
-      try
-      {
-         if (url.getPath() == null || url.getPath().length() == 0)
-         {
-            return deleteRoot(url);
-         }
-
-         String rootName = url.getHost();
-         MemoryContext ctx = registry.get(rootName);
-         if (ctx != null)
-         {
-            MemoryContextHandler child = (MemoryContextHandler)ctx.findChild(ctx.getRoot(), url.getPath());
-            MemoryContextHandler parent = (MemoryContextHandler)child.getParent();
-            return parent.deleteChild(child);
-         }
-         return false;
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,209 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.virtual.plugins.context.memory;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.Map;
+
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VFSContextFactory;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Singelton implementation of a MemoryContextFactory.
+ * The roots are indexed as the 'host' part of the URLs they are stored under 
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MemoryContextFactory implements VFSContextFactory
+{
+   private static final String[] PROTOCOLS = {"vfsmemory"};
+   
+   private static MemoryContextFactory instance = new MemoryContextFactory();
+   private Map<String, MemoryContext> registry = new ConcurrentHashMap<String, MemoryContext>();
+   
+   private MemoryContextFactory()
+   {
+   }
+   
+   /**
+    * Gets the singleton instance
+    * @return The singleton instance 
+    */
+   public static MemoryContextFactory getInstance()
+   {
+      return instance;
+   }
+   
+   public String[] getProtocols()
+   {
+      return PROTOCOLS;
+   }
+
+   public VFSContext getVFS(URL rootURL) throws IOException
+   {
+      return createRoot(rootURL);
+   }
+
+   public VFSContext getVFS(URI rootURI) throws IOException
+   {
+      return createRoot(rootURI.toURL());
+   }
+
+   /**
+    * Gets hold of a root MemoryContext
+    * @param host The name of the root
+    * @return the found root MemoryContext, or null if none exists for the name 
+    */
+   public MemoryContext find(String host)
+   {
+      return registry.get(host);
+   }
+   
+   /**
+    * Creates a new root MemoryContext, or returns an already exixting one of one already 
+    * exists for the name
+    * @param url The url of the root, we use the 'host' part of the name for indexing the context  
+    * @return The found or created context
+    * @throws IllegalArgumentException If the url parameter contains a path
+    */
+   public VFSContext createRoot(URL url)
+   {
+      try
+      {
+         if (url.getPath() != null && url.getPath().length() > 0)
+         {
+            throw new IllegalArgumentException("Root can not contain '/'");
+         }
+         
+         String rootName = url.getHost();
+         MemoryContext ctx = registry.get(rootName);
+         if (ctx == null)
+         {
+            URL ctxURL = new URL("vfsmemory://" + rootName);
+            ctx = new MemoryContext(ctxURL);
+            registry.put(rootName, ctx);
+         }
+//         ctx.createDirectory(url);
+         return ctx;
+      }
+      catch(MalformedURLException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (URISyntaxException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   /**
+    * Creates a 'directory' within the context determined by the url host part
+    * @param url The url of the directory we want tot create
+    * @return The created directory
+    * @throws IllegalArgumentException if there is no root matching the host part of the url 
+    */
+   public VirtualFileHandler createDirectory(URL url)
+   {
+      String rootName = url.getHost();
+      MemoryContext ctx = registry.get(rootName);
+      if (ctx == null)
+      {
+         throw new IllegalArgumentException("No MemoryContext exists for " + rootName);
+      }
+
+      return ctx.createDirectory(url);
+   }
+   
+   /**
+    * Creates a 'file' within the context determined by the url host part
+    * @param url The url of the directory we want tot create
+    * @param contents The contents of the file
+    * @return The created file
+    * @throws IllegalArgumentException if there is no root matching the host part of the url 
+    */
+   public VirtualFileHandler putFile(URL url, byte[] contents)
+   {
+      String rootName = url.getHost();
+      MemoryContext ctx = registry.get(rootName);
+      if (ctx == null)
+      {
+         throw new RuntimeException("No MemoryContext exists for " + rootName);
+      }
+      
+      return ctx.putFile(url, contents);
+   }
+   
+   /**
+    * Deletes a root MemoryContext 
+    * @param url of the root context we want to delete
+    * @return true if we deleted a root MemoryContext, false otherwise
+    * @throws IllegalArgumentException If the url parameter contains a path
+    */
+   public boolean deleteRoot(URL url)
+   {
+      if (url.getPath() != null && url.getPath().length() > 0)
+      {
+         throw new IllegalArgumentException("Root can not contain '/'");
+      }
+
+      String rootName = url.getHost();
+      return (registry.remove(rootName) != null);
+   }
+
+   /**
+    * Deletes a 'file' or a 'directory' 
+    * @param url of the 'file' or 'directory' we want to delete 
+    * @return true if we deleted a 'file' or 'directory', false otherwise
+    */
+   public boolean delete(URL url)
+   {
+      try
+      {
+         if (url.getPath() == null || url.getPath().length() == 0)
+         {
+            return deleteRoot(url);
+         }
+
+         String rootName = url.getHost();
+         MemoryContext ctx = registry.get(rootName);
+         if (ctx != null)
+         {
+            MemoryContextHandler child = (MemoryContextHandler)ctx.getChild(ctx.getRoot(), url.getPath());
+            MemoryContextHandler parent = (MemoryContextHandler)child.getParent();
+            return parent.deleteChild(child);
+         }
+         return false;
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,183 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.virtual.plugins.context.memory;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.virtual.plugins.context.AbstractURLHandler;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-
-/**
- * Virtual memory context handler.
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class MemoryContextHandler extends AbstractURLHandler implements StructuredVirtualFileHandler
-{
-   /** serialVersionUID */
-   private static final long serialVersionUID = 1L;
-   /** The entries */
-   private Map<String, MemoryContextHandler> entryMap = Collections.emptyMap();
-   /** The content */
-   private byte[] contents;
-
-   public MemoryContextHandler(VFSContext context, VirtualFileHandler parent, URL url, String name)
-   {
-      super(context, parent, url, name);
-      if (parent != null && parent instanceof MemoryContextHandler)
-      {
-         ((MemoryContextHandler)parent).addChild(name, this);
-      }
-   }
-
-   protected synchronized void addChild(String name, MemoryContextHandler child)
-   {
-      if (entryMap == Collections.EMPTY_MAP)
-      {
-         entryMap = new LinkedHashMap<String, MemoryContextHandler>();
-      }
-      entryMap.put(name, child);
-   }
-   
-   boolean deleteChild(MemoryContextHandler child)
-   {
-      return entryMap.remove(child.getName()) != null;
-   }
-   
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   MemoryContextHandler getDirectChild(String name)
-   {
-      return entryMap.get(name);
-   }
-   
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      return new ArrayList<VirtualFileHandler>(entryMap.values());
-   }
-
-   public boolean isLeaf()
-   {
-      return contents != null;
-   }
-
-   /**
-    * Called by structuredFindChild
-    */
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      VirtualFileHandler child = entryMap.get(name);
-      if(child == null)
-         throw new FileNotFoundException(this+" has no child: "+name);
-      return child;
-   }
-
-   @Override
-   public boolean exists() throws IOException
-   {
-      return true;
-   }
-   
-   byte[] getContents()
-   {
-      return contents;
-   }
-
-   public void setContents(byte[] contents)
-   {
-      if (entryMap.size() > 0)
-      {
-         throw new RuntimeException("Cannot set contents for non-leaf node");
-      }
-      initCacheLastModified();
-      this.contents = contents;
-   }
-   
-   @Override
-   protected void initCacheLastModified()
-   {
-      this.cachedLastModified = System.currentTimeMillis();
-   }
-
-   @Override
-   public long getSize() throws IOException
-   {
-      if (contents != null)
-      {
-         return contents.length;
-      }
-      return 0;
-   }
-   
-   @Override
-   public long getLastModified() throws IOException
-   {
-      return cachedLastModified;
-   }
-
-   @Override
-   public InputStream openStream() throws IOException
-   {
-      if (contents != null)
-      {
-         return new ByteArrayInputStream(contents);
-      }
-      return new ByteArrayInputStream(new byte[0]);
-   }
-
-   @Override
-   public URL toVfsUrl() throws MalformedURLException, URISyntaxException
-   {
-      if (getVfsUrl() == null)
-      {
-         if (isLeaf())
-         {
-            setVfsUrl(getURL());
-         }
-         else
-         {
-            String vfsString = getURL().toString(); 
-            if (vfsString.endsWith("/") == false)
-               setVfsUrl(new URL(vfsString + "/"));
-         }
-      }
-      return getVfsUrl();
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,179 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.virtual.plugins.context.memory;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.virtual.plugins.context.AbstractURLHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+
+/**
+ * Virtual memory context handler.
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MemoryContextHandler extends AbstractURLHandler implements StructuredVirtualFileHandler
+{
+   /** serialVersionUID */
+   private static final long serialVersionUID = 1L;
+   /** The entries */
+   private Map<String, MemoryContextHandler> entryMap = Collections.emptyMap();
+   /** The content */
+   private byte[] contents;
+
+   public MemoryContextHandler(VFSContext context, VirtualFileHandler parent, URL url, String name)
+   {
+      super(context, parent, url, name);
+      if (parent != null && parent instanceof MemoryContextHandler)
+      {
+         ((MemoryContextHandler)parent).addChild(name, this);
+      }
+   }
+
+   protected synchronized void addChild(String name, MemoryContextHandler child)
+   {
+      if (entryMap == Collections.EMPTY_MAP)
+      {
+         entryMap = new LinkedHashMap<String, MemoryContextHandler>();
+      }
+      entryMap.put(name, child);
+   }
+   
+   boolean deleteChild(MemoryContextHandler child)
+   {
+      return entryMap.remove(child.getName()) != null;
+   }
+   
+   MemoryContextHandler getDirectChild(String name)
+   {
+      return entryMap.get(name);
+   }
+   
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      return new ArrayList<VirtualFileHandler>(entryMap.values());
+   }
+
+   public boolean isLeaf()
+   {
+      return contents != null;
+   }
+
+   /**
+    * Called by structuredFindChild
+    */
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      return entryMap.get(name);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+
+   @Override
+   public boolean exists() throws IOException
+   {
+      return true;
+   }
+   
+   byte[] getContents()
+   {
+      return contents;
+   }
+
+   public void setContents(byte[] contents)
+   {
+      if (entryMap.size() > 0)
+      {
+         throw new RuntimeException("Cannot set contents for non-leaf node");
+      }
+      initCacheLastModified();
+      this.contents = contents;
+   }
+   
+   @Override
+   protected void initCacheLastModified()
+   {
+      this.cachedLastModified = System.currentTimeMillis();
+   }
+
+   @Override
+   public long getSize() throws IOException
+   {
+      if (contents != null)
+      {
+         return contents.length;
+      }
+      return 0;
+   }
+   
+   @Override
+   public long getLastModified() throws IOException
+   {
+      return cachedLastModified;
+   }
+
+   @Override
+   public InputStream openStream() throws IOException
+   {
+      if (contents != null)
+      {
+         return new ByteArrayInputStream(contents);
+      }
+      return new ByteArrayInputStream(new byte[0]);
+   }
+
+   @Override
+   public URL toVfsUrl() throws MalformedURLException, URISyntaxException
+   {
+      if (getVfsUrl() == null)
+      {
+         if (isLeaf())
+         {
+            setVfsUrl(getURL());
+         }
+         else
+         {
+            String vfsString = getURL().toString(); 
+            if (vfsString.endsWith("/") == false)
+               setVfsUrl(new URL(vfsString + "/"));
+         }
+      }
+      return getVfsUrl();
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,519 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.vfs;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
-import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
-
-/**
- * Extension of VirtualFile that represents a virtual directory that can be composed of arbitrary files and resources
- * spread throughout the file system or embedded in jar files.
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class AssembledDirectory extends VirtualFile
-{
-   private AssembledDirectoryHandler directory;
-
-   public AssembledDirectory(AssembledDirectoryHandler handler)
-   {
-      super(handler);
-      directory = handler;
-   }
-
-   /**
-    * Find the underlying .class file representing this class and create it within this directory, along with
-    * its packages.
-    *
-    * So, if you added com.acme.Customer class, then a directory structure com/acme would be created
-    * and an entry in the acme directory would be the .class file.
-    *
-    * @param clazz the class
-    */
-   public void addClass(Class clazz)
-   {
-      if (clazz == null)
-         throw new IllegalArgumentException("Null clazz");
-      addClass(clazz.getName(), clazz.getClassLoader());
-   }
-
-   /**
-    * Find the underlying .class file representing this class and create it within this directory, along with
-    * its packages.
-    *
-    * So, if you added com.acme.Customer class, then a directory structure com/acme would be created
-    * and an entry in the acme directory would be the .class file.
-    *
-    * @param className
-    */
-   public void addClass(String className)
-   {
-      addClass(className, Thread.currentThread().getContextClassLoader());
-   }
-
-   /**
-    * Find the underlying .class file representing this class and create it within this directory, along with
-    * its packages.
-    *
-    * So, if you added com.acme.Customer class, then a directory structure com/acme would be created
-    * and an entry in the acme directory would be the .class file.
-    *
-    * @param className
-    * @param loader ClassLoader to look for class resource
-    */
-   public void addClass(String className, ClassLoader loader)
-   {
-      if (className == null)
-         throw new IllegalArgumentException("Null className");
-      if (loader == null)
-         throw new IllegalArgumentException("Null loader");
-      String resource = className.replace('.', '/') + ".class";
-      URL url = loader.getResource(resource);
-      if (url == null) throw new RuntimeException("Could not find resource: " + resource);
-      AssembledDirectory p = mkdirs(resource);
-      p.addResource(resource, loader);
-   }
-
-   /**
-    * Make any directories for the give path to a file.
-    *
-    * @param path must be a path to a file as last element in path does not have a directory created
-    * @return directory file will live in
-    */
-   public AssembledDirectory mkdirs(String path)
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-      String[] pkgs = path.split("/");
-      AssembledDirectoryHandler dir = directory;
-      for (int i = 0; i < pkgs.length - 1; i++)
-      {
-         AssembledDirectoryHandler next = (AssembledDirectoryHandler) dir.getChild(pkgs[i]);
-         if (next == null)
-         {
-            try
-            {
-               next = new AssembledDirectoryHandler((AssembledContext) dir.getVFSContext(), dir, pkgs[i]);
-            }
-            catch (IOException e)
-            {
-               throw new RuntimeException(e);
-            }
-            dir.addChild(next);
-         }
-         dir = next;
-      }
-      return (AssembledDirectory) dir.getVirtualFile();
-   }
-
-   /**
-    * Locate the .class resource of baseResource.  From this resource, determine the base of the resource
-    * i.e. what jar or classpath directory it lives in.
-    *
-    * Once the base of the resource is found, scan all files recursively within the base using the include and exclude
-    * patterns.  A mirror file structure will be created within this AssembledDirectory. Ths is very useful when you
-    * want to create a virtual jar that contains a subset of .class files in your classpath.
-    *
-    * The include/exclude patterns follow the Ant file pattern matching syntax.  See ant.apache.org for more details.
-    *
-    * @param baseResource
-    * @param includes
-    * @param excludes
-    */
-   public void addResources(Class baseResource, String[] includes, String[] excludes)
-   {
-      if (baseResource == null)
-         throw new IllegalArgumentException("Null base resource");
-      String resource = baseResource.getName().replace('.', '/') + ".class";
-      addResources(resource, includes, excludes, baseResource.getClassLoader());
-   }
-
-   /**
-    * From the baseResource, determine the base of that resource
-    * i.e. what jar or classpath directory it lives in.  The Thread.currentThread().getContextClassloader() will be used
-    *
-    * Once the base of the resource is found, scan all files recursively within the base using the include and exclude
-    * patterns.  A mirror file structure will be created within this AssembledDirectory. Ths is very useful when you
-    * want to create a virtual jar that contains a subset of .class files in your classpath.
-    *
-    * The include/exclude patterns follow the Ant file pattern matching syntax.  See ant.apache.org for more details.
-    *
-    * @param baseResource
-    * @param includes
-    * @param excludes
-    */
-   public void addResources(String baseResource, final String[] includes, final String[] excludes)
-   {
-      if (baseResource == null)
-         throw new IllegalArgumentException("Null base resource");
-      addResources(baseResource, includes, excludes, Thread.currentThread().getContextClassLoader());   
-   }
-
-   /**
-    * From the baseResource, determine the base of that resource
-    * i.e. what jar or classpath directory it lives in.  The loader parameter will be used to find the resource.
-    *
-    * Once the base of the resource is found, scan all files recursively within the base using the include and exclude
-    * patterns.  A mirror file structure will be created within this AssembledDirectory. Ths is very useful when you
-    * want to create a virtual jar that contains a subset of .class files in your classpath.
-    *
-    * The include/exclude patterns follow the Ant file pattern matching syntax.  See ant.apache.org for more details.
-    *
-    * @param baseResource
-    * @param includes
-    * @param excludes
-    * @param loader
-    */
-   public void addResources(String baseResource, final String[] includes, final String[] excludes, ClassLoader loader)
-   {
-      if (baseResource == null)
-         throw new IllegalArgumentException("Null baseResource");
-      if (loader == null)
-         throw new IllegalArgumentException("Null loader");
-      URL url = loader.getResource(baseResource);
-      if (url == null) throw new RuntimeException("Could not find baseResource: " + baseResource);
-      String urlString = url.toString();
-      int idx = urlString.lastIndexOf(baseResource);
-      urlString = urlString.substring(0, idx);
-      try
-      {
-         url = new URL(urlString);
-         VirtualFile parent = VFS.getRoot(url);
-
-         VisitorAttributes va = new VisitorAttributes();
-         va.setLeavesOnly(true);
-         SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
-         va.setRecurseFilter(noJars);
-
-         VirtualFileFilter filter = new VirtualFileFilter()
-         {
-
-            public boolean accepts(VirtualFile file)
-            {
-               boolean matched = false;
-               String path = file.getPathName();
-               for (String include : includes)
-               {
-                  if (antMatch(path, include))
-                  {
-                     matched = true;
-                     break;
-                  }
-               }
-               if (matched == false)
-                  return false;
-               if (excludes != null)
-               {
-                  for (String exclude : excludes)
-                  {
-                     if (antMatch(path, exclude))
-                        return false;
-                  }
-               }
-               return true;
-            }
-
-         };
-
-         FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
-         parent.visit(visitor);
-         List<VirtualFile> files = visitor.getMatched();
-         for (VirtualFile vf : files)
-         {
-            mkdirs(vf.getPathName()).addChild(vf);
-         }
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   /**
-    * Create a regular expression pattern from an Ant file matching pattern
-    *
-    * @param matcher
-    * @return
-    */
-   public static Pattern getPattern(String matcher)
-   {
-      if (matcher == null)
-         throw new IllegalArgumentException("Null matcher");
-      matcher = matcher.replace(".", "\\.");
-      matcher = matcher.replace("*", ".*");
-      matcher = matcher.replace("?", ".{1}");
-      return Pattern.compile(matcher);
-
-   }
-
-   /**
-    * Determine whether a given file path matches an Ant pattern.
-    *
-    * @param path
-    * @param expression
-    * @return
-    */
-   public static boolean antMatch(String path, String expression)
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-      if (expression == null)
-         throw new IllegalArgumentException("Null expression");
-      if (path.startsWith("/")) path = path.substring(1);
-      if (expression.endsWith("/")) expression += "**";
-      String[] paths = path.split("/");
-      String[] expressions = expression.split("/");
-
-      int x = 0, p = 0;
-      Pattern pattern = getPattern(expressions[0]);
-
-      for (p = 0; p < paths.length && x < expressions.length; p++)
-      {
-         if (expressions[x].equals("**"))
-         {
-            do
-            {
-               x++;
-            } while (x < expressions.length && expressions[x].equals("**"));
-            if (x == expressions.length)
-               return true; // "**" with nothing after it
-            pattern = getPattern(expressions[x]);
-         }
-         String element = paths[p];
-         if (pattern.matcher(element).matches())
-         {
-            x++;
-            if (x < expressions.length)
-            {
-               pattern = getPattern(expressions[x]);
-            }
-         }
-         else if (!(x > 0 && expressions[x - 1].equals("**"))) // our previous isn't "**"
-         {
-            return false;
-         }
-      }
-      if (p < paths.length)
-         return false;
-      if (x < expressions.length)
-         return false;
-      return true;
-   }
-
-   /**
-    * Add a VirtualFile as a child to this AssembledDirectory.
-    *
-    * @param vf
-    */
-   public VirtualFile addChild(VirtualFile vf)
-   {
-      if (vf == null)
-         throw new IllegalArgumentException("Null virtual file");
-      return directory.addChild(vf.getHandler()).getVirtualFile();
-   }
-
-   /**
-    * Add a VirtualFile as a child to this AssembledDirectory.  This file will be added
-    * under a new aliased name.
-    *
-    * @param vf
-    * @param newName
-    */
-   public VirtualFile addChild(VirtualFile vf, String newName)
-   {
-      try
-      {
-         AssembledFileHandler handler = new AssembledFileHandler((AssembledContext) directory.getVFSContext(), directory, newName, vf.getHandler());
-         directory.addChild(handler);
-         return handler.getVirtualFile();
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   /**
-    * Add a classloader found resource to as a child to this AssembledDirectory.  The base file name of the
-    * resource will be used as the child's name.
-    *
-    * Thread.currentThread.getCOntextClassLoader() will be used to load the resource.
-    *
-    * @param resource
-    */
-   public VirtualFile addResource(String resource)
-   {
-      return addResource(resource, Thread.currentThread().getContextClassLoader());
-   }
-
-   /**
-    * Add a classloader found resource to as a child to this AssembledDirectory.  The newName parameter will be used
-    * as the name of the child.
-    *
-    * Thread.currentThread.getCOntextClassLoader() will be used to load the resource.
-    *
-    * @param resource
-    * @param newName
-    */
-   public VirtualFile addResource(String resource, String newName)
-   {
-      return addResource(resource, Thread.currentThread().getContextClassLoader(), newName);
-   }
-
-   /**
-    * Add a classloader found resource to as a child to this AssembledDirectory.  The base file name of the
-    * resource will be used as the child's name.
-    *
-    * The loader parameter will be used to load the resource.
-    *
-    * @param resource
-    * @param loader
-    */
-   public VirtualFile addResource(String resource, ClassLoader loader)
-   {
-      if (resource == null)
-         throw new IllegalArgumentException("Null resource");
-      if (loader == null)
-         throw new IllegalArgumentException("Null loader");
-      URL url = loader.getResource(resource);
-      if (url == null)
-         throw new RuntimeException("Could not find resource: " + resource);
-
-      return addResource(url);
-   }
-
-   /**
-    * Add a resource identified by the URL as a child to this AssembledDirectory.
-    *
-    * @param url
-    */
-   public VirtualFile addResource(URL url)
-   {
-      if (url == null)
-         throw new IllegalArgumentException("Null url");
-   
-      try
-      {
-         VirtualFile vf = VFS.getRoot(url);
-         return addChild(vf);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   /**
-    * Add a classloader found resource to as a child to this AssembledDirectory.  The newName parameter will be used
-    * as the name of the child.
-    *
-    * The loader parameter will be used to load the resource.
-    *
-    * @param resource
-    * @param loader
-    * @param newName
-    */
-   public VirtualFile addResource(String resource, ClassLoader loader, String newName)
-   {
-      if (resource == null)
-         throw new IllegalArgumentException("Null resource");
-      if (loader == null)
-         throw new IllegalArgumentException("Null loader");
-      if (newName == null)
-         throw new IllegalArgumentException("Null newName");
-
-      URL url = loader.getResource(resource);
-      if (url == null)
-         throw new RuntimeException("Could not find resource: " + resource);
-      try
-      {
-         VirtualFile vf = VFS.getRoot(url);
-         return addChild(vf, newName);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   /**
-    * Add raw bytes as a file to this assembled directory
-    *
-    *
-    * @param bytes
-    * @param name
-    * @return
-    */
-   public VirtualFile addBytes(byte[] bytes, String name)
-   {
-      if (bytes == null)
-         throw new IllegalArgumentException("Null bytes");
-      if (name == null)
-         throw new IllegalArgumentException("Null name");
-      ByteArrayHandler handler = null;
-      try
-      {
-         handler = new ByteArrayHandler((AssembledContext) directory.getVFSContext(), directory, name, bytes);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-      directory.addChild(handler);
-      return handler.getVirtualFile();
-   }
-
-   /**
-    * Create a directory within this directory.
-    *
-    * @param name
-    * @return
-    */
-   public AssembledDirectory mkdir(String name)
-   {
-      if (name == null)
-         throw new IllegalArgumentException("Null name");
-      AssembledDirectoryHandler handler = null;
-      try
-      {
-         handler = new AssembledDirectoryHandler((AssembledContext) directory.getVFSContext(), directory, name);
-         directory.addChild(handler);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-      return new AssembledDirectory(handler);
-   }
-
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,519 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.vfs;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
+
+/**
+ * Extension of VirtualFile that represents a virtual directory that can be composed of arbitrary files and resources
+ * spread throughout the file system or embedded in jar files.
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class AssembledDirectory extends VirtualFile
+{
+   private AssembledDirectoryHandler directory;
+
+   public AssembledDirectory(AssembledDirectoryHandler handler)
+   {
+      super(handler);
+      directory = handler;
+   }
+
+   /**
+    * Find the underlying .class file representing this class and create it within this directory, along with
+    * its packages.
+    *
+    * So, if you added com.acme.Customer class, then a directory structure com/acme would be created
+    * and an entry in the acme directory would be the .class file.
+    *
+    * @param clazz the class
+    */
+   public void addClass(Class clazz)
+   {
+      if (clazz == null)
+         throw new IllegalArgumentException("Null clazz");
+      addClass(clazz.getName(), clazz.getClassLoader());
+   }
+
+   /**
+    * Find the underlying .class file representing this class and create it within this directory, along with
+    * its packages.
+    *
+    * So, if you added com.acme.Customer class, then a directory structure com/acme would be created
+    * and an entry in the acme directory would be the .class file.
+    *
+    * @param className
+    */
+   public void addClass(String className)
+   {
+      addClass(className, Thread.currentThread().getContextClassLoader());
+   }
+
+   /**
+    * Find the underlying .class file representing this class and create it within this directory, along with
+    * its packages.
+    *
+    * So, if you added com.acme.Customer class, then a directory structure com/acme would be created
+    * and an entry in the acme directory would be the .class file.
+    *
+    * @param className
+    * @param loader ClassLoader to look for class resource
+    */
+   public void addClass(String className, ClassLoader loader)
+   {
+      if (className == null)
+         throw new IllegalArgumentException("Null className");
+      if (loader == null)
+         throw new IllegalArgumentException("Null loader");
+      String resource = className.replace('.', '/') + ".class";
+      URL url = loader.getResource(resource);
+      if (url == null) throw new RuntimeException("Could not find resource: " + resource);
+      AssembledDirectory p = mkdirs(resource);
+      p.addResource(resource, loader);
+   }
+
+   /**
+    * Make any directories for the give path to a file.
+    *
+    * @param path must be a path to a file as last element in path does not have a directory created
+    * @return directory file will live in
+    */
+   public AssembledDirectory mkdirs(String path)
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+      String[] pkgs = path.split("/");
+      AssembledDirectoryHandler dir = directory;
+      for (int i = 0; i < pkgs.length - 1; i++)
+      {
+         AssembledDirectoryHandler next = (AssembledDirectoryHandler) dir.findChild(pkgs[i]);
+         if (next == null)
+         {
+            try
+            {
+               next = new AssembledDirectoryHandler((AssembledContext) dir.getVFSContext(), dir, pkgs[i]);
+            }
+            catch (IOException e)
+            {
+               throw new RuntimeException(e);
+            }
+            dir.addChild(next);
+         }
+         dir = next;
+      }
+      return (AssembledDirectory) dir.getVirtualFile();
+   }
+
+   /**
+    * Locate the .class resource of baseResource.  From this resource, determine the base of the resource
+    * i.e. what jar or classpath directory it lives in.
+    *
+    * Once the base of the resource is found, scan all files recursively within the base using the include and exclude
+    * patterns.  A mirror file structure will be created within this AssembledDirectory. Ths is very useful when you
+    * want to create a virtual jar that contains a subset of .class files in your classpath.
+    *
+    * The include/exclude patterns follow the Ant file pattern matching syntax.  See ant.apache.org for more details.
+    *
+    * @param baseResource
+    * @param includes
+    * @param excludes
+    */
+   public void addResources(Class baseResource, String[] includes, String[] excludes)
+   {
+      if (baseResource == null)
+         throw new IllegalArgumentException("Null base resource");
+      String resource = baseResource.getName().replace('.', '/') + ".class";
+      addResources(resource, includes, excludes, baseResource.getClassLoader());
+   }
+
+   /**
+    * From the baseResource, determine the base of that resource
+    * i.e. what jar or classpath directory it lives in.  The Thread.currentThread().getContextClassloader() will be used
+    *
+    * Once the base of the resource is found, scan all files recursively within the base using the include and exclude
+    * patterns.  A mirror file structure will be created within this AssembledDirectory. Ths is very useful when you
+    * want to create a virtual jar that contains a subset of .class files in your classpath.
+    *
+    * The include/exclude patterns follow the Ant file pattern matching syntax.  See ant.apache.org for more details.
+    *
+    * @param baseResource
+    * @param includes
+    * @param excludes
+    */
+   public void addResources(String baseResource, final String[] includes, final String[] excludes)
+   {
+      if (baseResource == null)
+         throw new IllegalArgumentException("Null base resource");
+      addResources(baseResource, includes, excludes, Thread.currentThread().getContextClassLoader());   
+   }
+
+   /**
+    * From the baseResource, determine the base of that resource
+    * i.e. what jar or classpath directory it lives in.  The loader parameter will be used to find the resource.
+    *
+    * Once the base of the resource is found, scan all files recursively within the base using the include and exclude
+    * patterns.  A mirror file structure will be created within this AssembledDirectory. Ths is very useful when you
+    * want to create a virtual jar that contains a subset of .class files in your classpath.
+    *
+    * The include/exclude patterns follow the Ant file pattern matching syntax.  See ant.apache.org for more details.
+    *
+    * @param baseResource
+    * @param includes
+    * @param excludes
+    * @param loader
+    */
+   public void addResources(String baseResource, final String[] includes, final String[] excludes, ClassLoader loader)
+   {
+      if (baseResource == null)
+         throw new IllegalArgumentException("Null baseResource");
+      if (loader == null)
+         throw new IllegalArgumentException("Null loader");
+      URL url = loader.getResource(baseResource);
+      if (url == null) throw new RuntimeException("Could not find baseResource: " + baseResource);
+      String urlString = url.toString();
+      int idx = urlString.lastIndexOf(baseResource);
+      urlString = urlString.substring(0, idx);
+      try
+      {
+         url = new URL(urlString);
+         VirtualFile parent = VFS.getRoot(url);
+
+         VisitorAttributes va = new VisitorAttributes();
+         va.setLeavesOnly(true);
+         SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
+         va.setRecurseFilter(noJars);
+
+         VirtualFileFilter filter = new VirtualFileFilter()
+         {
+
+            public boolean accepts(VirtualFile file)
+            {
+               boolean matched = false;
+               String path = file.getPathName();
+               for (String include : includes)
+               {
+                  if (antMatch(path, include))
+                  {
+                     matched = true;
+                     break;
+                  }
+               }
+               if (matched == false)
+                  return false;
+               if (excludes != null)
+               {
+                  for (String exclude : excludes)
+                  {
+                     if (antMatch(path, exclude))
+                        return false;
+                  }
+               }
+               return true;
+            }
+
+         };
+
+         FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
+         parent.visit(visitor);
+         List<VirtualFile> files = visitor.getMatched();
+         for (VirtualFile vf : files)
+         {
+            mkdirs(vf.getPathName()).addChild(vf);
+         }
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   /**
+    * Create a regular expression pattern from an Ant file matching pattern
+    *
+    * @param matcher
+    * @return
+    */
+   public static Pattern getPattern(String matcher)
+   {
+      if (matcher == null)
+         throw new IllegalArgumentException("Null matcher");
+      matcher = matcher.replace(".", "\\.");
+      matcher = matcher.replace("*", ".*");
+      matcher = matcher.replace("?", ".{1}");
+      return Pattern.compile(matcher);
+
+   }
+
+   /**
+    * Determine whether a given file path matches an Ant pattern.
+    *
+    * @param path
+    * @param expression
+    * @return
+    */
+   public static boolean antMatch(String path, String expression)
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+      if (expression == null)
+         throw new IllegalArgumentException("Null expression");
+      if (path.startsWith("/")) path = path.substring(1);
+      if (expression.endsWith("/")) expression += "**";
+      String[] paths = path.split("/");
+      String[] expressions = expression.split("/");
+
+      int x = 0, p = 0;
+      Pattern pattern = getPattern(expressions[0]);
+
+      for (p = 0; p < paths.length && x < expressions.length; p++)
+      {
+         if (expressions[x].equals("**"))
+         {
+            do
+            {
+               x++;
+            } while (x < expressions.length && expressions[x].equals("**"));
+            if (x == expressions.length)
+               return true; // "**" with nothing after it
+            pattern = getPattern(expressions[x]);
+         }
+         String element = paths[p];
+         if (pattern.matcher(element).matches())
+         {
+            x++;
+            if (x < expressions.length)
+            {
+               pattern = getPattern(expressions[x]);
+            }
+         }
+         else if (!(x > 0 && expressions[x - 1].equals("**"))) // our previous isn't "**"
+         {
+            return false;
+         }
+      }
+      if (p < paths.length)
+         return false;
+      if (x < expressions.length)
+         return false;
+      return true;
+   }
+
+   /**
+    * Add a VirtualFile as a child to this AssembledDirectory.
+    *
+    * @param vf
+    */
+   public VirtualFile addChild(VirtualFile vf)
+   {
+      if (vf == null)
+         throw new IllegalArgumentException("Null virtual file");
+      return directory.addChild(vf.getHandler()).getVirtualFile();
+   }
+
+   /**
+    * Add a VirtualFile as a child to this AssembledDirectory.  This file will be added
+    * under a new aliased name.
+    *
+    * @param vf
+    * @param newName
+    */
+   public VirtualFile addChild(VirtualFile vf, String newName)
+   {
+      try
+      {
+         AssembledFileHandler handler = new AssembledFileHandler((AssembledContext) directory.getVFSContext(), directory, newName, vf.getHandler());
+         directory.addChild(handler);
+         return handler.getVirtualFile();
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   /**
+    * Add a classloader found resource to as a child to this AssembledDirectory.  The base file name of the
+    * resource will be used as the child's name.
+    *
+    * Thread.currentThread.getCOntextClassLoader() will be used to load the resource.
+    *
+    * @param resource
+    */
+   public VirtualFile addResource(String resource)
+   {
+      return addResource(resource, Thread.currentThread().getContextClassLoader());
+   }
+
+   /**
+    * Add a classloader found resource to as a child to this AssembledDirectory.  The newName parameter will be used
+    * as the name of the child.
+    *
+    * Thread.currentThread.getCOntextClassLoader() will be used to load the resource.
+    *
+    * @param resource
+    * @param newName
+    */
+   public VirtualFile addResource(String resource, String newName)
+   {
+      return addResource(resource, Thread.currentThread().getContextClassLoader(), newName);
+   }
+
+   /**
+    * Add a classloader found resource to as a child to this AssembledDirectory.  The base file name of the
+    * resource will be used as the child's name.
+    *
+    * The loader parameter will be used to load the resource.
+    *
+    * @param resource
+    * @param loader
+    */
+   public VirtualFile addResource(String resource, ClassLoader loader)
+   {
+      if (resource == null)
+         throw new IllegalArgumentException("Null resource");
+      if (loader == null)
+         throw new IllegalArgumentException("Null loader");
+      URL url = loader.getResource(resource);
+      if (url == null)
+         throw new RuntimeException("Could not find resource: " + resource);
+
+      return addResource(url);
+   }
+
+   /**
+    * Add a resource identified by the URL as a child to this AssembledDirectory.
+    *
+    * @param url
+    */
+   public VirtualFile addResource(URL url)
+   {
+      if (url == null)
+         throw new IllegalArgumentException("Null url");
+   
+      try
+      {
+         VirtualFile vf = VFS.getRoot(url);
+         return addChild(vf);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   /**
+    * Add a classloader found resource to as a child to this AssembledDirectory.  The newName parameter will be used
+    * as the name of the child.
+    *
+    * The loader parameter will be used to load the resource.
+    *
+    * @param resource
+    * @param loader
+    * @param newName
+    */
+   public VirtualFile addResource(String resource, ClassLoader loader, String newName)
+   {
+      if (resource == null)
+         throw new IllegalArgumentException("Null resource");
+      if (loader == null)
+         throw new IllegalArgumentException("Null loader");
+      if (newName == null)
+         throw new IllegalArgumentException("Null newName");
+
+      URL url = loader.getResource(resource);
+      if (url == null)
+         throw new RuntimeException("Could not find resource: " + resource);
+      try
+      {
+         VirtualFile vf = VFS.getRoot(url);
+         return addChild(vf, newName);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   /**
+    * Add raw bytes as a file to this assembled directory
+    *
+    *
+    * @param bytes
+    * @param name
+    * @return
+    */
+   public VirtualFile addBytes(byte[] bytes, String name)
+   {
+      if (bytes == null)
+         throw new IllegalArgumentException("Null bytes");
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      ByteArrayHandler handler = null;
+      try
+      {
+         handler = new ByteArrayHandler((AssembledContext) directory.getVFSContext(), directory, name, bytes);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+      directory.addChild(handler);
+      return handler.getVirtualFile();
+   }
+
+   /**
+    * Create a directory within this directory.
+    *
+    * @param name
+    * @return
+    */
+   public AssembledDirectory mkdir(String name)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      AssembledDirectoryHandler handler = null;
+      try
+      {
+         handler = new AssembledDirectoryHandler((AssembledContext) directory.getVFSContext(), directory, name);
+         directory.addChild(handler);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+      return new AssembledDirectory(handler);
+   }
+
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,152 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.vfs;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * The assembled directory handler.
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
- at Assembled
-public class AssembledDirectoryHandler extends AbstractVirtualFileHandler implements StructuredVirtualFileHandler
-{
-   private long lastModified = System.currentTimeMillis();
-   private List<VirtualFileHandler> children = new ArrayList<VirtualFileHandler>();
-   private Map<String, VirtualFileHandler> childrenMap = new HashMap<String, VirtualFileHandler>();
-
-   public AssembledDirectoryHandler(AssembledContext context, AssembledDirectoryHandler parent, String name) throws IOException
-   {
-      super(context, parent, name);
-      String path = getPathName();
-      if (path.endsWith("/") == false)
-         path += "/";
-      setVfsUrl(new URL("vfs", context.getName(), -1, path, new AssembledUrlStreamHandler(context)));
-   }
-
-   public VirtualFileHandler addChild(VirtualFileHandler handler)
-   {
-      if (handler.getClass().isAnnotationPresent(Assembled.class) == false)
-      {
-         try
-         {
-            handler = new AssembledFileHandler((AssembledContext)getVFSContext(), this, handler.getName(), handler);
-         }
-         catch (IOException e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-      children.add(handler);
-      childrenMap.put(handler.getName(), handler);
-      lastModified = System.currentTimeMillis();
-      return handler;
-   }
-
-   public VirtualFileHandler getChild(String name)
-   {
-      return childrenMap.get(name);
-   }
-
-   public URI toURI() throws URISyntaxException
-   {
-      return getVfsUrl().toURI();
-   }
-
-   public long getLastModified() throws IOException
-   {
-      return lastModified;
-   }
-
-   public long getSize() throws IOException
-   {
-      return 0;
-   }
-
-   public boolean exists() throws IOException
-   {
-      return true;
-   }
-
-   public boolean isLeaf() throws IOException
-   {
-      return false;
-   }
-
-   public boolean isHidden() throws IOException
-   {
-      return false;
-   }
-
-   public InputStream openStream() throws IOException
-   {
-      throw new RuntimeException("Cannot open stream");
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      return children;
-   }
-
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      VirtualFileHandler handler = childrenMap.get(name);
-      if (handler == null)
-         throw new IOException("Could not locate child: " + name);
-      return handler;
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   @Override
-   public VirtualFile getVirtualFile()
-   {
-      checkClosed();
-      increment();
-      return new AssembledDirectory(this);
-   }
-
-   @Override
-   public URL toURL() throws MalformedURLException, URISyntaxException
-   {
-      return getVfsUrl();
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,149 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.vfs;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * The assembled directory handler.
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Assembled
+public class AssembledDirectoryHandler extends AbstractVirtualFileHandler implements StructuredVirtualFileHandler
+{
+   private long lastModified = System.currentTimeMillis();
+   private List<VirtualFileHandler> children = new ArrayList<VirtualFileHandler>();
+   private Map<String, VirtualFileHandler> childrenMap = new HashMap<String, VirtualFileHandler>();
+
+   public AssembledDirectoryHandler(AssembledContext context, AssembledDirectoryHandler parent, String name) throws IOException
+   {
+      super(context, parent, name);
+      String path = getPathName();
+      if (path.endsWith("/") == false)
+         path += "/";
+      setVfsUrl(new URL("vfs", context.getName(), -1, path, new AssembledUrlStreamHandler(context)));
+   }
+
+   public VirtualFileHandler addChild(VirtualFileHandler handler)
+   {
+      if (handler.getClass().isAnnotationPresent(Assembled.class) == false)
+      {
+         try
+         {
+            handler = new AssembledFileHandler((AssembledContext)getVFSContext(), this, handler.getName(), handler);
+         }
+         catch (IOException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+      children.add(handler);
+      childrenMap.put(handler.getName(), handler);
+      lastModified = System.currentTimeMillis();
+      return handler;
+   }
+
+   public VirtualFileHandler findChild(String name)
+   {
+      return childrenMap.get(name);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+
+   public URI toURI() throws URISyntaxException
+   {
+      return getVfsUrl().toURI();
+   }
+
+   public long getLastModified() throws IOException
+   {
+      return lastModified;
+   }
+
+   public long getSize() throws IOException
+   {
+      return 0;
+   }
+
+   public boolean exists() throws IOException
+   {
+      return true;
+   }
+
+   public boolean isLeaf() throws IOException
+   {
+      return false;
+   }
+
+   public boolean isHidden() throws IOException
+   {
+      return false;
+   }
+
+   public InputStream openStream() throws IOException
+   {
+      throw new RuntimeException("Cannot open stream");
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      return children;
+   }
+
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      return childrenMap.get(name);
+   }
+
+   @Override
+   public VirtualFile getVirtualFile()
+   {
+      checkClosed();
+      increment();
+      return new AssembledDirectory(this);
+   }
+
+   @Override
+   public URL toURL() throws MalformedURLException, URISyntaxException
+   {
+      return getVfsUrl();
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,56 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.vfs;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.virtual.plugins.context.DelegatingHandler;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * The assembled file handler.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
- at Assembled
-public class AssembledFileHandler extends DelegatingHandler
-{
-   public AssembledFileHandler(AssembledContext context, AssembledDirectoryHandler parent, String name, VirtualFileHandler delegate) throws IOException
-   {
-      super(context, parent, name, delegate);
-      setVfsUrl(new URL("vfs", context.getName(), -1, getPathName(), new AssembledUrlStreamHandler(context)));
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      throw new IOException("File cannot have children: " + this);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      throw new IOException("File cannot have children: " + this);
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.vfs;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.virtual.plugins.context.DelegatingHandler;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * The assembled file handler.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Assembled
+public class AssembledFileHandler extends DelegatingHandler
+{
+   public AssembledFileHandler(AssembledContext context, AssembledDirectoryHandler parent, String name, VirtualFileHandler delegate) throws IOException
+   {
+      super(context, parent, name, delegate);
+      setVfsUrl(new URL("vfs", context.getName(), -1, getPathName(), new AssembledUrlStreamHandler(context)));
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      throw new IOException("File cannot have children: " + this);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      throw new IOException("File cannot have children: " + this);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,56 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.vfs;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Used when creating VFS urls so we don't have to go through the handlers all the time
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class AssembledUrlStreamHandler extends URLStreamHandler
-{
-   private final AssembledContext context;
-
-   public AssembledUrlStreamHandler(AssembledContext context)
-   {
-      this.context = context;
-   }
-
-   protected URLConnection openConnection(URL url) throws IOException
-   {
-      String path = url.getPath();
-      VirtualFileHandler vf = context.getRoot().findChild(path);
-      if (vf == null)
-         throw new IOException(path + " was not found in Assembled VFS context " + context.getName());
-
-      return new VirtualFileURLConnection(url, vf.getVirtualFile());
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.vfs;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Used when creating VFS urls so we don't have to go through the handlers all the time
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class AssembledUrlStreamHandler extends URLStreamHandler
+{
+   private final AssembledContext context;
+
+   public AssembledUrlStreamHandler(AssembledContext context)
+   {
+      this.context = context;
+   }
+
+   protected URLConnection openConnection(URL url) throws IOException
+   {
+      String path = url.getPath();
+      VirtualFileHandler vf = context.getRoot().getChild(path);
+      if (vf == null)
+         throw new IOException(path + " was not found in Assembled VFS context " + context.getName());
+
+      return new VirtualFileURLConnection(url, vf.getVirtualFile());
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,106 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.context.vfs;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
- at Assembled
-public class ByteArrayHandler extends AbstractVirtualFileHandler
-{
-   private byte[] bytes;
-   private final long lastModified;
-
-   public ByteArrayHandler(AssembledContext context, VirtualFileHandler parent, String name, byte[] bytes) throws IOException
-   {
-      super(context, parent, name);
-      this.bytes = bytes;
-      lastModified = System.currentTimeMillis();
-      setVfsUrl(new URL("vfs", context.getName(), -1, getPathName(), new AssembledUrlStreamHandler(context)));
-   }
-
-   @Override
-   public URL toURL() throws MalformedURLException, URISyntaxException
-   {
-      return getVfsUrl();
-   }
-
-   public URI toURI() throws URISyntaxException
-   {
-      return getVfsUrl().toURI();
-   }
-
-   public long getLastModified() throws IOException
-   {
-      return lastModified;
-   }
-
-   public long getSize() throws IOException
-   {
-      return bytes.length;
-   }
-
-   public boolean exists() throws IOException
-   {
-      return true;
-   }
-
-   public boolean isLeaf() throws IOException
-   {
-      return true;
-   }
-
-   public boolean isHidden() throws IOException
-   {
-      return false;
-   }
-
-   public InputStream openStream() throws IOException
-   {
-      return new ByteArrayInputStream(bytes);
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      throw new IOException("File cannot have children");
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      throw new IOException("File cannot have children");
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,106 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.vfs;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Assembled
+public class ByteArrayHandler extends AbstractVirtualFileHandler
+{
+   private byte[] bytes;
+   private final long lastModified;
+
+   public ByteArrayHandler(AssembledContext context, VirtualFileHandler parent, String name, byte[] bytes) throws IOException
+   {
+      super(context, parent, name);
+      this.bytes = bytes;
+      lastModified = System.currentTimeMillis();
+      setVfsUrl(new URL("vfs", context.getName(), -1, getPathName(), new AssembledUrlStreamHandler(context)));
+   }
+
+   @Override
+   public URL toURL() throws MalformedURLException, URISyntaxException
+   {
+      return getVfsUrl();
+   }
+
+   public URI toURI() throws URISyntaxException
+   {
+      return getVfsUrl().toURI();
+   }
+
+   public long getLastModified() throws IOException
+   {
+      return lastModified;
+   }
+
+   public long getSize() throws IOException
+   {
+      return bytes.length;
+   }
+
+   public boolean exists() throws IOException
+   {
+      return true;
+   }
+
+   public boolean isLeaf() throws IOException
+   {
+      return true;
+   }
+
+   public boolean isHidden() throws IOException
+   {
+      return false;
+   }
+
+   public InputStream openStream() throws IOException
+   {
+      return new ByteArrayInputStream(bytes);
+   }
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      throw new IOException("File cannot have children");
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      throw new IOException("File cannot have children");
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,71 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.plugins.vfs;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Used when creating VFS urls so we don't have to go through the handlers all the time
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class VirtualFileUrlStreamHandler extends URLStreamHandler
-{
-   private final VFSContext context;
-
-   public VirtualFileUrlStreamHandler(VirtualFileHandler handler)
-   {
-      this.context = handler.getVFSContext();
-   }
-
-   protected URLConnection openConnection(URL u) throws IOException
-   {
-      String baseRootUrl;
-      try
-      {
-         baseRootUrl = context.getRoot().toVfsUrl().toString();
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException(e);
-      }
-      String urlString = u.toString();
-      int idx = urlString.indexOf(baseRootUrl);
-      if (idx == -1)
-         throw new IOException(u.toString() + " does not belong to the same VFS context as " + baseRootUrl);
-
-      String path = urlString.substring(baseRootUrl.length());
-      VirtualFileHandler vf = context.getRoot().findChild(path);
-      if (vf == null)
-         throw new IOException(path + " was not found in VFS context " + baseRootUrl);
-
-      return new VirtualFileURLConnection(u, vf.getVirtualFile());
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,71 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.vfs;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Used when creating VFS urls so we don't have to go through the handlers all the time
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class VirtualFileUrlStreamHandler extends URLStreamHandler
+{
+   private final VFSContext context;
+
+   public VirtualFileUrlStreamHandler(VirtualFileHandler handler)
+   {
+      this.context = handler.getVFSContext();
+   }
+
+   protected URLConnection openConnection(URL u) throws IOException
+   {
+      String baseRootUrl;
+      try
+      {
+         baseRootUrl = context.getRoot().toVfsUrl().toString();
+      }
+      catch (URISyntaxException e)
+      {
+         throw new RuntimeException(e);
+      }
+      String urlString = u.toString();
+      int idx = urlString.indexOf(baseRootUrl);
+      if (idx == -1)
+         throw new IOException(u.toString() + " does not belong to the same VFS context as " + baseRootUrl);
+
+      String path = urlString.substring(baseRootUrl.length());
+      VirtualFileHandler vf = context.getRoot().getChild(path);
+      if (vf == null)
+         throw new IOException(path + " was not found in VFS context " + baseRootUrl);
+
+      return new VirtualFileURLConnection(u, vf.getVirtualFile());
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,89 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.virtual.protocol.vfsmemory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.memory.MemoryContext;
-import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
-import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
-
-/**
- * URLStreamHandler for VFS
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class Handler extends URLStreamHandler
-{
-   protected URLConnection openConnection(URL u) throws IOException
-   {
-      String host = u.getHost();
-      MemoryContext ctx = MemoryContextFactory.getInstance().find(host);
-      if (ctx == null)
-         throw new IOException("vfs does not exist: " + u.toString());
-
-      VirtualFile vf = ctx.findChild(ctx.getRoot(), u.getPath()).getVirtualFile();
-      if (vf == null)
-         throw new IOException("vfs does not exist: " + u.toString());
-
-      return new VirtualFileURLConnection(u, vf);
-   }
-
-   public static void main(String[] args) throws Exception
-   {
-      System.setProperty("java.protocol.handler.pkgs", "org.jboss.virtual.protocol");
-      //URL url = new URL("vfsfile:/c:/tmp/urlstream.java");
-      //URL url = new URL("vfsfile:/C:\\jboss\\jboss-head\\build\\output\\jboss-5.0.0.Beta\\server\\default\\lib\\jboss.jar\\schema\\xml.xsd");
-//      URL url = new URL("vfsjar:file:/c:/tmp/parent.jar!/foo.jar/urlstream.java");
-      
-      URL rootURL = new URL("vfsmemory://aopdomain2");
-      MemoryContextFactory.getInstance().createRoot(rootURL);
-
-      URL url = new URL("vfsmemory://aopdomain2/org/foo/Test.class");
-      MemoryContextFactory.getInstance().putFile(url, new byte[] {'a', 'b', 'c'});
-      URL url2 = new URL("vfsmemory://aopdomain2/org/bar/Test.class");
-      MemoryContextFactory.getInstance().putFile(url2, new byte[] {'d', 'e', 'f'});
-      
-      System.out.println("---------");
-      InputStream is = url.openStream();
-      while (is.available() != 0)
-      {
-         System.out.print((char)is.read());
-      }
-      is.close();
-
-      System.out.println("---------");
-      MemoryContextFactory.getInstance().createRoot(rootURL);
-      InputStream is2 = url2.openStream();
-      while (is2.available() != 0)
-      {
-         System.out.print((char)is2.read());
-      }
-      is.close();
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.protocol.vfsmemory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.memory.MemoryContext;
+import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
+import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
+
+/**
+ * URLStreamHandler for VFS
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class Handler extends URLStreamHandler
+{
+   protected URLConnection openConnection(URL u) throws IOException
+   {
+      String host = u.getHost();
+      MemoryContext ctx = MemoryContextFactory.getInstance().find(host);
+      if (ctx == null)
+         throw new IOException("vfs does not exist: " + u.toString());
+
+      VirtualFile vf = ctx.getChild(ctx.getRoot(), u.getPath()).getVirtualFile();
+      if (vf == null)
+         throw new IOException("vfs does not exist: " + u.toString());
+
+      return new VirtualFileURLConnection(u, vf);
+   }
+
+   public static void main(String[] args) throws Exception
+   {
+      System.setProperty("java.protocol.handler.pkgs", "org.jboss.virtual.protocol");
+      //URL url = new URL("vfsfile:/c:/tmp/urlstream.java");
+      //URL url = new URL("vfsfile:/C:\\jboss\\jboss-head\\build\\output\\jboss-5.0.0.Beta\\server\\default\\lib\\jboss.jar\\schema\\xml.xsd");
+//      URL url = new URL("vfsjar:file:/c:/tmp/parent.jar!/foo.jar/urlstream.java");
+      
+      URL rootURL = new URL("vfsmemory://aopdomain2");
+      MemoryContextFactory.getInstance().createRoot(rootURL);
+
+      URL url = new URL("vfsmemory://aopdomain2/org/foo/Test.class");
+      MemoryContextFactory.getInstance().putFile(url, new byte[] {'a', 'b', 'c'});
+      URL url2 = new URL("vfsmemory://aopdomain2/org/bar/Test.class");
+      MemoryContextFactory.getInstance().putFile(url2, new byte[] {'d', 'e', 'f'});
+      
+      System.out.println("---------");
+      InputStream is = url.openStream();
+      while (is.available() != 0)
+      {
+         System.out.print((char)is.read());
+      }
+      is.close();
+
+      System.out.println("---------");
+      MemoryContextFactory.getInstance().createRoot(rootURL);
+      InputStream is2 = url2.openStream();
+      while (is2.available() != 0)
+      {
+         System.out.print((char)is2.read());
+      }
+      is.close();
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VFSContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VFSContext.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,100 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.virtual.spi;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.virtual.VFS;
-
-/** 
- * A virtual file context
- * 
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision: 55466 $
- */
-public interface VFSContext
-{
-   /**
-    * Get the root uri
-    * 
-    * @return the root uri
-    */
-   URI getRootURI();
-
-   /**
-    * Get the VFS for this context
-    * 
-    * @return the vfs
-    */
-   VFS getVFS();
-   
-   /**
-    * Return the root virtual file
-    * 
-    * @return the root
-    * @throws IOException for any problem accessing the VFS
-    */
-   VirtualFileHandler getRoot() throws IOException;
-
-   /**
-    * Get the context option settings
-    * 
-    * @return a map of the context options
-    */
-   Map<String, String> getOptions();
-
-   /**
-    * Get the children
-    * 
-    * @param parent the parent
-    * @param ignoreErrors whether to ignore errors
-    * @return the children
-    * @throws IOException for any problem accessing the VFS
-    * @throws IllegalArgumentException for a null parent
-    */
-   List<VirtualFileHandler> getChildren(VirtualFileHandler parent, boolean ignoreErrors) throws IOException;
-   
-   /**
-    * Find a child
-    * 
-    * @param parent the parent
-    * @param path the path
-    * @return the child
-    * @throws IOException for any problem accessing the VFS
-    * @throws IllegalArgumentException for a null parent or name
-    */
-   VirtualFileHandler findChild(VirtualFileHandler parent, String path) throws IOException;
-   
-   /**
-    * Visit the virtual file system
-    * 
-    * @param handler the reference handler
-    * @param visitor the visitor
-    * @throws IOException for any error
-    * @throws IllegalArgumentException if the handler or visitor is null
-    */
-   void visit(VirtualFileHandler handler, VirtualFileHandlerVisitor visitor) throws IOException;
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VFSContext.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VFSContext.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VFSContext.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,100 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.virtual.spi;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.virtual.VFS;
+
+/** 
+ * A virtual file context
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision: 55466 $
+ */
+public interface VFSContext
+{
+   /**
+    * Get the root uri
+    * 
+    * @return the root uri
+    */
+   URI getRootURI();
+
+   /**
+    * Get the VFS for this context
+    * 
+    * @return the vfs
+    */
+   VFS getVFS();
+   
+   /**
+    * Return the root virtual file
+    * 
+    * @return the root
+    * @throws IOException for any problem accessing the VFS
+    */
+   VirtualFileHandler getRoot() throws IOException;
+
+   /**
+    * Get the context option settings
+    * 
+    * @return a map of the context options
+    */
+   Map<String, String> getOptions();
+
+   /**
+    * Get the children
+    * 
+    * @param parent the parent
+    * @param ignoreErrors whether to ignore errors
+    * @return the children
+    * @throws IOException for any problem accessing the VFS
+    * @throws IllegalArgumentException for a null parent
+    */
+   List<VirtualFileHandler> getChildren(VirtualFileHandler parent, boolean ignoreErrors) throws IOException;
+   
+   /**
+    * Get a child
+    *
+    * @param parent the parent
+    * @param path the path
+    * @return the child or <code>null</code> if not found
+    * @throws IOException for any problem accessing the VFS
+    * @throws IllegalArgumentException for a null parent or name
+    */
+   VirtualFileHandler getChild(VirtualFileHandler parent, String path) throws IOException;
+
+   /**
+    * Visit the virtual file system
+    * 
+    * @param handler the reference handler
+    * @param visitor the visitor
+    * @throws IOException for any error
+    * @throws IllegalArgumentException if the handler or visitor is null
+    */
+   void visit(VirtualFileHandler handler, VirtualFileHandlerVisitor visitor) throws IOException;
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,196 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.virtual.spi;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A virtual file handler
- * 
- * @author Scott.Stark at jboss.org
- * @author Adrian.Brock
- * @version $Revision: 44334 $
- */
-public interface VirtualFileHandler extends Serializable
-{
-   /**
-    * Get the simple VF name (X.java)
-    * 
-    * @return the simple file name
-    */
-   String getName();
-
-   /**
-    * Get the VFS relative path name (org/jboss/X.java)
-    * 
-    * @return the VFS relative path name
-    */
-   String getPathName();
-
-   /**
-    * Get a VFS-based URL
-    *
-    * @return the url
-    * @throws URISyntaxException for an error parsing the URI
-    * @throws MalformedURLException for any error
-    */
-   URL toVfsUrl() throws MalformedURLException, URISyntaxException;
-   
-
-   /**
-    * Get the VF URI (file://root/org/jboss/X.java)
-    * 
-    * @return the full URI to the VF in the VFS.
-    * @throws URISyntaxException for an error parsing the URI 
-    */
-   URI toURI() throws URISyntaxException;
-
-   /**
-    * Get the VF URL (file://root/org/jboss/X.java)
-    * 
-    * @return the full URL to the VF in the VFS.
-    * @throws URISyntaxException for an error parsing the URI 
-    * @throws MalformedURLException for any error
-    */
-   URL toURL() throws MalformedURLException, URISyntaxException;
-
-   /**
-    * When the file was last modified
-    * 
-    * @return the last modified time
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if closed
-    */
-   long getLastModified() throws IOException;
-
-   /**
-    * Returns true if the file has been modified since this method was last called
-    * Last modified time is initialized at handler instantiation.
-    *
-    * @return true if modified, false otherwise
-    * @throws IOException for any error
-    */
-   boolean hasBeenModified() throws IOException;
-   
-   /**
-    * Get the size
-    * 
-    * @return the size
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if closed
-    */
-   long getSize() throws IOException;
-
-   /**
-    * Tests whether the underlying implementation file still exists.
-    * @return true if the file exists, false otherwise.
-    * @throws IOException - thrown on failure to detect existence.
-    */
-   boolean exists() throws IOException;
-
-   /**
-    * 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
-    * @throws IllegalStateException if the file is closed
-    */
-   boolean isLeaf() throws IOException;
-   
-   /**
-    * Whether it is hidden
-    * 
-    * @return true if hidden.
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if closed
-    */
-   boolean isHidden() throws IOException;
-
-   /**
-    * Access the file contents.
-    * 
-    * @return An InputStream for the file contents.
-    * @throws IOException for any problem accessing the virtual file system
-    * @throws IllegalStateException if closed
-    */
-   InputStream openStream() throws IOException;
-
-   /**
-    * Get the parent
-    * 
-    * @return the parent
-    * @throws IOException for an error accessing the file system
-    * @throws IllegalStateException if closed
-    */
-   VirtualFileHandler getParent() throws IOException;
-
-   /**
-    * Get the children
-    * 
-    * @param ignoreErrors whether to ignore errors
-    * @return the children
-    * @throws IOException for an error accessing the file system
-    * @throws IllegalStateException if closed
-    */
-   List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException;
-
-   /**
-    * Find a child
-    * 
-    * @param path the path
-    * @return the child
-    * @throws IOException for an error accessing the file system (or the child doesn't exist)
-    * @throws IllegalStateException if closed
-    */
-   VirtualFileHandler findChild(String path) throws IOException;
-
-   /**
-    * Get the VFSContext this file belongs to
-    * 
-    * @return the context
-    * @throws IllegalStateException if closed
-    */
-   VFSContext getVFSContext();
-
-   /**
-    * Get the virtual file wrapper
-    * 
-    * @return the wrapper
-    * @throws IllegalStateException if closed
-    */
-   VirtualFile getVirtualFile();
-   
-   /**
-    * Close the resources
-    */
-   void close();
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java (from rev 69082, projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.virtual.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A virtual file handler
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author Adrian.Brock
+ * @version $Revision: 44334 $
+ */
+public interface VirtualFileHandler extends Serializable
+{
+   /**
+    * Get the simple VF name (X.java)
+    * 
+    * @return the simple file name
+    */
+   String getName();
+
+   /**
+    * Get the VFS relative path name (org/jboss/X.java)
+    * 
+    * @return the VFS relative path name
+    */
+   String getPathName();
+
+   /**
+    * Get a VFS-based URL
+    *
+    * @return the url
+    * @throws URISyntaxException for an error parsing the URI
+    * @throws MalformedURLException for any error
+    */
+   URL toVfsUrl() throws MalformedURLException, URISyntaxException;
+   
+
+   /**
+    * Get the VF URI (file://root/org/jboss/X.java)
+    * 
+    * @return the full URI to the VF in the VFS.
+    * @throws URISyntaxException for an error parsing the URI 
+    */
+   URI toURI() throws URISyntaxException;
+
+   /**
+    * Get the VF URL (file://root/org/jboss/X.java)
+    * 
+    * @return the full URL to the VF in the VFS.
+    * @throws URISyntaxException for an error parsing the URI 
+    * @throws MalformedURLException for any error
+    */
+   URL toURL() throws MalformedURLException, URISyntaxException;
+
+   /**
+    * When the file was last modified
+    * 
+    * @return the last modified time
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if closed
+    */
+   long getLastModified() throws IOException;
+
+   /**
+    * Returns true if the file has been modified since this method was last called
+    * Last modified time is initialized at handler instantiation.
+    *
+    * @return true if modified, false otherwise
+    * @throws IOException for any error
+    */
+   boolean hasBeenModified() throws IOException;
+   
+   /**
+    * Get the size
+    * 
+    * @return the size
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if closed
+    */
+   long getSize() throws IOException;
+
+   /**
+    * Tests whether the underlying implementation file still exists.
+    * @return true if the file exists, false otherwise.
+    * @throws IOException - thrown on failure to detect existence.
+    */
+   boolean exists() throws IOException;
+
+   /**
+    * 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
+    * @throws IllegalStateException if the file is closed
+    */
+   boolean isLeaf() throws IOException;
+   
+   /**
+    * Whether it is hidden
+    * 
+    * @return true if hidden.
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if closed
+    */
+   boolean isHidden() throws IOException;
+
+   /**
+    * Access the file contents.
+    * 
+    * @return An InputStream for the file contents.
+    * @throws IOException for any problem accessing the virtual file system
+    * @throws IllegalStateException if closed
+    */
+   InputStream openStream() throws IOException;
+
+   /**
+    * Get the parent
+    * 
+    * @return the parent
+    * @throws IOException for an error accessing the file system
+    * @throws IllegalStateException if closed
+    */
+   VirtualFileHandler getParent() throws IOException;
+
+   /**
+    * Get the children
+    * 
+    * @param ignoreErrors whether to ignore errors
+    * @return the children
+    * @throws IOException for an error accessing the file system
+    * @throws IllegalStateException if closed
+    */
+   List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException;
+
+   /**
+    * Get a child
+    *
+    * @param path the path
+    * @return the child or <code>null</code> if not found
+    * @throws IOException for an error accessing the file system
+    * @throws IllegalStateException if closed
+    */
+   VirtualFileHandler getChild(String path) throws IOException;
+
+   /**
+    * Get the VFSContext this file belongs to
+    * 
+    * @return the context
+    * @throws IllegalStateException if closed
+    */
+   VFSContext getVFSContext();
+
+   /**
+    * Get the virtual file wrapper
+    * 
+    * @return the wrapper
+    * @throws IllegalStateException if closed
+    */
+   VirtualFile getVirtualFile();
+   
+   /**
+    * Close the resources
+    */
+   void close();
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,56 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.support;
-
-import java.io.IOException;
-
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * MockSimpleVirtualFileHandler.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class MockSimpleVirtualFileHandler extends AbstractMockVirtualFileHandler
-{
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -7967261672121081602L;
-
-   /**
-    * Create a new MockSimpleVirtualFileHandler.
-    * 
-    * @param context the context
-    * @param parent the parent
-    * @param name the name
-    */
-   public MockSimpleVirtualFileHandler(MockVFSContext context, MockSimpleVirtualFileHandler parent, String name)
-   {
-      super(context, parent, name);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      throwIOException("findChild");
-      return simpleFindChild(path);
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.support;
+
+import java.io.IOException;
+
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * MockSimpleVirtualFileHandler.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class MockSimpleVirtualFileHandler extends AbstractMockVirtualFileHandler
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -7967261672121081602L;
+
+   /**
+    * Create a new MockSimpleVirtualFileHandler.
+    * 
+    * @param context the context
+    * @param parent the parent
+    * @param name the name
+    */
+   public MockSimpleVirtualFileHandler(MockVFSContext context, MockSimpleVirtualFileHandler parent, String name)
+   {
+      super(context, parent, name);
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      throwIOException("getChild");
+      return simpleFindChild(path);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,66 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.support;
-
-import java.io.IOException;
-
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * MockStructuredVirtualFileHandler.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class MockStructuredVirtualFileHandler extends AbstractMockVirtualFileHandler implements StructuredVirtualFileHandler
-{
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -7967261672121081602L;
-
-   /**
-    * Create a new MockStructuredVirtualFileHandler.
-    * 
-    * @param context the context
-    * @param parent the parent
-    * @param name the name
-    */
-   public MockStructuredVirtualFileHandler(MockVFSContext context, MockStructuredVirtualFileHandler parent, String name)
-   {
-      super(context, parent, name);
-   }
-
-   public VirtualFileHandler findChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   public VirtualFileHandler createChildHandler(String name) throws IOException
-   {
-      for (VirtualFileHandler child : getChildren(false))
-      {
-         if (name.equals(child.getName()))
-            return child;
-      }
-      throw new IOException("Child not found: " + name + " for " + toURI());
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.support;
+
+import java.io.IOException;
+
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * MockStructuredVirtualFileHandler.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class MockStructuredVirtualFileHandler extends AbstractMockVirtualFileHandler implements StructuredVirtualFileHandler
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -7967261672121081602L;
+
+   /**
+    * Create a new MockStructuredVirtualFileHandler.
+    * 
+    * @param context the context
+    * @param parent the parent
+    * @param name the name
+    */
+   public MockStructuredVirtualFileHandler(MockVFSContext context, MockStructuredVirtualFileHandler parent, String name)
+   {
+      super(context, parent, name);
+   }
+
+   public VirtualFileHandler createChildHandler(String name) throws IOException
+   {
+      for (VirtualFileHandler child : getChildren(false))
+      {
+         if (name.equals(child.getName()))
+            return child;
+      }
+      return null;
+   }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,315 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jboss.test.virtual.support.MockSimpleVirtualFileHandler;
-import org.jboss.test.virtual.support.MockStructuredVirtualFileHandler;
-import org.jboss.test.virtual.support.MockVFSContext;
-import org.jboss.test.virtual.support.MockVFSContextFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * AbstractMockVFSTest.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractMockVFSTest extends AbstractVFSTest
-{
-   /** The vfs context factory */
-   protected static MockVFSContextFactory mockVFSContextFactory = new MockVFSContextFactory();
-
-   /**
-    * Create a new AbstractMockVFSTest.
-    * 
-    * @param name the name
-    */
-   protected AbstractMockVFSTest(String name)
-   {
-      super(name);
-   }
-
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      VFSContextFactoryLocator.registerFactory(mockVFSContextFactory);
-   }
-
-   protected void tearDown() throws Exception
-   {
-      mockVFSContextFactory.reset();
-      VFSContextFactoryLocator.unregisterFactory(mockVFSContextFactory);
-      super.tearDown();
-   }
-   
-   protected MockVFSContext createSimpleVFSContext()
-   {
-      MockVFSContext context = new MockVFSContext("simple");
-      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      return context;
-   }
-   
-   protected MockVFSContext registerSimpleVFSContext()
-   {
-      MockVFSContext context = createSimpleVFSContext();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected MockVFSContext createSimple2VFSContext()
-   {
-      MockVFSContext context = new MockVFSContext("simple2");
-      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      return context;
-   }
-   
-   protected MockVFSContext registerSimple2VFSContext()
-   {
-      MockVFSContext context = createSimple2VFSContext();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected MockVFSContext createSimpleVFSContextWithChildren()
-   {
-      MockVFSContext context = new MockVFSContext("simpleWithChildren");
-      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      new MockSimpleVirtualFileHandler(context, root, "child1");
-      new MockSimpleVirtualFileHandler(context, root, "child2");
-      new MockSimpleVirtualFileHandler(context, root, "child3");
-      return context;
-   }
-   
-   protected MockVFSContext registerSimpleVFSContextWithChildren()
-   {
-      MockVFSContext context = createSimpleVFSContextWithChildren();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected MockVFSContext createSimpleVFSContextWithChildrenAndNonLeafs()
-   {
-      MockVFSContext context = new MockVFSContext("simpleWithChildren");
-      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      new MockSimpleVirtualFileHandler(context, root, "child1");
-      new MockSimpleVirtualFileHandler(context, root, "child2");
-      new MockSimpleVirtualFileHandler(context, root, "child3");
-      MockSimpleVirtualFileHandler folder1 = new MockSimpleVirtualFileHandler(context, root, "folder1");
-      folder1.setLeaf(false);
-      new MockSimpleVirtualFileHandler(context, root, "folder1/child1");
-      MockSimpleVirtualFileHandler folder2 = new MockSimpleVirtualFileHandler(context, root, "folder2");
-      folder2.setLeaf(false);
-      new MockSimpleVirtualFileHandler(context, root, "folder2/child1");
-      new MockSimpleVirtualFileHandler(context, root, "folder2/child2");
-      MockSimpleVirtualFileHandler folder3 = new MockSimpleVirtualFileHandler(context, root, "folder3");
-      folder3.setLeaf(false);
-      new MockSimpleVirtualFileHandler(context, root, "folder3/child1");
-      new MockSimpleVirtualFileHandler(context, root, "folder3/child2");
-      new MockSimpleVirtualFileHandler(context, root, "folder3/child3");
-      
-      return context;
-   }
-   
-   protected MockVFSContext registerSimpleVFSContextWithChildrenAndNonLeafs()
-   {
-      MockVFSContext context = createSimpleVFSContextWithChildrenAndNonLeafs();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected MockVFSContext createSimpleVFSContextWithChildrenAndNonLeafsWithHidden()
-   {
-      MockVFSContext context = new MockVFSContext("simpleWithChildren");
-      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      MockSimpleVirtualFileHandler child1 = new MockSimpleVirtualFileHandler(context, root, "child1");
-      child1.setHidden(true);
-      new MockSimpleVirtualFileHandler(context, root, "child2");
-      new MockSimpleVirtualFileHandler(context, root, "child3");
-      MockSimpleVirtualFileHandler folder1 = new MockSimpleVirtualFileHandler(context, root, "folder1");
-      folder1.setLeaf(false);
-      new MockSimpleVirtualFileHandler(context, root, "folder1/child1");
-      MockSimpleVirtualFileHandler folder2 = new MockSimpleVirtualFileHandler(context, root, "folder2");
-      folder2.setLeaf(false);
-      new MockSimpleVirtualFileHandler(context, root, "folder2/child1");
-      new MockSimpleVirtualFileHandler(context, root, "folder2/child2");
-      MockSimpleVirtualFileHandler folder3 = new MockSimpleVirtualFileHandler(context, root, "folder3");
-      folder3.setLeaf(false);
-      new MockSimpleVirtualFileHandler(context, root, "folder3/child1");
-      new MockSimpleVirtualFileHandler(context, root, "folder3/child2");
-      new MockSimpleVirtualFileHandler(context, root, "folder3/child3");
-      
-      return context;
-   }
-   
-   protected MockVFSContext registerSimpleVFSContextWithChildrenAndNonLeafsWithHidden()
-   {
-      MockVFSContext context = createSimpleVFSContextWithChildrenAndNonLeafsWithHidden();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected MockVFSContext createStructuredVFSContextWithSubChildren()
-   {
-      MockVFSContext context = new MockVFSContext("simpleWithChildren");
-      MockStructuredVirtualFileHandler root = new MockStructuredVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      MockStructuredVirtualFileHandler child1 = new MockStructuredVirtualFileHandler(context, root, "child1");
-      new MockStructuredVirtualFileHandler(context, child1, "child1,1");
-      MockStructuredVirtualFileHandler child2 = new MockStructuredVirtualFileHandler(context, root, "child2");
-      new MockStructuredVirtualFileHandler(context, child2, "child2,1");
-      new MockStructuredVirtualFileHandler(context, child2, "child2,2");
-      MockStructuredVirtualFileHandler child3 = new MockStructuredVirtualFileHandler(context, root, "child3");
-      new MockStructuredVirtualFileHandler(context, child3, "child3,1");
-      new MockStructuredVirtualFileHandler(context, child3, "child3,2");
-      new MockStructuredVirtualFileHandler(context, child3, "child3,3");
-      return context;
-   }
-   
-   protected MockVFSContext registerStructuredVFSContextWithSubChildren()
-   {
-      MockVFSContext context = createStructuredVFSContextWithSubChildren();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected MockVFSContext createStructuredVFSContextWithChildrenAndNonLeafs()
-   {
-      MockVFSContext context = new MockVFSContext("simpleWithChildren");
-      MockStructuredVirtualFileHandler root = new MockStructuredVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      new MockStructuredVirtualFileHandler(context, root, "child1");
-      new MockStructuredVirtualFileHandler(context, root, "child2");
-      new MockStructuredVirtualFileHandler(context, root, "child3");
-      MockStructuredVirtualFileHandler folder1 = new MockStructuredVirtualFileHandler(context, root, "folder1");
-      folder1.setLeaf(false);
-      new MockStructuredVirtualFileHandler(context, folder1, "child1");
-      MockStructuredVirtualFileHandler folder2 = new MockStructuredVirtualFileHandler(context, root, "folder2");
-      folder2.setLeaf(false);
-      new MockStructuredVirtualFileHandler(context, folder2, "child1");
-      new MockStructuredVirtualFileHandler(context, folder2, "child2");
-      MockStructuredVirtualFileHandler folder3 = new MockStructuredVirtualFileHandler(context, root, "folder3");
-      folder3.setLeaf(false);
-      new MockStructuredVirtualFileHandler(context, folder3, "child1");
-      new MockStructuredVirtualFileHandler(context, folder3, "child2");
-      new MockStructuredVirtualFileHandler(context, folder3, "child3");
-      
-      return context;
-   }
-   
-   protected MockVFSContext registerStructuredVFSContextWithChildrenAndNonLeafs()
-   {
-      MockVFSContext context = createStructuredVFSContextWithChildrenAndNonLeafs();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected MockVFSContext createStructuredVFSContextWithChildrenAndNonLeafsWithHidden()
-   {
-      MockVFSContext context = new MockVFSContext("simpleWithChildren");
-      MockStructuredVirtualFileHandler root = new MockStructuredVirtualFileHandler(context, null, "");
-      context.setRoot(root);
-      MockStructuredVirtualFileHandler child1 = new MockStructuredVirtualFileHandler(context, root, "child1");
-      child1.setHidden(true);
-      new MockStructuredVirtualFileHandler(context, root, "child2");
-      new MockStructuredVirtualFileHandler(context, root, "child3");
-      MockStructuredVirtualFileHandler folder1 = new MockStructuredVirtualFileHandler(context, root, "folder1");
-      folder1.setLeaf(false);
-      new MockStructuredVirtualFileHandler(context, folder1, "child1");
-      MockStructuredVirtualFileHandler folder2 = new MockStructuredVirtualFileHandler(context, root, "folder2");
-      folder2.setLeaf(false);
-      new MockStructuredVirtualFileHandler(context, folder2, "child1");
-      new MockStructuredVirtualFileHandler(context, folder2, "child2");
-      MockStructuredVirtualFileHandler folder3 = new MockStructuredVirtualFileHandler(context, root, "folder3");
-      folder3.setLeaf(false);
-      new MockStructuredVirtualFileHandler(context, folder3, "child1");
-      new MockStructuredVirtualFileHandler(context, folder3, "child2");
-      new MockStructuredVirtualFileHandler(context, folder3, "child3");
-      
-      return context;
-   }
-   
-   protected MockVFSContext registerStructuredVFSContextWithChildrenAndNonLeafsWithHidden()
-   {
-      MockVFSContext context = createStructuredVFSContextWithChildrenAndNonLeafsWithHidden();
-      mockVFSContextFactory.addVFSContext(context);
-      return context;
-   }
-   
-   protected VirtualFileHandler getChildHandler(VFSContext context, String path) throws IOException
-   {
-      if (context == null)
-         throw new IllegalArgumentException("Null context");
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-
-      VirtualFileHandler root = context.getRoot();
-      assertNotNull(root);
-      VirtualFileHandler handler = context.findChild(root, path);
-      assertNotNull(handler);
-      return handler;
-   }
-
-   protected void assertGetName(URI uri, String name) throws Exception
-   {
-      assertGetName(uri, name, name);
-   }
-
-   protected void assertGetName(URI uri, String path, String name) throws Exception
-   {
-      VirtualFile file = VFS.getVirtualFile(uri, path);
-      assertEquals(name, file.getName());
-   }
-
-   protected void assertGetPathName(URI uri, String path) throws Exception
-   {
-      VirtualFile file = VFS.getVirtualFile(uri, path);
-      assertEquals(path, file.getPathName());
-   }
-
-   protected VirtualFile assertFindChild(VFS vfs, String path, VirtualFile expected) throws Exception
-   {
-      VirtualFile found = vfs.findChild(path);
-      assertNotNull(found);
-      assertEquals(expected, found);
-      return found;
-   }
-
-   protected VirtualFile assertFindChild(VirtualFile file, String path, VirtualFile expected) throws Exception
-   {
-      VirtualFile found = file.findChild(path);
-      assertNotNull(found);
-      assertEquals(expected, found);
-      return found;
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,315 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jboss.test.virtual.support.MockSimpleVirtualFileHandler;
+import org.jboss.test.virtual.support.MockStructuredVirtualFileHandler;
+import org.jboss.test.virtual.support.MockVFSContext;
+import org.jboss.test.virtual.support.MockVFSContextFactory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VFSContextFactoryLocator;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractMockVFSTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractMockVFSTest extends AbstractVFSTest
+{
+   /** The vfs context factory */
+   protected static MockVFSContextFactory mockVFSContextFactory = new MockVFSContextFactory();
+
+   /**
+    * Create a new AbstractMockVFSTest.
+    * 
+    * @param name the name
+    */
+   protected AbstractMockVFSTest(String name)
+   {
+      super(name);
+   }
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      VFSContextFactoryLocator.registerFactory(mockVFSContextFactory);
+   }
+
+   protected void tearDown() throws Exception
+   {
+      mockVFSContextFactory.reset();
+      VFSContextFactoryLocator.unregisterFactory(mockVFSContextFactory);
+      super.tearDown();
+   }
+   
+   protected MockVFSContext createSimpleVFSContext()
+   {
+      MockVFSContext context = new MockVFSContext("simple");
+      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      return context;
+   }
+   
+   protected MockVFSContext registerSimpleVFSContext()
+   {
+      MockVFSContext context = createSimpleVFSContext();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected MockVFSContext createSimple2VFSContext()
+   {
+      MockVFSContext context = new MockVFSContext("simple2");
+      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      return context;
+   }
+   
+   protected MockVFSContext registerSimple2VFSContext()
+   {
+      MockVFSContext context = createSimple2VFSContext();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected MockVFSContext createSimpleVFSContextWithChildren()
+   {
+      MockVFSContext context = new MockVFSContext("simpleWithChildren");
+      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      new MockSimpleVirtualFileHandler(context, root, "child1");
+      new MockSimpleVirtualFileHandler(context, root, "child2");
+      new MockSimpleVirtualFileHandler(context, root, "child3");
+      return context;
+   }
+   
+   protected MockVFSContext registerSimpleVFSContextWithChildren()
+   {
+      MockVFSContext context = createSimpleVFSContextWithChildren();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected MockVFSContext createSimpleVFSContextWithChildrenAndNonLeafs()
+   {
+      MockVFSContext context = new MockVFSContext("simpleWithChildren");
+      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      new MockSimpleVirtualFileHandler(context, root, "child1");
+      new MockSimpleVirtualFileHandler(context, root, "child2");
+      new MockSimpleVirtualFileHandler(context, root, "child3");
+      MockSimpleVirtualFileHandler folder1 = new MockSimpleVirtualFileHandler(context, root, "folder1");
+      folder1.setLeaf(false);
+      new MockSimpleVirtualFileHandler(context, root, "folder1/child1");
+      MockSimpleVirtualFileHandler folder2 = new MockSimpleVirtualFileHandler(context, root, "folder2");
+      folder2.setLeaf(false);
+      new MockSimpleVirtualFileHandler(context, root, "folder2/child1");
+      new MockSimpleVirtualFileHandler(context, root, "folder2/child2");
+      MockSimpleVirtualFileHandler folder3 = new MockSimpleVirtualFileHandler(context, root, "folder3");
+      folder3.setLeaf(false);
+      new MockSimpleVirtualFileHandler(context, root, "folder3/child1");
+      new MockSimpleVirtualFileHandler(context, root, "folder3/child2");
+      new MockSimpleVirtualFileHandler(context, root, "folder3/child3");
+      
+      return context;
+   }
+   
+   protected MockVFSContext registerSimpleVFSContextWithChildrenAndNonLeafs()
+   {
+      MockVFSContext context = createSimpleVFSContextWithChildrenAndNonLeafs();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected MockVFSContext createSimpleVFSContextWithChildrenAndNonLeafsWithHidden()
+   {
+      MockVFSContext context = new MockVFSContext("simpleWithChildren");
+      MockSimpleVirtualFileHandler root = new MockSimpleVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      MockSimpleVirtualFileHandler child1 = new MockSimpleVirtualFileHandler(context, root, "child1");
+      child1.setHidden(true);
+      new MockSimpleVirtualFileHandler(context, root, "child2");
+      new MockSimpleVirtualFileHandler(context, root, "child3");
+      MockSimpleVirtualFileHandler folder1 = new MockSimpleVirtualFileHandler(context, root, "folder1");
+      folder1.setLeaf(false);
+      new MockSimpleVirtualFileHandler(context, root, "folder1/child1");
+      MockSimpleVirtualFileHandler folder2 = new MockSimpleVirtualFileHandler(context, root, "folder2");
+      folder2.setLeaf(false);
+      new MockSimpleVirtualFileHandler(context, root, "folder2/child1");
+      new MockSimpleVirtualFileHandler(context, root, "folder2/child2");
+      MockSimpleVirtualFileHandler folder3 = new MockSimpleVirtualFileHandler(context, root, "folder3");
+      folder3.setLeaf(false);
+      new MockSimpleVirtualFileHandler(context, root, "folder3/child1");
+      new MockSimpleVirtualFileHandler(context, root, "folder3/child2");
+      new MockSimpleVirtualFileHandler(context, root, "folder3/child3");
+      
+      return context;
+   }
+   
+   protected MockVFSContext registerSimpleVFSContextWithChildrenAndNonLeafsWithHidden()
+   {
+      MockVFSContext context = createSimpleVFSContextWithChildrenAndNonLeafsWithHidden();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected MockVFSContext createStructuredVFSContextWithSubChildren()
+   {
+      MockVFSContext context = new MockVFSContext("simpleWithChildren");
+      MockStructuredVirtualFileHandler root = new MockStructuredVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      MockStructuredVirtualFileHandler child1 = new MockStructuredVirtualFileHandler(context, root, "child1");
+      new MockStructuredVirtualFileHandler(context, child1, "child1,1");
+      MockStructuredVirtualFileHandler child2 = new MockStructuredVirtualFileHandler(context, root, "child2");
+      new MockStructuredVirtualFileHandler(context, child2, "child2,1");
+      new MockStructuredVirtualFileHandler(context, child2, "child2,2");
+      MockStructuredVirtualFileHandler child3 = new MockStructuredVirtualFileHandler(context, root, "child3");
+      new MockStructuredVirtualFileHandler(context, child3, "child3,1");
+      new MockStructuredVirtualFileHandler(context, child3, "child3,2");
+      new MockStructuredVirtualFileHandler(context, child3, "child3,3");
+      return context;
+   }
+   
+   protected MockVFSContext registerStructuredVFSContextWithSubChildren()
+   {
+      MockVFSContext context = createStructuredVFSContextWithSubChildren();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected MockVFSContext createStructuredVFSContextWithChildrenAndNonLeafs()
+   {
+      MockVFSContext context = new MockVFSContext("simpleWithChildren");
+      MockStructuredVirtualFileHandler root = new MockStructuredVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      new MockStructuredVirtualFileHandler(context, root, "child1");
+      new MockStructuredVirtualFileHandler(context, root, "child2");
+      new MockStructuredVirtualFileHandler(context, root, "child3");
+      MockStructuredVirtualFileHandler folder1 = new MockStructuredVirtualFileHandler(context, root, "folder1");
+      folder1.setLeaf(false);
+      new MockStructuredVirtualFileHandler(context, folder1, "child1");
+      MockStructuredVirtualFileHandler folder2 = new MockStructuredVirtualFileHandler(context, root, "folder2");
+      folder2.setLeaf(false);
+      new MockStructuredVirtualFileHandler(context, folder2, "child1");
+      new MockStructuredVirtualFileHandler(context, folder2, "child2");
+      MockStructuredVirtualFileHandler folder3 = new MockStructuredVirtualFileHandler(context, root, "folder3");
+      folder3.setLeaf(false);
+      new MockStructuredVirtualFileHandler(context, folder3, "child1");
+      new MockStructuredVirtualFileHandler(context, folder3, "child2");
+      new MockStructuredVirtualFileHandler(context, folder3, "child3");
+      
+      return context;
+   }
+   
+   protected MockVFSContext registerStructuredVFSContextWithChildrenAndNonLeafs()
+   {
+      MockVFSContext context = createStructuredVFSContextWithChildrenAndNonLeafs();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected MockVFSContext createStructuredVFSContextWithChildrenAndNonLeafsWithHidden()
+   {
+      MockVFSContext context = new MockVFSContext("simpleWithChildren");
+      MockStructuredVirtualFileHandler root = new MockStructuredVirtualFileHandler(context, null, "");
+      context.setRoot(root);
+      MockStructuredVirtualFileHandler child1 = new MockStructuredVirtualFileHandler(context, root, "child1");
+      child1.setHidden(true);
+      new MockStructuredVirtualFileHandler(context, root, "child2");
+      new MockStructuredVirtualFileHandler(context, root, "child3");
+      MockStructuredVirtualFileHandler folder1 = new MockStructuredVirtualFileHandler(context, root, "folder1");
+      folder1.setLeaf(false);
+      new MockStructuredVirtualFileHandler(context, folder1, "child1");
+      MockStructuredVirtualFileHandler folder2 = new MockStructuredVirtualFileHandler(context, root, "folder2");
+      folder2.setLeaf(false);
+      new MockStructuredVirtualFileHandler(context, folder2, "child1");
+      new MockStructuredVirtualFileHandler(context, folder2, "child2");
+      MockStructuredVirtualFileHandler folder3 = new MockStructuredVirtualFileHandler(context, root, "folder3");
+      folder3.setLeaf(false);
+      new MockStructuredVirtualFileHandler(context, folder3, "child1");
+      new MockStructuredVirtualFileHandler(context, folder3, "child2");
+      new MockStructuredVirtualFileHandler(context, folder3, "child3");
+      
+      return context;
+   }
+   
+   protected MockVFSContext registerStructuredVFSContextWithChildrenAndNonLeafsWithHidden()
+   {
+      MockVFSContext context = createStructuredVFSContextWithChildrenAndNonLeafsWithHidden();
+      mockVFSContextFactory.addVFSContext(context);
+      return context;
+   }
+   
+   protected VirtualFileHandler getChildHandler(VFSContext context, String path) throws IOException
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null context");
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      VirtualFileHandler root = context.getRoot();
+      assertNotNull(root);
+      VirtualFileHandler handler = context.getChild(root, path);
+      assertNotNull(handler);
+      return handler;
+   }
+
+   protected void assertGetName(URI uri, String name) throws Exception
+   {
+      assertGetName(uri, name, name);
+   }
+
+   protected void assertGetName(URI uri, String path, String name) throws Exception
+   {
+      VirtualFile file = VFS.getVirtualFile(uri, path);
+      assertEquals(name, file.getName());
+   }
+
+   protected void assertGetPathName(URI uri, String path) throws Exception
+   {
+      VirtualFile file = VFS.getVirtualFile(uri, path);
+      assertEquals(path, file.getPathName());
+   }
+
+   protected VirtualFile assertFindChild(VFS vfs, String path, VirtualFile expected) throws Exception
+   {
+      VirtualFile found = vfs.findChild(path);
+      assertNotNull(found);
+      assertEquals(expected, found);
+      return found;
+   }
+
+   protected VirtualFile assertFindChild(VirtualFile file, String path, VirtualFile expected) throws Exception
+   {
+      VirtualFile found = file.findChild(path);
+      assertNotNull(found);
+      assertEquals(expected, found);
+      return found;
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,296 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.test.virtual.support.MockVirtualFileHandlerVisitor;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * AbstractVFSContextTest.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractVFSContextTest extends AbstractVFSTest
-{
-   public AbstractVFSContextTest(String name)
-   {
-      super(name);
-   }
-   
-   protected abstract VFSContext getVFSContext(String name) throws Exception;
-
-   protected abstract VFSContext getParentVFSContext() throws Exception;
-
-   protected abstract String getSuffix();
-
-   /* TODO URI testing
-   public void testRootURI() throws Exception
-   {
-   }
-   */
-   
-   public void testGetVFS() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      URI rootURI = context.getRootURI();
-      VFS vfs = context.getVFS();
-      VirtualFile rootFile = vfs.getRoot();
-
-      URI uri = new URI("vfs" + rootURI);
-      URI rfUri = rootFile.toURI();
-      assertEquals(uri, rfUri);
-   }
-   
-   public void testGetRoot() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      URI rootURI = context.getRootURI();
-      VirtualFileHandler rootHandler = context.getRoot(); 
-      VFS vfs = context.getVFS();
-      VirtualFile rootFile = vfs.getRoot();
-      
-      assertEquals(rootURI, rootHandler.toURI());
-      assertEquals(rootHandler.getVirtualFile(), rootFile);
-   }
-   
-   /* TODO getOptions
-   public void testGetOptions() throws Exception
-   {
-   }
-   */
-   
-   public void testGetChildren() throws Exception
-   {
-      VFSContext context = getVFSContext("children");
-      VirtualFileHandler root = context.getRoot();
-      List<VirtualFileHandler> children = context.getChildren(root, false);
-      
-      Set<String> expected = new HashSet<String>();
-      expected.add("child1");
-      expected.add("child2");
-      expected.add("child3");
-
-      Set<String> actual = new HashSet<String>();
-      for (VirtualFileHandler child : children)
-      {
-         if (child.getName().startsWith("META-INF") == false && child.getName().equals(".svn") == false)
-            actual.add(child.getName());
-      }
-      
-      assertEquals(expected, actual);
-   }
-
-   public void testGetChildrenNullFile() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      try
-      {
-         context.getChildren(null, false);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testFindChildRoot() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = context.findChild(root, "");
-      assertEquals(root, found);
-   }
-
-   public void testFindChild() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = context.findChild(root, "child");
-      assertEquals("child", found.getPathName());
-   }
-
-   public void testFindChildSubFolder() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = context.findChild(root, "subfolder");
-      assertEquals("subfolder", found.getPathName());
-   }
-
-   public void testFindChildSubChild() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = context.findChild(root, "subfolder/subchild");
-      assertEquals("subfolder/subchild", found.getPathName());
-   }
-
-   public void testFindChildDoesNotExist() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      try
-      {
-         context.findChild(root, "doesnotexist");
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowableTemp(IOException.class, t);
-      }
-   }
-
-   public void testFindChildNullFile() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      try
-      {
-         context.findChild(null, "");
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testFindChildNullPath() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      try
-      {
-         context.findChild(root, null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testSimpleReversePath() throws Exception
-   {
-      checkReversePath("simple" + getSuffix() + "/../complex" + getSuffix() + "/subfolder/subsubfolder/../subchild", "subchild");
-   }
-
-   public void testComplexReversePath() throws Exception
-   {
-      checkReversePath("complex" + getSuffix() + "/../simple" + getSuffix() + "/child", "child");
-   }
-
-   public void testDirectOverTheTop() throws Exception
-   {
-      checkOverTheTop("..");
-   }
-
-   public void testMiddleOverTheTop() throws Exception
-   {
-      checkOverTheTop("complex" + getSuffix() + "/subfolder/../../../complex" + getSuffix() + "/subfolder");
-   }
-
-   protected void checkOverTheTop(String path) throws Exception
-   {
-      try
-      {
-         checkReversePath(path, null);
-         fail("Should not be here.");
-      }
-      catch(Exception e)
-      {
-         checkThrowable(IOException.class, e);
-      }
-   }
-
-   protected void checkReversePath(String path, String fileName) throws Exception
-   {
-      VFSContext context = getParentVFSContext();
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, path);
-      assertNotNull(child);
-      assertTrue(child.isLeaf());
-      assertEquals(fileName, child.getName());
-   }
-
-   public void testVisit() throws Exception
-   {
-      VFSContext context = getVFSContext("children");
-      VirtualFileHandler root = context.getRoot();
-      MockVirtualFileHandlerVisitor visitor = new MockVirtualFileHandlerVisitor();
-      context.visit(root, visitor);
-      
-      Set<String> expected = new HashSet<String>();
-      expected.add("child1");
-      expected.add("child2");
-      expected.add("child3");
-
-      Set<String> actual = new HashSet<String>();
-      for (VirtualFileHandler child : visitor.getVisited())
-      {
-         if (child.getName().startsWith("META-INF") == false && child.getName().equals(".svn") == false)
-            actual.add(child.getName());
-      }
-      
-      assertEquals(expected, actual);
-   }
-
-   public void testVisitNullHandler() throws Exception
-   {
-      VFSContext context = getVFSContext("children");
-      MockVirtualFileHandlerVisitor visitor = new MockVirtualFileHandlerVisitor();
-      try
-      {
-         context.visit(null, visitor);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testVisitNullVisitor() throws Exception
-   {
-      VFSContext context = getVFSContext("children");
-      VirtualFileHandler root = context.getRoot();
-      try
-      {
-         context.visit(root, null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,295 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.test.virtual.support.MockVirtualFileHandlerVisitor;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractVFSContextTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractVFSContextTest extends AbstractVFSTest
+{
+   public AbstractVFSContextTest(String name)
+   {
+      super(name);
+   }
+   
+   protected abstract VFSContext getVFSContext(String name) throws Exception;
+
+   protected abstract VFSContext getParentVFSContext() throws Exception;
+
+   protected abstract String getSuffix();
+
+   /* TODO URI testing
+   public void testRootURI() throws Exception
+   {
+   }
+   */
+   
+   public void testGetVFS() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      URI rootURI = context.getRootURI();
+      VFS vfs = context.getVFS();
+      VirtualFile rootFile = vfs.getRoot();
+
+      URI uri = new URI("vfs" + rootURI);
+      URI rfUri = rootFile.toURI();
+      assertEquals(uri, rfUri);
+   }
+   
+   public void testGetRoot() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      URI rootURI = context.getRootURI();
+      VirtualFileHandler rootHandler = context.getRoot(); 
+      VFS vfs = context.getVFS();
+      VirtualFile rootFile = vfs.getRoot();
+      
+      assertEquals(rootURI, rootHandler.toURI());
+      assertEquals(rootHandler.getVirtualFile(), rootFile);
+   }
+   
+   /* TODO getOptions
+   public void testGetOptions() throws Exception
+   {
+   }
+   */
+   
+   public void testGetChildren() throws Exception
+   {
+      VFSContext context = getVFSContext("children");
+      VirtualFileHandler root = context.getRoot();
+      List<VirtualFileHandler> children = context.getChildren(root, false);
+      
+      Set<String> expected = new HashSet<String>();
+      expected.add("child1");
+      expected.add("child2");
+      expected.add("child3");
+
+      Set<String> actual = new HashSet<String>();
+      for (VirtualFileHandler child : children)
+      {
+         if (child.getName().startsWith("META-INF") == false && child.getName().equals(".svn") == false)
+            actual.add(child.getName());
+      }
+      
+      assertEquals(expected, actual);
+   }
+
+   public void testGetChildrenNullFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      try
+      {
+         context.getChildren(null, false);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildRoot() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.getChild(root, "");
+      assertEquals(root, found);
+   }
+
+   public void testFindChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.getChild(root, "child");
+      assertEquals("child", found.getPathName());
+   }
+
+   public void testFindChildSubFolder() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.getChild(root, "subfolder");
+      assertEquals("subfolder", found.getPathName());
+   }
+
+   public void testFindChildSubChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.getChild(root, "subfolder/subchild");
+      assertEquals("subfolder/subchild", found.getPathName());
+   }
+
+   public void testFindChildDoesNotExist() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         assertNull(context.getChild(root, "doesnotexist"));
+      }
+      catch (Throwable t)
+      {
+         checkThrowableTemp(IOException.class, t);
+      }
+   }
+
+   public void testFindChildNullFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      try
+      {
+         context.getChild(null, "");
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildNullPath() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         context.getChild(root, null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testSimpleReversePath() throws Exception
+   {
+      checkReversePath("simple" + getSuffix() + "/../complex" + getSuffix() + "/subfolder/subsubfolder/../subchild", "subchild");
+   }
+
+   public void testComplexReversePath() throws Exception
+   {
+      checkReversePath("complex" + getSuffix() + "/../simple" + getSuffix() + "/child", "child");
+   }
+
+   public void testDirectOverTheTop() throws Exception
+   {
+      checkOverTheTop("..");
+   }
+
+   public void testMiddleOverTheTop() throws Exception
+   {
+      checkOverTheTop("complex" + getSuffix() + "/subfolder/../../../complex" + getSuffix() + "/subfolder");
+   }
+
+   protected void checkOverTheTop(String path) throws Exception
+   {
+      try
+      {
+         checkReversePath(path, null);
+         fail("Should not be here.");
+      }
+      catch(Exception e)
+      {
+         checkThrowable(IOException.class, e);
+      }
+   }
+
+   protected void checkReversePath(String path, String fileName) throws Exception
+   {
+      VFSContext context = getParentVFSContext();
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, path);
+      assertNotNull(child);
+      assertTrue(child.isLeaf());
+      assertEquals(fileName, child.getName());
+   }
+
+   public void testVisit() throws Exception
+   {
+      VFSContext context = getVFSContext("children");
+      VirtualFileHandler root = context.getRoot();
+      MockVirtualFileHandlerVisitor visitor = new MockVirtualFileHandlerVisitor();
+      context.visit(root, visitor);
+      
+      Set<String> expected = new HashSet<String>();
+      expected.add("child1");
+      expected.add("child2");
+      expected.add("child3");
+
+      Set<String> actual = new HashSet<String>();
+      for (VirtualFileHandler child : visitor.getVisited())
+      {
+         if (child.getName().startsWith("META-INF") == false && child.getName().equals(".svn") == false)
+            actual.add(child.getName());
+      }
+      
+      assertEquals(expected, actual);
+   }
+
+   public void testVisitNullHandler() throws Exception
+   {
+      VFSContext context = getVFSContext("children");
+      MockVirtualFileHandlerVisitor visitor = new MockVirtualFileHandlerVisitor();
+      try
+      {
+         context.visit(null, visitor);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testVisitNullVisitor() throws Exception
+   {
+      VFSContext context = getVFSContext("children");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         context.visit(root, null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,601 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * AbstractVirtualFileHandlerTest.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractVirtualFileHandlerTest extends AbstractVFSTest
-{
-   public AbstractVirtualFileHandlerTest(String name)
-   {
-      super(name);
-   }
-   
-   protected abstract VFSContext getVFSContext(String name) throws Exception;
-
-   protected String getRootName(String name) throws Exception
-   {
-      return name;
-   }
-   
-   protected abstract long getRealLastModified(String name, String path) throws Exception;
-   
-   protected abstract long getRealSize(String name, String path) throws Exception;
-   
-   public void testRootName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      String rootName = getRootName("complex");
-      assertEquals(rootName, root.getName());
-   }
-
-   public void testChildName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      assertEquals("child", child.getName());
-   }
-
-   public void testSubFolderName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder");
-      assertEquals("subfolder", child.getName());
-   }
-
-   public void testSubChildName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
-      assertTrue(child.getName().endsWith("subchild"));
-   }
-   
-   public void testRootPathName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      assertEquals("", root.getPathName());
-   }
-
-   public void testChildPathName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      assertEquals("child", child.getPathName());
-   }
-
-   public void testSubFolderPathName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder");
-      assertEquals("subfolder", child.getPathName());
-   }
-
-   public void testSubChildPathName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
-      assertEquals("subfolder/subchild", child.getPathName());
-   }
-
-   /**
-    * Test that finding a child and listing its parent result in consistent
-    * child handlers.
-    * 
-    * @throws Exception
-    */
-   public void testSubSubChildPathName() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder/subsubfolder/subsubchild");
-      assertEquals("subfolder/subsubfolder/subsubchild", child.getPathName());
-      VirtualFileHandler parent = context.findChild(root, "subfolder/subsubfolder");
-      List<VirtualFileHandler> children = parent.getChildren(false);
-      // Filter out an .svn stuff since this is run from the source tree
-      Iterator<VirtualFileHandler> iter = children.iterator();
-      while( iter.hasNext() )
-      {
-         child = iter.next();
-         if( child.getName().endsWith(".svn") )
-          iter.remove();
-      }
-      assertEquals("subfolder/subsubfolder has one child", 1, children.size());
-      child = children.get(0);
-      assertEquals("subfolder/subsubfolder/subsubchild", child.getPathName());
-   }
-
-   /* TODO URI testing
-   public void testToURI() throws Exception
-   {
-   }
-   */
-
-   /* TODO URL testing
-   public void testToURL() throws Exception
-   {
-   }
-   */
-   
-   public void testRootLastModified() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      long realLastModified = getRealLastModified("simple", null);
-      // strip any milliseconds
-      realLastModified = realLastModified / 1000 * 1000;
-      long fileLastModified = root.getLastModified();
-      fileLastModified = fileLastModified / 1000 * 1000;
-      assertEquals(realLastModified, fileLastModified);
-   }
-   
-   public void testChildLastModified() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      long realLastModified = getRealLastModified("simple", "child");
-      assertEquals(realLastModified, child.getLastModified());
-   }
-
-   public void testGetLastModifiedClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.getLastModified();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-   
-   public void testRootSize() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      long realSize = getRealSize("simple", null);
-      assertEquals(realSize, root.getSize());
-   }
-   
-   public void testChildSize() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      long realSize = getRealSize("simple", "child");
-      assertEquals(realSize, child.getSize());
-   }
-
-   public void testGetSizeClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.getSize();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-   
-   public void testRootIsLeaf() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      assertFalse(root.isLeaf());
-   }
-
-   public void testChildIsLeaf() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      assertTrue(child.isLeaf());
-   }
-
-   public void testSubFolderIsLeaf() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder");
-      assertFalse(child.isLeaf());
-   }
-
-   public void testSubChildIsLeaf() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
-      assertTrue(child.isLeaf());
-   }
-
-   public void testIsLeafClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.isLeaf();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   // TODO how to test a real hidden file across platforms?
-   public void testRootIsHidden() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      assertFalse(root.isHidden());
-   }
-   
-   // TODO how to test a real hidden file across platforms?
-   public void testChildIsHidden() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      assertFalse(child.isHidden());
-   }
-
-   public void testIsHiddenClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.isHidden();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testOpenStream() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      InputStream stream = child.openStream();
-      try
-      {
-         byte[] contents = new byte[10];
-         int read = stream.read(contents);
-         int total = 0;
-         while (read != -1)
-         {
-            total += read;
-            read = stream.read(contents, total, 10-total);
-         }
-         assertEquals(5, total);
-         assertTrue(Arrays.equals("empty\0\0\0\0\0".getBytes(), contents));
-      }
-      finally
-      {
-         stream.close();
-      }
-   }
-
-   public void testOpenStreamClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.openStream();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testRootParent() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      assertNull(root.getParent());
-   }
-   
-   public void testChildParent() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      assertEquals(root, child.getParent());
-   }
-
-   public void testgetParentClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.getParent();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetChildren() throws Exception
-   {
-      VFSContext context = getVFSContext("children");
-      VirtualFileHandler root = context.getRoot();
-      List<VirtualFileHandler> children = root.getChildren(false);
-      
-      Set<String> expected = new HashSet<String>();
-      expected.add("child1");
-      expected.add("child2");
-      expected.add("child3");
-
-      Set<String> actual = new HashSet<String>();
-      for (VirtualFileHandler child : children)
-      {
-         if (child.getName().startsWith("META-INF") == false && child.getName().equals(".svn") == false)
-            actual.add(child.getName());
-      }
-      
-      assertEquals(expected, actual);
-   }
-
-   public void testGetChildrenClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.getChildren(false);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testFindChildRoot() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = root.findChild("");
-      assertEquals(root, found);
-   }
-
-   public void testFindChild() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = root.findChild("child");
-      assertEquals("child", found.getPathName());
-   }
-
-   public void testFindChildSubFolder() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = root.findChild("subfolder");
-      assertEquals("subfolder", found.getPathName());
-   }
-
-   public void testFindChildSubChild() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler found = root.findChild("subfolder/subchild");
-      assertEquals("subfolder/subchild", found.getPathName());
-   }
-
-   public void testFindChildDoesNotExist() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      try
-      {
-         root.findChild("doesnotexist");
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowableTemp(IOException.class, t);
-      }
-   }
-
-   public void testFindChildNullPath() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      try
-      {
-         root.findChild(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testFindChildClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.findChild("");
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetVFSContext() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler handler = context.getRoot();
-      assertEquals(context, handler.getVFSContext());
-   }
-
-   public void testGetVFSContextClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.getVFSContext();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-  
-   public void testRootGetVirtualFile() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      checkVirtualFile(root);
-   }
-
-   public void testChildGetVirtualFile() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      checkVirtualFile(child);
-   }
-
-   public void testSubFolderGetVirtualFile() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder");
-      checkVirtualFile(child);
-   }
-
-   public void testSubChildGetVirtualFile() throws Exception
-   {
-      VFSContext context = getVFSContext("complex");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
-      checkVirtualFile(child);
-   }
-
-   public void testGetVirtualFileClosed() throws Exception
-   {
-      VFSContext context = getVFSContext("simple");
-      VirtualFileHandler root = context.getRoot();
-      VirtualFileHandler child = context.findChild(root, "child");
-      child.close();
-      try
-      {
-         child.getVirtualFile();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   protected void checkVirtualFile(VirtualFileHandler handler) throws Exception
-   {
-      VirtualFile file = handler.getVirtualFile();
-      
-      assertEquals(handler.getVFSContext().getVFS(), file.getVFS());
-      assertEquals(handler.getName(), file.getName());
-      assertEquals(handler.getPathName(), file.getPathName());
-      assertEquals(handler.isHidden(), file.isHidden());
-      assertEquals(handler.isLeaf(), file.isLeaf());
-      assertEquals(handler.getLastModified(), file.getLastModified());
-      assertEquals(handler.getSize(), file.getSize());
-
-      // can't do this anymore as VirtualFile.toURL() returns a vfs based url
-      //assertEquals(handler.toURI(), file.toURI());
-      //assertEquals(handler.toURL(), file.toURL());
-      
-      VirtualFileHandler parent = handler.getParent();
-      if (parent == null)
-         assertNull(file.getParent());
-      else
-         assertEquals(parent.getVirtualFile(), file.getParent());
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,601 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractVirtualFileHandlerTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractVirtualFileHandlerTest extends AbstractVFSTest
+{
+   public AbstractVirtualFileHandlerTest(String name)
+   {
+      super(name);
+   }
+   
+   protected abstract VFSContext getVFSContext(String name) throws Exception;
+
+   protected String getRootName(String name) throws Exception
+   {
+      return name;
+   }
+   
+   protected abstract long getRealLastModified(String name, String path) throws Exception;
+   
+   protected abstract long getRealSize(String name, String path) throws Exception;
+   
+   public void testRootName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      String rootName = getRootName("complex");
+      assertEquals(rootName, root.getName());
+   }
+
+   public void testChildName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      assertEquals("child", child.getName());
+   }
+
+   public void testSubFolderName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder");
+      assertEquals("subfolder", child.getName());
+   }
+
+   public void testSubChildName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
+      assertTrue(child.getName().endsWith("subchild"));
+   }
+   
+   public void testRootPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      assertEquals("", root.getPathName());
+   }
+
+   public void testChildPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      assertEquals("child", child.getPathName());
+   }
+
+   public void testSubFolderPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder");
+      assertEquals("subfolder", child.getPathName());
+   }
+
+   public void testSubChildPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
+      assertEquals("subfolder/subchild", child.getPathName());
+   }
+
+   /**
+    * Test that finding a child and listing its parent result in consistent
+    * child handlers.
+    * 
+    * @throws Exception
+    */
+   public void testSubSubChildPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder/subsubfolder/subsubchild");
+      assertEquals("subfolder/subsubfolder/subsubchild", child.getPathName());
+      VirtualFileHandler parent = context.getChild(root, "subfolder/subsubfolder");
+      List<VirtualFileHandler> children = parent.getChildren(false);
+      // Filter out an .svn stuff since this is run from the source tree
+      Iterator<VirtualFileHandler> iter = children.iterator();
+      while( iter.hasNext() )
+      {
+         child = iter.next();
+         if( child.getName().endsWith(".svn") )
+          iter.remove();
+      }
+      assertEquals("subfolder/subsubfolder has one child", 1, children.size());
+      child = children.get(0);
+      assertEquals("subfolder/subsubfolder/subsubchild", child.getPathName());
+   }
+
+   /* TODO URI testing
+   public void testToURI() throws Exception
+   {
+   }
+   */
+
+   /* TODO URL testing
+   public void testToURL() throws Exception
+   {
+   }
+   */
+   
+   public void testRootLastModified() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      long realLastModified = getRealLastModified("simple", null);
+      // strip any milliseconds
+      realLastModified = realLastModified / 1000 * 1000;
+      long fileLastModified = root.getLastModified();
+      fileLastModified = fileLastModified / 1000 * 1000;
+      assertEquals(realLastModified, fileLastModified);
+   }
+   
+   public void testChildLastModified() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      long realLastModified = getRealLastModified("simple", "child");
+      assertEquals(realLastModified, child.getLastModified());
+   }
+
+   public void testGetLastModifiedClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.getLastModified();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   public void testRootSize() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      long realSize = getRealSize("simple", null);
+      assertEquals(realSize, root.getSize());
+   }
+   
+   public void testChildSize() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      long realSize = getRealSize("simple", "child");
+      assertEquals(realSize, child.getSize());
+   }
+
+   public void testGetSizeClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.getSize();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   public void testRootIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      assertFalse(root.isLeaf());
+   }
+
+   public void testChildIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      assertTrue(child.isLeaf());
+   }
+
+   public void testSubFolderIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder");
+      assertFalse(child.isLeaf());
+   }
+
+   public void testSubChildIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
+      assertTrue(child.isLeaf());
+   }
+
+   public void testIsLeafClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.isLeaf();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   // TODO how to test a real hidden file across platforms?
+   public void testRootIsHidden() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      assertFalse(root.isHidden());
+   }
+   
+   // TODO how to test a real hidden file across platforms?
+   public void testChildIsHidden() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      assertFalse(child.isHidden());
+   }
+
+   public void testIsHiddenClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.isHidden();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testOpenStream() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      InputStream stream = child.openStream();
+      try
+      {
+         byte[] contents = new byte[10];
+         int read = stream.read(contents);
+         int total = 0;
+         while (read != -1)
+         {
+            total += read;
+            read = stream.read(contents, total, 10-total);
+         }
+         assertEquals(5, total);
+         assertTrue(Arrays.equals("empty\0\0\0\0\0".getBytes(), contents));
+      }
+      finally
+      {
+         stream.close();
+      }
+   }
+
+   public void testOpenStreamClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.openStream();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testRootParent() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      assertNull(root.getParent());
+   }
+   
+   public void testChildParent() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      assertEquals(root, child.getParent());
+   }
+
+   public void testgetParentClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.getParent();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetChildren() throws Exception
+   {
+      VFSContext context = getVFSContext("children");
+      VirtualFileHandler root = context.getRoot();
+      List<VirtualFileHandler> children = root.getChildren(false);
+      
+      Set<String> expected = new HashSet<String>();
+      expected.add("child1");
+      expected.add("child2");
+      expected.add("child3");
+
+      Set<String> actual = new HashSet<String>();
+      for (VirtualFileHandler child : children)
+      {
+         if (child.getName().startsWith("META-INF") == false && child.getName().equals(".svn") == false)
+            actual.add(child.getName());
+      }
+      
+      assertEquals(expected, actual);
+   }
+
+   public void testGetChildrenClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.getChildren(false);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testFindChildRoot() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.getChild("");
+      assertEquals(root, found);
+   }
+
+   public void testFindChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.getChild("child");
+      assertEquals("child", found.getPathName());
+   }
+
+   public void testFindChildSubFolder() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.getChild("subfolder");
+      assertEquals("subfolder", found.getPathName());
+   }
+
+   public void testFindChildSubChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.getChild("subfolder/subchild");
+      assertEquals("subfolder/subchild", found.getPathName());
+   }
+
+   public void testFindChildDoesNotExist() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         VirtualFileHandler child = root.getChild("doesnotexist");
+         assertNull(child);
+      }
+      catch (Throwable t)
+      {
+         checkThrowableTemp(IOException.class, t);
+      }
+   }
+
+   public void testFindChildNullPath() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         root.getChild(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.getChild("");
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetVFSContext() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler handler = context.getRoot();
+      assertEquals(context, handler.getVFSContext());
+   }
+
+   public void testGetVFSContextClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.getVFSContext();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+  
+   public void testRootGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      checkVirtualFile(root);
+   }
+
+   public void testChildGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      checkVirtualFile(child);
+   }
+
+   public void testSubFolderGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder");
+      checkVirtualFile(child);
+   }
+
+   public void testSubChildGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
+      checkVirtualFile(child);
+   }
+
+   public void testGetVirtualFileClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.getChild(root, "child");
+      child.close();
+      try
+      {
+         child.getVirtualFile();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   protected void checkVirtualFile(VirtualFileHandler handler) throws Exception
+   {
+      VirtualFile file = handler.getVirtualFile();
+      
+      assertEquals(handler.getVFSContext().getVFS(), file.getVFS());
+      assertEquals(handler.getName(), file.getName());
+      assertEquals(handler.getPathName(), file.getPathName());
+      assertEquals(handler.isHidden(), file.isHidden());
+      assertEquals(handler.isLeaf(), file.isLeaf());
+      assertEquals(handler.getLastModified(), file.getLastModified());
+      assertEquals(handler.getSize(), file.getSize());
+
+      // can't do this anymore as VirtualFile.toURL() returns a vfs based url
+      //assertEquals(handler.toURI(), file.toURI());
+      //assertEquals(handler.toURL(), file.toURL());
+      
+      VirtualFileHandler parent = handler.getParent();
+      if (parent == null)
+         assertNull(file.getParent());
+      else
+         assertEquals(parent.getVirtualFile(), file.getParent());
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,262 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import junit.framework.TestCase;
-
-import java.util.regex.Pattern;
-import java.util.List;
-
-import org.jboss.virtual.plugins.context.vfs.AssembledDirectory;
-import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class AssembledContextTest extends TestCase
-{
-   public void testRegex()
-   {
-      String[] files = {".java", "x.java", "FooBar.java"};
-      String expression = "*.java";
-      Pattern p = AssembledDirectory.getPattern(expression);
-      System.out.println("pattern: " + p.pattern());
-      for (String file : files)
-      {
-         assertTrue(p.matcher(file).matches());
-      }
-      System.out.println("no matches");
-      p  = AssembledDirectory.getPattern("?.java");
-      assertTrue(p.matcher("x.java").matches());
-      assertFalse(p.matcher("xyz.java").matches());
-      assertFalse(p.matcher(".java").matches());
-
-      p = AssembledDirectory.getPattern("x?z*.java");
-      assertTrue(p.matcher("xyz.java").matches());
-      assertTrue(p.matcher("xyzasdfasdf.java").matches());
-      assertFalse(p.matcher("xyzadasdfasdf").matches());
-      assertFalse(p.matcher("xzadasdfasdf").matches());
-      System.out.println("done it");
-   }
-
-   public void testAntMatching()
-   {
-      String file;
-      String exp;
-      file = "xabc/foobar/test.java";
-      exp = "?abc/*/*.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "abc/foobar/test.java";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-      file = "xabc/x/test.xml";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-      file = "xabc/test.java";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-
-
-      exp = "org/jboss/Test.java";
-      file = "org/jboss/Test.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-
-      exp = "org/jboss/Test.java";
-      file = "org/wrong.java";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-
-      exp = "test/**";
-      file = "test/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "test/foo/bar/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "x.java";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-
-      exp = "**/CVS/*";
-      file = "CVS/Repository";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "org/apache/CVS/Entries";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "org/apache/jakarta/tools/ant/CVS/Entries";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "org/apache/CVS/foo/bar/Entries";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-
-      exp = "org/apache/jakarta/**";
-      file ="org/apache/jakarta/tools/ant/docs/index.html";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file ="org/apache/jakarta/test.xml";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "org/apache/xyz.java";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-
-      exp = "org/apache/**/CVS/*";
-      file ="org/apache/CVS/Entries";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file ="org/apache/jakarta/tools/ant/CVS/Entries";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "org/apache/CVS/foo/bar/Entries";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-      file = "org/apache/nada/foo/bar/Entries";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-
-      exp = "**/test/**";
-      file = "test/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "test/bar/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "test/bar/foo/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "foo/test/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "foo/bar/test/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "foo/test/bar/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "foo/bar/test/bar/foo/x.java";
-      assertTrue(AssembledDirectory.antMatch(file, exp));
-      file = "foo/bar/flah.java";
-      assertFalse(AssembledDirectory.antMatch(file, exp));
-   }
-
-   public void testAddClass() throws Exception
-   {
-      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
-      directory.addClass(VirtualFile.class);
-
-
-      List<VirtualFile> children = directory.getChildren();
-      assertEquals(children.size(), 1);
-      VirtualFile curr = children.get(0);
-      System.out.println("test org/");
-      assertEquals("org", curr.getName());
-
-      System.out.println("test org/jboss");
-      children = curr.getChildren();
-      assertEquals(children.size(), 1);
-      curr = children.get(0);
-      assertEquals("jboss", curr.getName());
-
-      System.out.println("test org/jboss/virtual");
-      children = curr.getChildren();
-      assertEquals(children.size(), 1);
-      curr = children.get(0);
-      assertEquals("virtual", curr.getName());
-      children = curr.getChildren();
-      boolean found;
-      found = false;
-      for (VirtualFile child: children)
-      {
-         if (child.getName().equals("VirtualFile.class"))
-         {
-            found = true;
-            assertEquals("org/jboss/virtual/VirtualFile.class", child.getPathName());
-            break;
-         }
-      }
-      assertTrue("VirtualFile.class was found", found);
-   }
-
-   public void testAddResources() throws Exception
-   {
-      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
-      String[] includes = {"org/jboss/virtual/*.class", "org/jboss/virtual/**/context/jar/*.class"};
-      String[] excludes = {"**/Nested*"};
-      directory.addResources("org/jboss/virtual/VirtualFile.class", includes, excludes, Thread.currentThread().getContextClassLoader());
-      List<VirtualFile> children = directory.getChildren();
-      assertEquals(children.size(), 1);
-      VirtualFile curr = children.get(0);
-      System.out.println("test org/");
-      assertEquals("org", curr.getName());
-
-      System.out.println("test org/jboss");
-      children = curr.getChildren();
-      assertEquals(children.size(), 1);
-      curr = children.get(0);
-      assertEquals("jboss", curr.getName());
-
-      System.out.println("test org/jboss/virtual");
-      children = curr.getChildren();
-      assertEquals(children.size(), 1);
-      curr = children.get(0);
-      assertEquals("virtual", curr.getName());
-      children = curr.getChildren();
-      boolean found;
-      found = false;
-      for (VirtualFile child: children)
-      {
-         if (child.getName().equals("VFS.class"))
-         {
-            found = true;
-            break;
-         }
-      }
-      assertTrue("VFS.class was found", found);
-
-      found = false;
-      for (VirtualFile child: children)
-      {
-         if (child.getName().equals("VirtualFile.class"))
-         {
-            found = true;
-            assertEquals("org/jboss/virtual/VirtualFile.class", child.getPathName());
-            break;
-         }
-      }
-      assertTrue("VirtualFile.class was found", found);
-
-      found = false;
-      VirtualFile plugins = null;
-      for (VirtualFile child: children)
-      {
-         if (child.getName().equals("plugins"))
-         {
-            plugins = child;
-            found = true;
-            break;
-         }
-      }
-      assertTrue("plugins/", found);
-
-      System.out.println("Test org/jboss/virtual/plugins/context/jar");
-      VirtualFile jar = directory.findChild("org/jboss/virtual/plugins/context/jar");
-      assertNotNull(jar);
-      assertEquals("jar", jar.getName());
-
-      children = jar.getChildren();
-      for (VirtualFile child: children)
-      {
-         if (child.getName().startsWith("Nested")) throw new RuntimeException("did not exclude propertly");
-      }
-      AssembledContextFactory.getInstance().remove(directory);
-   }
-
-   public void testMkDir() throws Exception
-   {
-      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
-      directory.mkdir("META-INF");
-      assertNotNull(directory.findChild("META-INF"));
-
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,259 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+import junit.framework.TestCase;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
+import org.jboss.virtual.plugins.context.vfs.AssembledDirectory;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class AssembledContextTest extends TestCase
+{
+   public void testRegex()
+   {
+      String[] files = {".java", "x.java", "FooBar.java"};
+      String expression = "*.java";
+      Pattern p = AssembledDirectory.getPattern(expression);
+      System.out.println("pattern: " + p.pattern());
+      for (String file : files)
+      {
+         assertTrue(p.matcher(file).matches());
+      }
+      System.out.println("no matches");
+      p  = AssembledDirectory.getPattern("?.java");
+      assertTrue(p.matcher("x.java").matches());
+      assertFalse(p.matcher("xyz.java").matches());
+      assertFalse(p.matcher(".java").matches());
+
+      p = AssembledDirectory.getPattern("x?z*.java");
+      assertTrue(p.matcher("xyz.java").matches());
+      assertTrue(p.matcher("xyzasdfasdf.java").matches());
+      assertFalse(p.matcher("xyzadasdfasdf").matches());
+      assertFalse(p.matcher("xzadasdfasdf").matches());
+      System.out.println("done it");
+   }
+
+   public void testAntMatching()
+   {
+      String file;
+      String exp;
+      file = "xabc/foobar/test.java";
+      exp = "?abc/*/*.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "abc/foobar/test.java";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+      file = "xabc/x/test.xml";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+      file = "xabc/test.java";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+
+
+      exp = "org/jboss/Test.java";
+      file = "org/jboss/Test.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+
+      exp = "org/jboss/Test.java";
+      file = "org/wrong.java";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+
+      exp = "test/**";
+      file = "test/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "test/foo/bar/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "x.java";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+
+      exp = "**/CVS/*";
+      file = "CVS/Repository";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "org/apache/CVS/Entries";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "org/apache/jakarta/tools/ant/CVS/Entries";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "org/apache/CVS/foo/bar/Entries";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+
+      exp = "org/apache/jakarta/**";
+      file ="org/apache/jakarta/tools/ant/docs/index.html";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file ="org/apache/jakarta/test.xml";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "org/apache/xyz.java";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+
+      exp = "org/apache/**/CVS/*";
+      file ="org/apache/CVS/Entries";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file ="org/apache/jakarta/tools/ant/CVS/Entries";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "org/apache/CVS/foo/bar/Entries";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+      file = "org/apache/nada/foo/bar/Entries";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+
+      exp = "**/test/**";
+      file = "test/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "test/bar/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "test/bar/foo/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "foo/test/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "foo/bar/test/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "foo/test/bar/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "foo/bar/test/bar/foo/x.java";
+      assertTrue(AssembledDirectory.antMatch(file, exp));
+      file = "foo/bar/flah.java";
+      assertFalse(AssembledDirectory.antMatch(file, exp));
+   }
+
+   public void testAddClass() throws Exception
+   {
+      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
+      directory.addClass(VirtualFile.class);
+
+
+      List<VirtualFile> children = directory.getChildren();
+      assertEquals(children.size(), 1);
+      VirtualFile curr = children.get(0);
+      System.out.println("test org/");
+      assertEquals("org", curr.getName());
+
+      System.out.println("test org/jboss");
+      children = curr.getChildren();
+      assertEquals(children.size(), 1);
+      curr = children.get(0);
+      assertEquals("jboss", curr.getName());
+
+      System.out.println("test org/jboss/virtual");
+      children = curr.getChildren();
+      assertEquals(children.size(), 1);
+      curr = children.get(0);
+      assertEquals("virtual", curr.getName());
+      children = curr.getChildren();
+      boolean found;
+      found = false;
+      for (VirtualFile child: children)
+      {
+         if (child.getName().equals("VirtualFile.class"))
+         {
+            found = true;
+            assertEquals("org/jboss/virtual/VirtualFile.class", child.getPathName());
+            break;
+         }
+      }
+      assertTrue("VirtualFile.class was found", found);
+   }
+
+   public void testAddResources() throws Exception
+   {
+      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
+      String[] includes = {"org/jboss/virtual/*.class", "org/jboss/virtual/**/context/jar/*.class"};
+      String[] excludes = {"**/Nested*"};
+      directory.addResources("org/jboss/virtual/VirtualFile.class", includes, excludes, Thread.currentThread().getContextClassLoader());
+      List<VirtualFile> children = directory.getChildren();
+      assertEquals(children.size(), 1);
+      VirtualFile curr = children.get(0);
+      System.out.println("test org/");
+      assertEquals("org", curr.getName());
+
+      System.out.println("test org/jboss");
+      children = curr.getChildren();
+      assertEquals(children.size(), 1);
+      curr = children.get(0);
+      assertEquals("jboss", curr.getName());
+
+      System.out.println("test org/jboss/virtual");
+      children = curr.getChildren();
+      assertEquals(children.size(), 1);
+      curr = children.get(0);
+      assertEquals("virtual", curr.getName());
+      children = curr.getChildren();
+      boolean found;
+      found = false;
+      for (VirtualFile child: children)
+      {
+         if (child.getName().equals("VFS.class"))
+         {
+            found = true;
+            break;
+         }
+      }
+      assertTrue("VFS.class was found", found);
+
+      found = false;
+      for (VirtualFile child: children)
+      {
+         if (child.getName().equals("VirtualFile.class"))
+         {
+            found = true;
+            assertEquals("org/jboss/virtual/VirtualFile.class", child.getPathName());
+            break;
+         }
+      }
+      assertTrue("VirtualFile.class was found", found);
+
+      found = false;
+      for (VirtualFile child: children)
+      {
+         if (child.getName().equals("plugins"))
+         {
+            found = true;
+            break;
+         }
+      }
+      assertTrue("plugins/", found);
+
+      System.out.println("Test org/jboss/virtual/plugins/context/jar");
+      VirtualFile jar = directory.findChild("org/jboss/virtual/plugins/context/jar");
+      assertNotNull(jar);
+      assertEquals("jar", jar.getName());
+
+      children = jar.getChildren();
+      for (VirtualFile child: children)
+      {
+         if (child.getName().startsWith("Nested")) throw new RuntimeException("did not exclude propertly");
+      }
+      AssembledContextFactory.getInstance().remove(directory);
+   }
+
+   public void testMkDir() throws Exception
+   {
+      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
+      directory.mkdir("META-INF");
+      assertNotNull(directory.findChild("META-INF"));
+
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,1379 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.virtual.test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.ZipInputStream;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.jboss.test.BaseTestCase;
-import org.jboss.test.virtual.support.ClassPathIterator;
-import org.jboss.test.virtual.support.ClassPathIterator.ClassPathEntry;
-import org.jboss.test.virtual.support.MetaDataMatchFilter;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.context.jar.NestedJarFromStream;
-import org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter;
-import org.jboss.virtual.spi.LinkInfo;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactory;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Tests of the VFS implementation
- * 
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision: 55523 $
- */
-public class FileVFSUnitTestCase extends BaseTestCase
-{
-   public FileVFSUnitTestCase(String name)
-   {
-      super(name);
-   }
-   
-   public static Test suite()
-   {
-      return new TestSuite(FileVFSUnitTestCase.class);
-   }
-
-   /**
-    * Test that a VFSContextFactory can be created from the testcase CodeSource url
-    * @throws Exception
-    */
-   public void testVFSContextFactory()
-      throws Exception
-   {
-      URL root = getClass().getProtectionDomain().getCodeSource().getLocation();
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(root);
-      assertTrue("VFSContextFactory(CodeSource.Location) != null", factory != null);
-   }
-
-   /**
-    * Test that one can go from a file uri to VirtualFile and obtain the
-    * same VirtualFile using VirtualFile vfsfile uri
-    * @throws Exception
-    */
-   public void testVFSFileURIFactory()
-      throws Exception
-   {
-      URL rootURL = getClass().getProtectionDomain().getCodeSource().getLocation();
-      VFS rootVFS0 = VFS.getVFS(rootURL.toURI());
-      VirtualFile root0 = rootVFS0.getRoot();
-      VFS rootVFS1 = VFS.getVFS(root0.toURI());
-      VirtualFile root1 = rootVFS1.getRoot();
-      assertEquals(root0, root1);
-   }
-
-   /**
-    * Test that NestedJarFromStream can provide access to nested jar content
-    * @throws Exception
-    */
-   public void testNestedJarFromStream()
-      throws Exception
-   {
-      URL outer = getResource("/vfs/test/outer.jar");
-      String path = outer.getPath();
-      File outerJar = new File(path);
-      assertTrue(outerJar.getAbsolutePath()+" exists", outerJar.exists());
-      JarFile jf = new JarFile(outerJar);
-
-      URL rootURL = outerJar.getParentFile().toURL();
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
-      VFSContext context = factory.getVFS(rootURL);
-
-      JarEntry jar1 = jf.getJarEntry("jar1.jar");
-      URL jar1URL = new URL(outerJar.toURL(), "jar1.jar");
-      VFSContextFactory pf1 = VFSContextFactoryLocator.getFactory(jar1URL);
-      VFSContext parent1 = pf1.getVFS(jar1URL);
-
-      ZipInputStream jis1 = new ZipInputStream(jf.getInputStream(jar1));
-      NestedJarFromStream njfs = new NestedJarFromStream(context, parent1.getRoot(), jis1, jar1URL, jf, jar1, "jar1.jar");
-      VirtualFileHandler e1 = njfs.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
-      assertNotNull(e1);
-      log.info("org/jboss/test/vfs/support/CommonClass.class: "+e1);
-      VirtualFileHandler mfe1 = njfs.findChild("META-INF/MANIFEST.MF");
-      assertNotNull("jar1!/META-INF/MANIFEST.MF", mfe1);
-      InputStream mfIS = mfe1.openStream();
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String title1 = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals("jar1", title1);
-      mfIS.close();
-      njfs.close();
-
-      JarEntry jar2 = jf.getJarEntry("jar2.jar");
-      URL jar2URL = new URL(outerJar.toURL(), "jar2.jar");
-      VFSContextFactory pf2 = VFSContextFactoryLocator.getFactory(jar2URL);
-      VFSContext parent2 = pf2.getVFS(jar2URL);
-
-      ZipInputStream jis2 = new ZipInputStream(jf.getInputStream(jar2));
-      NestedJarFromStream njfs2 = new NestedJarFromStream(context, parent2.getRoot(), jis2, jar2URL, jf, jar2, "jar2.jar");
-      VirtualFileHandler e2 = njfs2.findChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
-      assertNotNull(e2);
-      log.info("org/jboss/test/vfs/support/CommonClass.class: "+e2);
-      VirtualFileHandler mfe2 = njfs2.findChild("META-INF/MANIFEST.MF");
-      assertNotNull("jar2!/META-INF/MANIFEST.MF", mfe2);
-      InputStream mf2IS = mfe2.openStream();
-      Manifest mf2 = new Manifest(mf2IS);
-      Attributes mainAttrs2 = mf2.getMainAttributes();
-      String title2 = mainAttrs2.getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals("jar2", title2);
-      mf2IS.close();
-      njfs2.close();
-   }
-
-   /**
-    * Test reading the contents of nested jar entries.
-    * @throws Exception
-    */
-   public void testInnerJarFile()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile outerjar = vfs.findChild("outer.jar");
-      assertTrue("outer.jar != null", outerjar != null);
-      VirtualFile jar1 = outerjar.findChild("jar1.jar");
-      assertTrue("outer.jar/jar1.jar != null", jar1 != null);
-      VirtualFile jar2 = outerjar.findChild("jar2.jar");
-      assertTrue("outer.jar/jar2.jar != null", jar2 != null);
-
-      VirtualFile jar1MF = jar1.findChild("META-INF/MANIFEST.MF");
-      assertNotNull("jar1!/META-INF/MANIFEST.MF", jar1MF);
-      InputStream mfIS = jar1MF.openStream();
-      Manifest mf1 = new Manifest(mfIS);
-      Attributes mainAttrs1 = mf1.getMainAttributes();
-      String title1 = mainAttrs1.getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals("jar1", title1);
-      jar1MF.close();
-
-      VirtualFile jar2MF = jar2.findChild("META-INF/MANIFEST.MF");
-      assertNotNull("jar2!/META-INF/MANIFEST.MF", jar2MF);
-      InputStream mfIS2 = jar2MF.openStream();
-      Manifest mf2 = new Manifest(mfIS2);
-      Attributes mainAttrs2 = mf2.getMainAttributes();
-      String title2 = mainAttrs2.getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals("jar2", title2);
-      jar2MF.close();
-   }
-
-   /**
-    * Basic tests of accessing resources in a jar
-    * @throws Exception
-    */
-   public void testFindResource()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile jar = vfs.findChild("outer.jar");
-      assertTrue("outer.jar != null", jar != null);
-
-      /*
-      ArrayList<String> searchCtx = new ArrayList<String>();
-      searchCtx.add("outer.jar");
-      VirtualFile metaInf = vfs.resolveFile("META-INF/MANIFEST.MF", searchCtx);
-      */
-      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
-      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
-      InputStream mfIS = metaInf.openStream();
-      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
-      assertEquals("1.0.0.GA", version);
-      mfIS.close();
-   }
-
-   /**
-    * Basic tests of accessing resources in a jar
-    * @throws Exception
-    */
-   public void testFindResourceUsingURLStream()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile jar = vfs.findChild("outer.jar");
-      assertTrue("outer.jar != null", jar != null);
-
-      /*
-      ArrayList<String> searchCtx = new ArrayList<String>();
-      searchCtx.add("outer.jar");
-      VirtualFile metaInf = vfs.resolveFile("META-INF/MANIFEST.MF", searchCtx);
-      */
-      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
-      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
-      InputStream mfIS = metaInf.toURL().openStream();
-      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
-      assertEquals("1.0.0.GA", version);
-      mfIS.close();
-
-      String urlString = metaInf.toURL().toString();
-      URL mfURL = new URL(urlString);
-      mfIS = mfURL.openStream();
-      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
-      mf = new Manifest(mfIS);
-      mainAttrs = mf.getMainAttributes();
-      version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
-      assertEquals("1.0.0.GA", version);
-      mfIS.close();
-   }
-
-   /**
-    * Basic tests of accessing resources in a jar that does not
-    * have parent directory entries.
-    * @throws Exception
-    */
-   public void testFindResourceInFilesOnlyJar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile jar = vfs.findChild("jar1-filesonly.jar");
-      assertTrue("jar1-filesonly.jar != null", jar != null);
-
-      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
-      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
-      InputStream mfIS = metaInf.toURL().openStream();
-      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
-      assertEquals("1.0.0.GA", version);
-      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals("jar1-filesonly", title);
-      mfIS.close();
-
-      String urlString = metaInf.toURL().toString();
-      URL mfURL = new URL(urlString);
-      mfIS = mfURL.openStream();
-      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
-      mf = new Manifest(mfIS);
-      mainAttrs = mf.getMainAttributes();
-      version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
-      assertEquals("1.0.0.GA", version);
-      title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals("jar1-filesonly", title);
-      mfIS.close();
-   }
-
-   /**
-    * Basic tests of accessing resources in a war that does not
-    * have parent directory entries.
-    * @throws Exception
-    */
-   public void testFindResourceInFilesOnlyWar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      VirtualFile war2 = vfs.findChild("WarDeployApp_web.war");
-      assertTrue("WarDeployApp_web.war != null", war2 != null);
-
-      VirtualFile classes2 = war2.findChild("WEB-INF/classes");
-      assertTrue("WEB-INF/classes != null", classes2 != null);
-      assertTrue("WEB-INF/classes is not a leaf", classes2.isLeaf()==false);
-      classes2 = war2.findChild("WEB-INF/classes");
-      assertTrue("WEB-INF/classes != null", classes2 != null);
-      assertTrue("WEB-INF/classes is not a leaf", classes2.isLeaf()==false);
-
-      VirtualFile HelloJavaBean = classes2.findChild("com/sun/ts/tests/webservices/deploy/warDeploy/HelloJavaBean.class");
-      assertTrue("HelloJavaBean.class != null", HelloJavaBean != null);
-      assertTrue("HelloJavaBean.class is a leaf", HelloJavaBean.isLeaf());
-
-      VirtualFile war = vfs.findChild("filesonly.war");
-      assertTrue("filesonly.war != null", war != null);
-
-      VirtualFile classes = war.findChild("WEB-INF/classes");
-      assertTrue("WEB-INF/classes != null", classes != null);
-      assertTrue("WEB-INF/classes is not a leaf", classes.isLeaf()==false);
-
-      VirtualFile jar1 = war.findChild("WEB-INF/lib/jar1.jar");
-      assertTrue("WEB-INF/lib/jar1.jar != null", jar1 != null);
-      assertTrue("WEB-INF/lib/jar1.jar is not a leaf", jar1.isLeaf()==false);
-      VirtualFile ClassInJar1 = jar1.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
-      assertTrue("ClassInJar1.class != null", ClassInJar1 != null);
-      assertTrue("ClassInJar1.class is a leaf", ClassInJar1.isLeaf());
-
-      VirtualFile metaInf = war.findChild("META-INF/MANIFEST.MF");
-      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
-      InputStream mfIS = metaInf.toURL().openStream();
-      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
-      assertEquals("1.0.0.GA", version);
-      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals("filesonly-war", title);
-      mfIS.close();
-
-      war.findChild("WEB-INF/classes");
-      assertTrue("WEB-INF/classes != null", classes != null);
-      assertTrue("WEB-INF/classes is not a leaf", classes.isLeaf()==false);
-   }
-
-   /**
-    * Validate iterating over a vfs url from a files only war.
-    * 
-    * @throws Exception
-    */
-   public void testFindClassesInFilesOnlyWar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      VirtualFile war = vfs.findChild("filesonly.war");
-      assertTrue("filesonly.war != null", war != null);
-
-      VirtualFile classes = war.findChild("WEB-INF/classes");
-      assertTrue("WEB-INF/classes != null", classes != null);
-      HashSet<String> names = new HashSet<String>();
-      ClassPathIterator iter = new ClassPathIterator(classes.toURL());
-      ClassPathEntry entry = null;
-      while( (entry = iter.getNextEntry()) != null )
-      {
-         names.add(entry.name);
-      }
-      log.debug(names);
-      assertTrue("org/jboss/test/vfs/support/jar1", names.contains("org/jboss/test/vfs/support/jar1"));
-      assertTrue("ClassInJar1.class", names.contains("org/jboss/test/vfs/support/jar1/ClassInJar1.class"));
-      assertTrue("ClassInJar1$InnerClass.class", names.contains("org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class"));
-   }
-
-   public void testFindResourceUnpackedJar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile jar = vfs.findChild("unpacked-outer.jar");
-      assertTrue("unpacked-outer.jar != null", jar != null);
-
-      /**
-      ArrayList<String> searchCtx = new ArrayList<String>();
-      searchCtx.add("unpacked-outer.jar");
-      VirtualFile metaInf = vfs.resolveFile("META-INF/MANIFEST.MF", searchCtx);
-      */
-      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
-      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
-      InputStream mfIS = metaInf.openStream();
-      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
-      assertEquals("1.0.0.GA", version);
-      mfIS.close();
-   }
-
-   /**
-    * Test simple file resolution without search contexts
-    * @throws Exception
-    */
-   public void testResolveFile()
-      throws Exception
-   {
-      log.info("+++ testResolveFile, cwd="+(new File(".").getCanonicalPath()));
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      // Check resolving the root file
-      VirtualFile root = vfs.findChild("");
-      assertEquals("root name", "test", root.getName());
-      assertEquals("root path", "", root.getPathName());
-      assertFalse("root isDirectory", root.isLeaf());
-
-      // Find the outer.jar
-      VirtualFile outerJar = vfs.findChild("outer.jar");
-      assertNotNull("outer.jar", outerJar);
-      assertEquals("outer.jar name", "outer.jar", outerJar.getName());
-      assertEquals("outer.jar path", "outer.jar", outerJar.getPathName());
-      
-      VirtualFile outerJarMF = vfs.findChild("outer.jar/META-INF/MANIFEST.MF");
-      assertNotNull("outer.jar/META-INF/MANIFEST.MF", outerJarMF);
-
-      // Test a non-canonical path
-      rootURL = getResource("/vfs/sundry/../test");
-      // Check resolving the root file
-      root = vfs.findChild("");
-      assertEquals("root name", "test", root.getName());
-      assertEquals("root path", "", root.getPathName());
-      assertFalse("root isDirectory", root.isLeaf());
-   }
-
-   /**
-    * Validate resolving a .class file given a set of search contexts in the
-    * vfs that make up a classpath.
-    * 
-    * @throws Exception
-    */
-   public void testResolveClassFileInClassPath()
-      throws Exception
-   {
-      log.info("+++ testResolveFile, cwd="+(new File(".").getCanonicalPath()));
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      
-      // Find ClassInJar1.class
-      VirtualFile vf = vfs.findChild("jar1.jar"); 
-      VirtualFile c1 = vf.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
-      assertNotNull("ClassInJar1.class VF", c1);
-      log.debug("Found ClassInJar1.class: "+c1);
-
-      // Find ClassInJar1$InnerClass.class
-      VirtualFile c1i = vf.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
-      assertNotNull("ClassInJar1$InnerClass.class VF", c1i);
-      log.debug("Found ClassInJar1$InnerClass.class: "+c1i);
-
-      // Find ClassInJar2.class
-      vf = vfs.findChild("jar2.jar");
-      VirtualFile c2 = vf.findChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
-      assertNotNull("ClassInJar2.class VF", c2);
-      log.debug("Found ClassInJar2.class: "+c2);
-   }
-
-   public void testResolveFileInUnpackedJar()
-      throws Exception
-   {
-      log.info("+++ testResolveFileInUnpackedJar, cwd="+(new File(".").getCanonicalPath()));
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      // Check resolving the root file
-      VirtualFile root = vfs.findChild("");
-      assertEquals("root name", "test", root.getName());
-      assertEquals("root path", "", root.getPathName());
-      assertFalse("root isDirectory", root.isLeaf());
-
-      // Find the outer.jar
-      VirtualFile outerJar = vfs.findChild("unpacked-outer.jar");
-      assertNotNull("unpacked-outer.jar", outerJar);
-      assertEquals("unpacked-outer.jar name", "unpacked-outer.jar", outerJar.getName());
-      assertEquals("unpacked-outer.jar path", "unpacked-outer.jar", outerJar.getPathName());
-      
-      VirtualFile outerJarMF = vfs.findChild("unpacked-outer.jar/META-INF/MANIFEST.MF");
-      assertNotNull("unpacked-outer.jar/META-INF/MANIFEST.MF", outerJarMF);
-
-      // Test a non-canonical path
-      rootURL = getResource("/test/sundry/../test");
-      // Check resolving the root file
-      root = vfs.findChild("");
-      assertEquals("root name", "test", root.getName());
-      assertEquals("root path", "", root.getPathName());
-      assertFalse("root isDirectory", root.isLeaf());
-   }
-
-   /**
-    * Test file resolution with nested jars
-    * @throws Exception
-    */
-   public void testInnerJar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile inner = vfs.findChild("outer.jar/jar1.jar");
-      log.info("IsFile: "+inner.isLeaf());
-      log.info(inner.getLastModified());
-      List<VirtualFile> contents = inner.getChildren();
-      // META-INF/*, org/jboss/test/vfs/support/jar1/* at least
-      assertTrue("jar1.jar children.length("+contents.size()+") >= 2", contents.size() >= 2);
-      for(VirtualFile vf : contents)
-      {
-         log.info("  "+vf.getName());
-      }
-      VirtualFile vf = vfs.findChild("outer.jar/jar1.jar");
-      VirtualFile jar1MF = vf.findChild("META-INF/MANIFEST.MF");
-      InputStream mfIS = jar1MF.openStream();
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1", version);
-      mfIS.close();
-   }
-
-   public void testInnerJarUsingURLStream()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile inner = vfs.findChild("outer.jar/jar1.jar");
-      log.info("IsFile: "+inner.isLeaf());
-      log.info(inner.getLastModified());
-      List<VirtualFile> contents = inner.getChildren();
-      // META-INF/*, org/jboss/test/vfs/support/jar1/* at least
-      assertTrue("jar1.jar children.length("+contents.size()+") >= 2", contents.size() >= 2);
-      for(VirtualFile vf : contents)
-      {
-         log.info("  "+vf.getName());
-      }
-      VirtualFile vf = vfs.findChild("outer.jar/jar1.jar");
-      VirtualFile jar1MF = vf.findChild("META-INF/MANIFEST.MF");
-      InputStream mfIS = jar1MF.toURL().openStream();
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1", version);
-      mfIS.close();
-   }
-
-   /**
-    * Test a scan of the outer.jar vfs to locate all .class files
-    * @throws Exception
-    */
-   public void testClassScan()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test/outer.jar");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      HashSet<String> expectedClasses = new HashSet<String>();
-      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1.class");
-      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
-      expectedClasses.add("jar2.jar/org/jboss/test/vfs/support/jar2/ClassInJar2.class");
-      expectedClasses.add("org/jboss/test/vfs/support/CommonClass.class");
-      super.enableTrace("org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter");
-      SuffixMatchFilter classVisitor = new SuffixMatchFilter(".class", VisitorAttributes.RECURSE);
-      List<VirtualFile> classes = vfs.getChildren(classVisitor);
-      int count = 0;
-      for (VirtualFile cf : classes)
-      {
-         String path = cf.getPathName();
-         if( path.endsWith(".class") )
-         {
-            assertTrue(path, expectedClasses.contains(path));
-            count ++;
-         }
-      }
-      assertEquals("There were 4 classes", 4, count);
-   }
-
-   /**
-    * Test a scan of the unpacked-outer.jar vfs to locate all .class files
-    * @throws Exception
-    */
-   public void testClassScanUnpacked()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test/unpacked-outer.jar");
-      VFS vfs = VFS.getVFS(rootURL);
-   
-      HashSet<String> expectedClasses = new HashSet<String>();
-      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1.class");
-      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
-      expectedClasses.add("jar2.jar/org/jboss/test/vfs/support/jar2/ClassInJar2.class");
-      expectedClasses.add("org/jboss/test/vfs/support/CommonClass.class");
-      super.enableTrace("org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter");
-      SuffixMatchFilter classVisitor = new SuffixMatchFilter(".class", VisitorAttributes.RECURSE);
-      List<VirtualFile> classes = vfs.getChildren(classVisitor);
-      int count = 0;
-      for (VirtualFile cf : classes)
-      {
-         String path = cf.getPathName();
-         if( path.endsWith(".class") )
-         {
-            assertTrue(path, expectedClasses.contains(path));
-            count ++;
-         }
-      }
-      assertEquals("There were 4 classes", 4, count);
-   }
-
-   /**
-    * Test a scan of the jar1-filesonly.jar vfs to locate all .class files
-    * @throws Exception
-    */
-   public void testClassScanFilesonly()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test/jar1-filesonly.jar");
-      VFS vfs = VFS.getVFS(rootURL);
-   
-      HashSet<String> expectedClasses = new HashSet<String>();
-      expectedClasses.add("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
-      expectedClasses.add("org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
-      super.enableTrace("org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter");
-      SuffixMatchFilter classVisitor = new SuffixMatchFilter(".class", VisitorAttributes.RECURSE);
-      List<VirtualFile> classes = vfs.getChildren(classVisitor);
-      int count = 0;
-      for (VirtualFile cf : classes)
-      {
-         String path = cf.getPathName();
-         if( path.endsWith(".class") )
-         {
-            assertTrue(path, expectedClasses.contains(path));
-            count ++;
-         }
-      }
-      assertEquals("There were 2 classes", 2, count);
-
-      // Make sure we can walk path-wise to the class
-      VirtualFile jar1 = vfs.getRoot();
-      VirtualFile parent = jar1;
-      String className = "org/jboss/test/vfs/support/jar1/ClassInJar1.class";
-      VirtualFile ClassInJar1 = vfs.findChild(className);
-      String[] paths = className.split("/");
-      StringBuilder vfsPath = new StringBuilder();
-      for(String path : paths)
-      {
-         vfsPath.append(path);
-         VirtualFile vf = parent.findChild(path);
-         if( path.equals("ClassInJar1.class") )
-            assertEquals("ClassInJar1.class", ClassInJar1, vf);
-         else
-         {
-            assertEquals("vfsPath", vfsPath.toString(), vf.getPathName());
-            assertEquals("lastModified", ClassInJar1.getLastModified(), vf.getLastModified());
-         }
-         vfsPath.append('/');
-         parent = vf;
-      }
-   }
-
-   /**
-    * Test access of directories in a jar that only stores files
-    * @throws Exception
-    */
-   public void testFilesOnlyJar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      VirtualFile jar = vfs.findChild("jar1-filesonly.jar");
-      VirtualFile metadataLocation = jar.findChild("META-INF");
-      assertNotNull(metadataLocation);
-      VirtualFile mfFile = metadataLocation.findChild("MANIFEST.MF");
-      assertNotNull(mfFile);
-      InputStream is = mfFile.openStream();
-      Manifest mf = new Manifest(is);
-      mfFile.close();
-      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1-filesonly", title);
-
-      // Retry starting from the jar root
-      mfFile = jar.findChild("META-INF/MANIFEST.MF");
-      is = mfFile.openStream();
-      mf = new Manifest(is);
-      mfFile.close();
-      title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1-filesonly", title);
-   }
-
-   /**
-    * Test the serialization of VirtualFiles
-    * @throws Exception
-    */
-   public void testVFSerialization()
-      throws Exception
-   {
-      File tmpRoot = File.createTempFile("vfs", ".root");
-      tmpRoot.delete();
-      tmpRoot.mkdir();
-      tmpRoot.deleteOnExit();
-      File tmp = new File(tmpRoot, "vfs.ser");
-      tmp.createNewFile();
-      tmp.deleteOnExit();
-      log.info("+++ testVFSerialization, tmp="+tmp.getCanonicalPath());
-      URL rootURL = tmpRoot.toURL();
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile tmpVF = vfs.findChild("vfs.ser");
-      FileOutputStream fos = new FileOutputStream(tmp);
-      ObjectOutputStream oos = new ObjectOutputStream(fos);
-      oos.writeObject(tmpVF);
-      oos.close();
-
-      // Check the tmpVF attributes against the tmp file
-      long lastModified = tmp.lastModified();
-      long size = tmp.length();
-      String name = tmp.getName();
-      String vfsPath = tmp.getPath();
-      vfsPath = vfsPath.substring(tmpRoot.getPath().length()+1);
-      URL url = new URL("vfs" + tmp.toURL());
-      log.debug("name: "+name);
-      log.debug("vfsPath: "+vfsPath);
-      log.debug("url: "+url);
-      log.debug("lastModified: "+lastModified);
-      log.debug("size: "+size);
-      assertEquals("name", name, tmpVF.getName());
-      assertEquals("pathName", vfsPath, tmpVF.getPathName());
-      assertEquals("lastModified", lastModified, tmpVF.getLastModified());
-      assertEquals("size", size, tmpVF.getSize());
-      assertEquals("url", url, tmpVF.toURL());
-      assertEquals("isLeaf", true, tmpVF.isLeaf());
-      assertEquals("isHidden", false, tmpVF.isHidden());
-
-      // Read in the VF from the serialized file
-      FileInputStream fis = new FileInputStream(tmp);
-      ObjectInputStream ois = new ObjectInputStream(fis);
-      VirtualFile tmpVF2 = (VirtualFile) ois.readObject();
-      ois.close();
-      // Validated the deserialized attribtes against the tmp file
-      assertEquals("name", name, tmpVF2.getName());
-      assertEquals("pathName", vfsPath, tmpVF2.getPathName());
-      assertEquals("lastModified", lastModified, tmpVF2.getLastModified());
-      assertEquals("size", size, tmpVF2.getSize());
-      assertEquals("url", url, tmpVF2.toURL());
-      assertEquals("isLeaf", true, tmpVF2.isLeaf());
-      assertEquals("isHidden", false, tmpVF2.isHidden());
-   }
-
-   /**
-    * Test the serialization of VirtualFiles representing a jar
-    * @throws Exception
-    */
-   public void testVFJarSerialization()
-      throws Exception
-   {
-      File tmpRoot = File.createTempFile("vfs", ".root");
-      tmpRoot.delete();
-      tmpRoot.mkdir();
-      tmpRoot.deleteOnExit();
-      // Create a test jar containing a txt file
-      File tmpJar = new File(tmpRoot, "tst.jar");
-      tmpJar.createNewFile();
-      tmpJar.deleteOnExit();
-      FileOutputStream fos = new FileOutputStream(tmpJar);
-      JarOutputStream jos = new JarOutputStream(fos);
-      // Write a text file to include in a test jar
-      JarEntry txtEntry = new JarEntry("tst.txt");
-      jos.putNextEntry(txtEntry);
-      txtEntry.setSize("testVFJarSerialization".length());
-      txtEntry.setTime(System.currentTimeMillis());
-      jos.write("testVFJarSerialization".getBytes());
-      jos.close();
-      log.info("+++ testVFJarSerialization, tmp="+tmpJar.getCanonicalPath());
-
-      URI rootURI = tmpRoot.toURI();
-      VFS vfs = VFS.getVFS(rootURI);
-      File vfsSer = new File(tmpRoot, "vfs.ser");
-      vfsSer.createNewFile();
-      vfsSer.deleteOnExit();
-
-      VirtualFile tmpVF = vfs.findChild("tst.jar");
-      // Validate the vf jar against the tmp file attributes
-      long lastModified = tmpJar.lastModified();
-      long size = tmpJar.length();
-      String name = tmpJar.getName();
-      String vfsPath = tmpJar.getPath();
-      vfsPath = vfsPath.substring(tmpRoot.getPath().length()+1);
-      URL url = new URL("vfs" + tmpJar.toURL());
-      //url = JarUtils.createJarURL(url);
-      log.debug("name: "+name);
-      log.debug("vfsPath: "+vfsPath);
-      log.debug("url: "+url);
-      log.debug("lastModified: "+lastModified);
-      log.debug("size: "+size);
-      assertEquals("name", name, tmpVF.getName());
-      assertEquals("pathName", vfsPath, tmpVF.getPathName());
-      assertEquals("lastModified", lastModified, tmpVF.getLastModified());
-      assertEquals("size", size, tmpVF.getSize());
-      assertEquals("url", url, tmpVF.toURL());
-      // TODO: these should pass
-      //assertEquals("isFile", true, tmpVF.isFile());
-      //assertEquals("isDirectory", false, tmpVF.isDirectory());
-      assertEquals("isHidden", false, tmpVF.isHidden());
-      // Write out the vfs jar file
-      fos = new FileOutputStream(vfsSer);
-      ObjectOutputStream oos = new ObjectOutputStream(fos);
-      oos.writeObject(tmpVF);
-      oos.close();
-
-      // Read in the VF from the serialized file
-      FileInputStream fis = new FileInputStream(vfsSer);
-      ObjectInputStream ois = new ObjectInputStream(fis);
-      VirtualFile tmpVF2 = (VirtualFile) ois.readObject();
-      ois.close();
-      // Validate the vf jar against the tmp file attributes
-      assertEquals("name", name, tmpVF2.getName());
-      assertEquals("pathName", vfsPath, tmpVF2.getPathName());
-      assertEquals("lastModified", lastModified, tmpVF2.getLastModified());
-      assertEquals("size", size, tmpVF2.getSize());
-      assertEquals("url", url, tmpVF2.toURL());
-      // TODO: these should pass
-      //assertEquals("isFile", true, tmpVF2.isFile());
-      //assertEquals("isDirectory", false, tmpVF2.isDirectory());
-      assertEquals("isHidden", false, tmpVF2.isHidden());
-   }
-
-   /**
-    * Test the serialization of VirtualFiles representing a jar
-    * @throws Exception
-    */
-   public void testVFNestedJarSerialization()
-      throws Exception
-   {
-      // this expects to be run with a working dir of the container root
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile inner = vfs.findChild("outer.jar/jar1.jar");
-
-      File vfsSer = File.createTempFile("testVFNestedJarSerialization", ".ser");
-      vfsSer.deleteOnExit();
-      // Write out the vfs inner jar file
-      FileOutputStream fos = new FileOutputStream(vfsSer);
-      ObjectOutputStream oos = new ObjectOutputStream(fos);
-      oos.writeObject(inner);
-      oos.close();
-      
-      // Read in the VF from the serialized file
-      FileInputStream fis = new FileInputStream(vfsSer);
-      ObjectInputStream ois = new ObjectInputStream(fis);
-      inner = (VirtualFile) ois.readObject();
-      ois.close();
-      List<VirtualFile> contents = inner.getChildren();
-      // META-INF/*, org/jboss/test/vfs/support/jar1/* at least
-      assertTrue("jar1.jar children.length("+contents.size()+") >= 2", contents.size() >= 2);
-      for(VirtualFile vf : contents)
-      {
-         log.info("  "+vf.getName());
-      }
-      VirtualFile vf = vfs.findChild("outer.jar/jar1.jar");
-      VirtualFile jar1MF = vf.findChild("META-INF/MANIFEST.MF");
-      InputStream mfIS = jar1MF.openStream();
-      Manifest mf = new Manifest(mfIS);
-      Attributes mainAttrs = mf.getMainAttributes();
-      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
-      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1", version);
-      mfIS.close();
-   }
-
-   /**
-    * Test parsing of a vfs link properties file. It contains test.classes.url
-    * and test.lib.url system property references that are configured to
-    * point to the CodeSource location of this class and /vfs/sundry/jar/
-    * respectively.
-    * 
-    * @throws Exception
-    */
-   public void testVfsLinkProperties()
-      throws Exception
-   {
-      URL linkURL = super.getResource("/vfs/links/war1.vfslink.properties");
-      assertNotNull("vfs/links/war1.vfslink.properties", linkURL);
-      // Find resources to use as the WEB-INF/{classes,lib} link targets
-      URL classesURL = getClass().getProtectionDomain().getCodeSource().getLocation();
-      assertNotNull("classesURL", classesURL);
-      System.setProperty("test.classes.url", classesURL.toString());
-      URL libURL = super.getResource("/vfs/sundry/jar");
-      assertNotNull("libURL", libURL);      
-      System.setProperty("test.lib.url", libURL.toString());
-
-      assertTrue("isLink", VFSUtils.isLink(linkURL.getPath()));
-      Properties props = new Properties();
-      InputStream linkIS = linkURL.openStream();
-      List<LinkInfo> infos = VFSUtils.readLinkInfo(linkIS, linkURL.getPath(), props);
-      assertEquals("LinkInfo count", 2, infos.size());
-      LinkInfo classesInfo = null;
-      LinkInfo libInfo = null;
-      for(LinkInfo info :infos)
-      {
-         if( info.getName().equals("WEB-INF/classes") )
-            classesInfo = info;
-         else if(info.getName().equals("WEB-INF/lib") )
-            libInfo = info;
-      }
-      assertNotNull("classesInfo", classesInfo);
-      assertEquals("classesInfo.target", classesURL.toURI(), classesInfo.getLinkTarget());
-      assertNotNull("libInfo", libInfo);
-      assertEquals("libInfo.target", libURL.toURI(), libInfo.getLinkTarget());
-   }
-
-   /**
-    * Test the test-link.war link
-    * @throws Exception
-    */
-   public void testWarLink()
-      throws Exception
-   {
-      // Find resources to use as the WEB-INF/{classes,lib} link targets
-      URL classesURL = getClass().getProtectionDomain().getCodeSource().getLocation();
-      assertNotNull("classesURL", classesURL);
-      System.setProperty("test.classes.url", classesURL.toString());
-      URL libURL = super.getResource("/vfs/sundry/jar");
-      assertNotNull("libURL", libURL);      
-      System.setProperty("test.lib.url", libURL.toString());
-
-      // Root the vfs at the link file parent directory
-      URL linkURL = super.getResource("/vfs/links/war1.vfslink.properties");
-      File linkFile = new File(linkURL.toURI());
-      File vfsRoot = linkFile.getParentFile();
-      assertNotNull("vfs/links/war1.vfslink.properties", linkURL);
-      VFS vfs = VFS.getVFS(vfsRoot.toURI());
-
-      // We should find the test-link.war the link represents
-      VirtualFile war = vfs.findChild("test-link.war");
-      assertNotNull("war", war);
-
-      // Validate the WEB-INF/classes child link
-      VirtualFile classes = war.findChild("WEB-INF/classes");
-      String classesName = classes.getName();
-      String classesPathName = classes.getPathName();
-      boolean classesIsDirectory = classes.isLeaf() == false;
-      assertEquals("classes.name", "classes", classesName);
-      assertEquals("classes.pathName", "test-link.war/WEB-INF/classes", classesPathName);
-      assertEquals("classes.isDirectory", true, classesIsDirectory);
-      // Should be able to find this class since classes points to out codesource
-      VirtualFile thisClass = classes.findChild("org/jboss/test/virtual/test/FileVFSUnitTestCase.class");
-      assertEquals("FileVFSUnitTestCase.class", thisClass.getName());
-
-      // Validate the WEB-INF/lib child link
-      VirtualFile lib = war.findChild("WEB-INF/lib");
-      String libName = lib.getName();
-      String libPathName = lib.getPathName();
-      boolean libIsDirectory = lib.isLeaf() == false;
-      assertEquals("lib.name", "lib", libName);
-      assertEquals("lib.pathName", "test-link.war/WEB-INF/lib", libPathName);
-      assertEquals("lib.isDirectory", true, libIsDirectory);
-      // Should be able to find archive.jar under lib
-      VirtualFile archiveJar = lib.findChild("archive.jar");
-      assertEquals("archive.jar", archiveJar.getName());
-   }
-
-  /**
-    * Test that the URL of a VFS corresponding to a directory ends in '/' so that
-    * URLs created relative to it are under the directory. This requires that
-    * build-test.xml artifacts exist.
-    * 
-    * @throws Exception
-    */
-   public void testDirURLs() throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      VirtualFile outerJar = vfs.findChild("unpacked-outer.jar");
-      URL outerURL = outerJar.toURL();
-      log.debug("outerURL: "+outerURL);
-      assertTrue(outerURL+" ends in '/'", outerURL.getPath().endsWith("/"));
-      // Validate that jar1 is under unpacked-outer.jar
-      URL jar1URL = new URL(outerURL, "jar1.jar");
-      log.debug("jar1URL: "+jar1URL+", path="+jar1URL.getPath());
-      assertTrue("jar1URL path ends in unpacked-outer.jar/jar1.jar!/",
-            jar1URL.getPath().endsWith("unpacked-outer.jar/jar1.jar"));
-      VirtualFile jar1 = outerJar.findChild("jar1.jar");
-      assertEquals(jar1URL, jar1.toURL());
-
-      VirtualFile packedJar = vfs.findChild("jar1.jar");
-      jar1URL = packedJar.findChild("org/jboss/test/vfs/support").toURL();
-      assertTrue("Jar directory entry URLs must end in /: " + jar1URL.toString(), jar1URL.toString().endsWith("/"));
-   }
-
-   /**
-    * Test that the URI of a VFS corresponding to a directory ends in '/' so that
-    * URIs created relative to it are under the directory. This requires that
-    * build-test.xml artifacts exist.
-    * 
-    * @throws Exception
-    */
-   public void testDirURIs() throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-
-      VirtualFile outerJar = vfs.findChild("unpacked-outer.jar");
-      URI outerURI = outerJar.toURI();
-      log.debug("outerURI: "+outerURI);
-      assertTrue(outerURI+" ends in '/'", outerURI.getPath().endsWith("/"));
-      // Validate that jar1 is under unpacked-outer.jar
-      URI jar1URI = new URI(outerURI+"jar1.jar");
-      log.debug("jar1URI: "+jar1URI+", path="+jar1URI.getPath());
-      assertTrue("jar1URI path ends in unpacked-outer.jar/jar1.jar!/",
-            jar1URI.getPath().endsWith("unpacked-outer.jar/jar1.jar"));
-      VirtualFile jar1 = outerJar.findChild("jar1.jar");
-      assertEquals(jar1URI, jar1.toURI());
-
-      VirtualFile packedJar = vfs.findChild("jar1.jar");
-      jar1URI = packedJar.findChild("org/jboss/test/vfs/support").toURI();
-      assertTrue("Jar directory entry URLs must end in /: " + jar1URI.toString(),
-            jar1URI.toString().endsWith("/"));
-   }
-
-   /**
-    * Test copying a jar
-    * 
-    * @throws Exception
-    */
-   public void testCopyJar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile jar = vfs.findChild("outer.jar");
-      assertTrue("outer.jar != null", jar != null);
-      File tmpJar = File.createTempFile("testCopyJar", ".jar");
-      tmpJar.deleteOnExit();
-
-      try
-      {
-         InputStream is = jar.openStream();
-         FileOutputStream fos = new FileOutputStream(tmpJar);
-         byte[] buffer = new byte[1024];
-         int read;
-         while( (read = is.read(buffer)) > 0 )
-         {
-            fos.write(buffer, 0, read);
-         }
-         fos.close();
-         log.debug("outer.jar size is: "+jar.getSize());
-         log.debug(tmpJar.getAbsolutePath()+" size is: "+tmpJar.length());
-         assertTrue("outer.jar > 0", jar.getSize() > 0);
-         assertEquals("copy jar size", jar.getSize(), tmpJar.length());
-         jar.close();
-      }
-      finally
-      {
-         try
-         {
-            tmpJar.delete();
-         }
-         catch(Exception ignore)
-         {
-         }
-      }
-   }
-
-   /**
-    * Test copying a jar that is nested in another jar.
-    * 
-    * @throws Exception
-    */
-   public void testCopyInnerJar()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile outerjar = vfs.findChild("outer.jar");
-      assertTrue("outer.jar != null", outerjar != null);
-      VirtualFile jar = outerjar.findChild("jar1.jar");
-      assertTrue("outer.jar/jar1.jar != null", jar != null);
-
-      File tmpJar = File.createTempFile("testCopyInnerJar", ".jar");
-      tmpJar.deleteOnExit();
-
-      try
-      {
-         InputStream is = jar.openStream();
-         FileOutputStream fos = new FileOutputStream(tmpJar);
-         byte[] buffer = new byte[1024];
-         int read;
-         while( (read = is.read(buffer)) > 0 )
-         {
-            fos.write(buffer, 0, read);
-         }
-         fos.close();
-         log.debug("outer.jar/jar1.jar size is: "+jar.getSize());
-         log.debug(tmpJar.getAbsolutePath()+" size is: "+tmpJar.length());
-         assertTrue("outer.jar > 0", jar.getSize() > 0);
-         assertEquals("copy jar size", jar.getSize(), tmpJar.length());
-         jar.close();
-      }
-      finally
-      {
-         try
-         {
-            tmpJar.delete();
-         }
-         catch(Exception ignore)
-         {
-         }
-      }
-   }
-
-   /**
-    * Test that the outermf.jar manifest classpath is parsed
-    * correctly.
-    * 
-    * @throws Exception
-    */
-   public void testManifestClasspath()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile outerjar = vfs.findChild("outermf.jar");
-      assertNotNull("outermf.jar != null", outerjar);
-
-      ArrayList<VirtualFile> cp = new ArrayList<VirtualFile>();
-      VFSUtils.addManifestLocations(outerjar, cp);
-      // The p0.jar should be found in the classpath
-      assertEquals("cp size 2", 2, cp.size());
-      assertEquals("jar1.jar == cp[0]", "jar1.jar", cp.get(0).getName());
-      assertEquals("jar2.jar == cp[1]", "jar2.jar", cp.get(1).getName());
-   }
-   /**
-    * Test that an inner-inner jar that is extracted does not blowup
-    * the addManifestLocations routine.
-    * 
-    * @throws Exception
-    */
-   public void testInnerManifestClasspath()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile outerjar = vfs.findChild("withalong/rootprefix/outermf.jar");
-      VirtualFile conatinerjar = outerjar.findChild("inner-container.jar");
-      VirtualFile innerjar = conatinerjar.findChild("innermf.jar");
-      assertNotNull("innermf.jar != null", innerjar);
-   
-      ArrayList<VirtualFile> cp = new ArrayList<VirtualFile>();
-      VFSUtils.addManifestLocations(innerjar, cp);
-      // Don't really care what the cp is...
-   }
-
-   /**
-    * Validate accessing an packed jar vf and its uri when the vfs path
-    * contains spaces
-    * @throws Exception
-    */
-   public void testJarWithSpacesInPath()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile tstjar = vfs.findChild("path with spaces/tst.jar");
-      assertNotNull("tstjar != null", tstjar);
-      URI uri = tstjar.toURI();
-      URI expectedURI = new URI("vfs"+rootURL.toString()+"/path%20with%20spaces/tst.jar");
-      assertEquals(uri, expectedURI);
-   }
-
-   public static void main(String[] args) throws Exception
-   {
-      File file = new File("C:\\Documents and Settings");
-      System.out.println(file.toURI());
-      System.out.println(file.toURL().getHost());
-      URI uri = new URI("file", null, "/Document and Settings", null);
-      System.out.println(uri);
-   }
-
-   /**
-    * Validate accessing an unpacked jar vf and its uri when the vfs path
-    * contains spaces
-    * @throws Exception
-    */
-   public void testUnpackedJarWithSpacesInPath()
-      throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile tstjar = vfs.findChild("path with spaces/unpacked-tst.jar");
-      assertNotNull("tstjar != null", tstjar);
-      URI uri = tstjar.toURI();
-      URI expectedURI = new URI("vfs" + rootURL.toString()+"/path%20with%20spaces/unpacked-tst.jar/");
-      assertEquals(uri, expectedURI);
-   }
-
-   /**
-    * Tests that we can find the META-INF/some-data.xml in an unpacked deployment
-    * 
-    * @throws Exception for any error
-    */
-   public void testGetMetaDataUnpackedJar() throws Exception
-   {
-      testGetMetaDataFromJar("unpacked-with-metadata.jar");
-   }
-   
-   /**
-    * Tests that we can find the META-INF/some-data.xml in a packed deployment
-    * 
-    * @throws Exception for any error
-    */
-   public void testGetMetaDataPackedJar() throws Exception
-   {
-      testGetMetaDataFromJar("with-metadata.jar");
-   }
-   
-   private void testGetMetaDataFromJar(String name) throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      
-      VirtualFile jar = vfs.findChild(name);
-      assertNotNull(jar);
-      VirtualFile metadataLocation = jar.findChild("META-INF");
-      assertNotNull(metadataLocation);
-
-      VirtualFile metadataByName = metadataLocation.findChild("some-data.xml");
-      assertNotNull(metadataByName);
-      
-      //This is the same code as is called by AbstractDeploymentContext.getMetaDataFiles(String name, String suffix). 
-      //The MetaDataMatchFilter is a copy of the one used there
-      List<VirtualFile> metaDataList = metadataLocation.getChildren(new MetaDataMatchFilter(null, "-data.xml"));
-      assertNotNull(metaDataList);
-      assertEquals("Wrong size", 1, metaDataList.size());
-   }
-
-   /**
-    * Validate that a URLClassLoader.findReource/getResourceAsStream calls for non-existing absolute
-    * resources that should fail as expected with null results. Related to JBMICROCONT-139.
-    * 
-    * @throws Exception
-    */
-   public void testURLClassLoaderFindResourceFailure() throws Exception
-   {
-      URL rootURL = getResource("/vfs/test");
-      VFS vfs = VFS.getVFS(rootURL);
-      URL[] cp = {vfs.getRoot().toURL()};
-      URLClassLoader ucl = new URLClassLoader(cp);
-      // Search for a non-existent absolute resource
-      URL qp = ucl.findResource("/nosuch-quartz.props");
-      assertNull("findResource(/nosuch-quartz.props)", qp);
-      InputStream is = ucl.getResourceAsStream("/nosuch-quartz.props");
-      assertNull("getResourceAsStream(/nosuch-quartz.props)", is);
-   }
-
-   /**
-    * Test VirtualFile.exists for vfsfile based urls.
-    * 
-    * @throws Exception
-    */
-   public void testFileExists()
-      throws Exception
-   {
-      File tmpRoot = File.createTempFile("vfs", ".root");
-      tmpRoot.delete();
-      tmpRoot.mkdir();
-      File tmp = File.createTempFile("testFileExists", null, tmpRoot);
-      log.info("+++ testFileExists, tmp="+tmp.getCanonicalPath());
-
-      URL rootURL = tmpRoot.toURL();
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile tmpVF = vfs.findChild(tmp.getName());
-      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertTrue("tmp.delete()", tmp.delete());
-      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
-   }
-
-   /**
-    * Test VirtualFile.exists for vfsfile based urls for a directory.
-    * 
-    * @throws Exception
-    */
-   public void testDirFileExists()
-      throws Exception
-   {
-      File tmpRoot = File.createTempFile("vfs", ".root");
-      tmpRoot.delete();
-      tmpRoot.mkdir();
-      File tmp = File.createTempFile("testFileExists", null, tmpRoot);
-      assertTrue(tmp+".delete()", tmp.delete());
-      assertTrue(tmp+".mkdir()", tmp.mkdir());
-      log.info("+++ testDirFileExists, tmp="+tmp.getCanonicalPath());
-
-      URL rootURL = tmpRoot.toURL();
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile tmpVF = vfs.findChild(tmp.getName());
-      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertFalse(tmpVF.getPathName()+".isLeaf()", tmpVF.isLeaf());
-      assertTrue(tmp+".delete()", tmp.delete());
-      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
-   }
-
-   /**
-    * Test VirtualFile.exists for vfsjar based urls.
-    * 
-    * @throws Exception
-    */
-   public void testJarExists()
-      throws Exception
-   {
-      File tmpRoot = File.createTempFile("vfs", ".root");
-      tmpRoot.delete();
-      tmpRoot.mkdir();
-      File tmpJar = File.createTempFile("testJarExists", ".jar", tmpRoot);
-      log.info("+++ testJarExists, tmpJar="+tmpJar.getCanonicalPath());
-      Manifest mf = new Manifest();
-      mf.getMainAttributes().putValue("Created-By", "FileVFSUnitTestCase.testJarExists");
-      FileOutputStream fos = new FileOutputStream(tmpJar);
-      JarOutputStream jos = new JarOutputStream(fos, mf);
-      jos.setComment("testJarExists");
-      jos.setLevel(0);
-      jos.close();
-
-      URL rootURL = tmpRoot.toURL();
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile tmpVF = vfs.findChild(tmpJar.getName());
-      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertTrue(tmpVF.getPathName()+".size() > 0", tmpVF.getSize() > 0);
-      assertTrue("tmp.delete()", tmpJar.delete());
-      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
-   }
-
-   /**
-    * Test VirtualFile.exists for vfsjar based urls for a directory.
-    * 
-    * @throws Exception
-    */
-   public void testDirJarExists()
-      throws Exception
-   {
-      File tmpRoot = File.createTempFile("vfs", ".root");
-      tmpRoot.delete();
-      tmpRoot.mkdir();
-      File tmp = File.createTempFile("testDirJarExists", ".jar", tmpRoot);
-      assertTrue(tmp+".delete()", tmp.delete());
-      assertTrue(tmp+".mkdir()", tmp.mkdir());
-      log.info("+++ testDirJarExists, tmp="+tmp.getCanonicalPath());
-
-      URL rootURL = tmpRoot.toURL();
-      VFS vfs = VFS.getVFS(rootURL);
-      VirtualFile tmpVF = vfs.findChild(tmp.getName());
-      log.info(tmpVF.getHandler());
-      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertFalse(tmpVF.getPathName()+".isLeaf()", tmpVF.isLeaf());
-      assertTrue(tmp+".delete()", tmp.delete());
-      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
-      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,1379 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.virtual.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipInputStream;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.test.BaseTestCase;
+import org.jboss.test.virtual.support.ClassPathIterator;
+import org.jboss.test.virtual.support.ClassPathIterator.ClassPathEntry;
+import org.jboss.test.virtual.support.MetaDataMatchFilter;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.context.jar.NestedJarFromStream;
+import org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter;
+import org.jboss.virtual.spi.LinkInfo;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VFSContextFactory;
+import org.jboss.virtual.spi.VFSContextFactoryLocator;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Tests of the VFS implementation
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision: 55523 $
+ */
+public class FileVFSUnitTestCase extends BaseTestCase
+{
+   public FileVFSUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public static Test suite()
+   {
+      return new TestSuite(FileVFSUnitTestCase.class);
+   }
+
+   /**
+    * Test that a VFSContextFactory can be created from the testcase CodeSource url
+    * @throws Exception
+    */
+   public void testVFSContextFactory()
+      throws Exception
+   {
+      URL root = getClass().getProtectionDomain().getCodeSource().getLocation();
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(root);
+      assertTrue("VFSContextFactory(CodeSource.Location) != null", factory != null);
+   }
+
+   /**
+    * Test that one can go from a file uri to VirtualFile and obtain the
+    * same VirtualFile using VirtualFile vfsfile uri
+    * @throws Exception
+    */
+   public void testVFSFileURIFactory()
+      throws Exception
+   {
+      URL rootURL = getClass().getProtectionDomain().getCodeSource().getLocation();
+      VFS rootVFS0 = VFS.getVFS(rootURL.toURI());
+      VirtualFile root0 = rootVFS0.getRoot();
+      VFS rootVFS1 = VFS.getVFS(root0.toURI());
+      VirtualFile root1 = rootVFS1.getRoot();
+      assertEquals(root0, root1);
+   }
+
+   /**
+    * Test that NestedJarFromStream can provide access to nested jar content
+    * @throws Exception
+    */
+   public void testNestedJarFromStream()
+      throws Exception
+   {
+      URL outer = getResource("/vfs/test/outer.jar");
+      String path = outer.getPath();
+      File outerJar = new File(path);
+      assertTrue(outerJar.getAbsolutePath()+" exists", outerJar.exists());
+      JarFile jf = new JarFile(outerJar);
+
+      URL rootURL = outerJar.getParentFile().toURL();
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
+      VFSContext context = factory.getVFS(rootURL);
+
+      JarEntry jar1 = jf.getJarEntry("jar1.jar");
+      URL jar1URL = new URL(outerJar.toURL(), "jar1.jar");
+      VFSContextFactory pf1 = VFSContextFactoryLocator.getFactory(jar1URL);
+      VFSContext parent1 = pf1.getVFS(jar1URL);
+
+      ZipInputStream jis1 = new ZipInputStream(jf.getInputStream(jar1));
+      NestedJarFromStream njfs = new NestedJarFromStream(context, parent1.getRoot(), jis1, jar1URL, jf, jar1, "jar1.jar");
+      VirtualFileHandler e1 = njfs.getChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
+      assertNotNull(e1);
+      log.info("org/jboss/test/vfs/support/CommonClass.class: "+e1);
+      VirtualFileHandler mfe1 = njfs.getChild("META-INF/MANIFEST.MF");
+      assertNotNull("jar1!/META-INF/MANIFEST.MF", mfe1);
+      InputStream mfIS = mfe1.openStream();
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String title1 = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals("jar1", title1);
+      mfIS.close();
+      njfs.close();
+
+      JarEntry jar2 = jf.getJarEntry("jar2.jar");
+      URL jar2URL = new URL(outerJar.toURL(), "jar2.jar");
+      VFSContextFactory pf2 = VFSContextFactoryLocator.getFactory(jar2URL);
+      VFSContext parent2 = pf2.getVFS(jar2URL);
+
+      ZipInputStream jis2 = new ZipInputStream(jf.getInputStream(jar2));
+      NestedJarFromStream njfs2 = new NestedJarFromStream(context, parent2.getRoot(), jis2, jar2URL, jf, jar2, "jar2.jar");
+      VirtualFileHandler e2 = njfs2.getChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
+      assertNotNull(e2);
+      log.info("org/jboss/test/vfs/support/CommonClass.class: "+e2);
+      VirtualFileHandler mfe2 = njfs2.getChild("META-INF/MANIFEST.MF");
+      assertNotNull("jar2!/META-INF/MANIFEST.MF", mfe2);
+      InputStream mf2IS = mfe2.openStream();
+      Manifest mf2 = new Manifest(mf2IS);
+      Attributes mainAttrs2 = mf2.getMainAttributes();
+      String title2 = mainAttrs2.getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals("jar2", title2);
+      mf2IS.close();
+      njfs2.close();
+   }
+
+   /**
+    * Test reading the contents of nested jar entries.
+    * @throws Exception
+    */
+   public void testInnerJarFile()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile outerjar = vfs.findChild("outer.jar");
+      assertTrue("outer.jar != null", outerjar != null);
+      VirtualFile jar1 = outerjar.findChild("jar1.jar");
+      assertTrue("outer.jar/jar1.jar != null", jar1 != null);
+      VirtualFile jar2 = outerjar.findChild("jar2.jar");
+      assertTrue("outer.jar/jar2.jar != null", jar2 != null);
+
+      VirtualFile jar1MF = jar1.findChild("META-INF/MANIFEST.MF");
+      assertNotNull("jar1!/META-INF/MANIFEST.MF", jar1MF);
+      InputStream mfIS = jar1MF.openStream();
+      Manifest mf1 = new Manifest(mfIS);
+      Attributes mainAttrs1 = mf1.getMainAttributes();
+      String title1 = mainAttrs1.getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals("jar1", title1);
+      jar1MF.close();
+
+      VirtualFile jar2MF = jar2.findChild("META-INF/MANIFEST.MF");
+      assertNotNull("jar2!/META-INF/MANIFEST.MF", jar2MF);
+      InputStream mfIS2 = jar2MF.openStream();
+      Manifest mf2 = new Manifest(mfIS2);
+      Attributes mainAttrs2 = mf2.getMainAttributes();
+      String title2 = mainAttrs2.getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals("jar2", title2);
+      jar2MF.close();
+   }
+
+   /**
+    * Basic tests of accessing resources in a jar
+    * @throws Exception
+    */
+   public void testFindResource()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile jar = vfs.findChild("outer.jar");
+      assertTrue("outer.jar != null", jar != null);
+
+      /*
+      ArrayList<String> searchCtx = new ArrayList<String>();
+      searchCtx.add("outer.jar");
+      VirtualFile metaInf = vfs.resolveFile("META-INF/MANIFEST.MF", searchCtx);
+      */
+      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
+      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
+      InputStream mfIS = metaInf.openStream();
+      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
+      assertEquals("1.0.0.GA", version);
+      mfIS.close();
+   }
+
+   /**
+    * Basic tests of accessing resources in a jar
+    * @throws Exception
+    */
+   public void testFindResourceUsingURLStream()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile jar = vfs.findChild("outer.jar");
+      assertTrue("outer.jar != null", jar != null);
+
+      /*
+      ArrayList<String> searchCtx = new ArrayList<String>();
+      searchCtx.add("outer.jar");
+      VirtualFile metaInf = vfs.resolveFile("META-INF/MANIFEST.MF", searchCtx);
+      */
+      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
+      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
+      InputStream mfIS = metaInf.toURL().openStream();
+      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
+      assertEquals("1.0.0.GA", version);
+      mfIS.close();
+
+      String urlString = metaInf.toURL().toString();
+      URL mfURL = new URL(urlString);
+      mfIS = mfURL.openStream();
+      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
+      mf = new Manifest(mfIS);
+      mainAttrs = mf.getMainAttributes();
+      version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
+      assertEquals("1.0.0.GA", version);
+      mfIS.close();
+   }
+
+   /**
+    * Basic tests of accessing resources in a jar that does not
+    * have parent directory entries.
+    * @throws Exception
+    */
+   public void testFindResourceInFilesOnlyJar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile jar = vfs.findChild("jar1-filesonly.jar");
+      assertTrue("jar1-filesonly.jar != null", jar != null);
+
+      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
+      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
+      InputStream mfIS = metaInf.toURL().openStream();
+      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
+      assertEquals("1.0.0.GA", version);
+      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals("jar1-filesonly", title);
+      mfIS.close();
+
+      String urlString = metaInf.toURL().toString();
+      URL mfURL = new URL(urlString);
+      mfIS = mfURL.openStream();
+      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
+      mf = new Manifest(mfIS);
+      mainAttrs = mf.getMainAttributes();
+      version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
+      assertEquals("1.0.0.GA", version);
+      title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals("jar1-filesonly", title);
+      mfIS.close();
+   }
+
+   /**
+    * Basic tests of accessing resources in a war that does not
+    * have parent directory entries.
+    * @throws Exception
+    */
+   public void testFindResourceInFilesOnlyWar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      VirtualFile war2 = vfs.findChild("WarDeployApp_web.war");
+      assertTrue("WarDeployApp_web.war != null", war2 != null);
+
+      VirtualFile classes2 = war2.findChild("WEB-INF/classes");
+      assertTrue("WEB-INF/classes != null", classes2 != null);
+      assertTrue("WEB-INF/classes is not a leaf", classes2.isLeaf()==false);
+      classes2 = war2.findChild("WEB-INF/classes");
+      assertTrue("WEB-INF/classes != null", classes2 != null);
+      assertTrue("WEB-INF/classes is not a leaf", classes2.isLeaf()==false);
+
+      VirtualFile HelloJavaBean = classes2.findChild("com/sun/ts/tests/webservices/deploy/warDeploy/HelloJavaBean.class");
+      assertTrue("HelloJavaBean.class != null", HelloJavaBean != null);
+      assertTrue("HelloJavaBean.class is a leaf", HelloJavaBean.isLeaf());
+
+      VirtualFile war = vfs.findChild("filesonly.war");
+      assertTrue("filesonly.war != null", war != null);
+
+      VirtualFile classes = war.findChild("WEB-INF/classes");
+      assertTrue("WEB-INF/classes != null", classes != null);
+      assertTrue("WEB-INF/classes is not a leaf", classes.isLeaf()==false);
+
+      VirtualFile jar1 = war.findChild("WEB-INF/lib/jar1.jar");
+      assertTrue("WEB-INF/lib/jar1.jar != null", jar1 != null);
+      assertTrue("WEB-INF/lib/jar1.jar is not a leaf", jar1.isLeaf()==false);
+      VirtualFile ClassInJar1 = jar1.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
+      assertTrue("ClassInJar1.class != null", ClassInJar1 != null);
+      assertTrue("ClassInJar1.class is a leaf", ClassInJar1.isLeaf());
+
+      VirtualFile metaInf = war.findChild("META-INF/MANIFEST.MF");
+      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
+      InputStream mfIS = metaInf.toURL().openStream();
+      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
+      assertEquals("1.0.0.GA", version);
+      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals("filesonly-war", title);
+      mfIS.close();
+
+      war.findChild("WEB-INF/classes");
+      assertTrue("WEB-INF/classes != null", classes != null);
+      assertTrue("WEB-INF/classes is not a leaf", classes.isLeaf()==false);
+   }
+
+   /**
+    * Validate iterating over a vfs url from a files only war.
+    * 
+    * @throws Exception
+    */
+   public void testFindClassesInFilesOnlyWar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      VirtualFile war = vfs.findChild("filesonly.war");
+      assertTrue("filesonly.war != null", war != null);
+
+      VirtualFile classes = war.findChild("WEB-INF/classes");
+      assertTrue("WEB-INF/classes != null", classes != null);
+      HashSet<String> names = new HashSet<String>();
+      ClassPathIterator iter = new ClassPathIterator(classes.toURL());
+      ClassPathEntry entry = null;
+      while( (entry = iter.getNextEntry()) != null )
+      {
+         names.add(entry.name);
+      }
+      log.debug(names);
+      assertTrue("org/jboss/test/vfs/support/jar1", names.contains("org/jboss/test/vfs/support/jar1"));
+      assertTrue("ClassInJar1.class", names.contains("org/jboss/test/vfs/support/jar1/ClassInJar1.class"));
+      assertTrue("ClassInJar1$InnerClass.class", names.contains("org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class"));
+   }
+
+   public void testFindResourceUnpackedJar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile jar = vfs.findChild("unpacked-outer.jar");
+      assertTrue("unpacked-outer.jar != null", jar != null);
+
+      /**
+      ArrayList<String> searchCtx = new ArrayList<String>();
+      searchCtx.add("unpacked-outer.jar");
+      VirtualFile metaInf = vfs.resolveFile("META-INF/MANIFEST.MF", searchCtx);
+      */
+      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
+      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
+      InputStream mfIS = metaInf.openStream();
+      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
+      assertEquals("1.0.0.GA", version);
+      mfIS.close();
+   }
+
+   /**
+    * Test simple file resolution without search contexts
+    * @throws Exception
+    */
+   public void testResolveFile()
+      throws Exception
+   {
+      log.info("+++ testResolveFile, cwd="+(new File(".").getCanonicalPath()));
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      // Check resolving the root file
+      VirtualFile root = vfs.findChild("");
+      assertEquals("root name", "test", root.getName());
+      assertEquals("root path", "", root.getPathName());
+      assertFalse("root isDirectory", root.isLeaf());
+
+      // Find the outer.jar
+      VirtualFile outerJar = vfs.findChild("outer.jar");
+      assertNotNull("outer.jar", outerJar);
+      assertEquals("outer.jar name", "outer.jar", outerJar.getName());
+      assertEquals("outer.jar path", "outer.jar", outerJar.getPathName());
+      
+      VirtualFile outerJarMF = vfs.findChild("outer.jar/META-INF/MANIFEST.MF");
+      assertNotNull("outer.jar/META-INF/MANIFEST.MF", outerJarMF);
+
+      // Test a non-canonical path
+      rootURL = getResource("/vfs/sundry/../test");
+      // Check resolving the root file
+      root = vfs.findChild("");
+      assertEquals("root name", "test", root.getName());
+      assertEquals("root path", "", root.getPathName());
+      assertFalse("root isDirectory", root.isLeaf());
+   }
+
+   /**
+    * Validate resolving a .class file given a set of search contexts in the
+    * vfs that make up a classpath.
+    * 
+    * @throws Exception
+    */
+   public void testResolveClassFileInClassPath()
+      throws Exception
+   {
+      log.info("+++ testResolveFile, cwd="+(new File(".").getCanonicalPath()));
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      
+      // Find ClassInJar1.class
+      VirtualFile vf = vfs.findChild("jar1.jar");
+      VirtualFile c1 = vf.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
+      assertNotNull("ClassInJar1.class VF", c1);
+      log.debug("Found ClassInJar1.class: "+c1);
+
+      // Find ClassInJar1$InnerClass.class
+      VirtualFile c1i = vf.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
+      assertNotNull("ClassInJar1$InnerClass.class VF", c1i);
+      log.debug("Found ClassInJar1$InnerClass.class: "+c1i);
+
+      // Find ClassInJar2.class
+      vf = vfs.findChild("jar2.jar");
+      VirtualFile c2 = vf.findChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
+      assertNotNull("ClassInJar2.class VF", c2);
+      log.debug("Found ClassInJar2.class: "+c2);
+   }
+
+   public void testResolveFileInUnpackedJar()
+      throws Exception
+   {
+      log.info("+++ testResolveFileInUnpackedJar, cwd="+(new File(".").getCanonicalPath()));
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      // Check resolving the root file
+      VirtualFile root = vfs.findChild("");
+      assertEquals("root name", "test", root.getName());
+      assertEquals("root path", "", root.getPathName());
+      assertFalse("root isDirectory", root.isLeaf());
+
+      // Find the outer.jar
+      VirtualFile outerJar = vfs.findChild("unpacked-outer.jar");
+      assertNotNull("unpacked-outer.jar", outerJar);
+      assertEquals("unpacked-outer.jar name", "unpacked-outer.jar", outerJar.getName());
+      assertEquals("unpacked-outer.jar path", "unpacked-outer.jar", outerJar.getPathName());
+      
+      VirtualFile outerJarMF = vfs.findChild("unpacked-outer.jar/META-INF/MANIFEST.MF");
+      assertNotNull("unpacked-outer.jar/META-INF/MANIFEST.MF", outerJarMF);
+
+      // Test a non-canonical path
+      rootURL = getResource("/test/sundry/../test");
+      // Check resolving the root file
+      root = vfs.findChild("");
+      assertEquals("root name", "test", root.getName());
+      assertEquals("root path", "", root.getPathName());
+      assertFalse("root isDirectory", root.isLeaf());
+   }
+
+   /**
+    * Test file resolution with nested jars
+    * @throws Exception
+    */
+   public void testInnerJar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile inner = vfs.findChild("outer.jar/jar1.jar");
+      log.info("IsFile: "+inner.isLeaf());
+      log.info(inner.getLastModified());
+      List<VirtualFile> contents = inner.getChildren();
+      // META-INF/*, org/jboss/test/vfs/support/jar1/* at least
+      assertTrue("jar1.jar children.length("+contents.size()+") >= 2", contents.size() >= 2);
+      for(VirtualFile vf : contents)
+      {
+         log.info("  "+vf.getName());
+      }
+      VirtualFile vf = vfs.findChild("outer.jar/jar1.jar");
+      VirtualFile jar1MF = vf.findChild("META-INF/MANIFEST.MF");
+      InputStream mfIS = jar1MF.openStream();
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1", version);
+      mfIS.close();
+   }
+
+   public void testInnerJarUsingURLStream()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile inner = vfs.findChild("outer.jar/jar1.jar");
+      log.info("IsFile: "+inner.isLeaf());
+      log.info(inner.getLastModified());
+      List<VirtualFile> contents = inner.getChildren();
+      // META-INF/*, org/jboss/test/vfs/support/jar1/* at least
+      assertTrue("jar1.jar children.length("+contents.size()+") >= 2", contents.size() >= 2);
+      for(VirtualFile vf : contents)
+      {
+         log.info("  "+vf.getName());
+      }
+      VirtualFile vf = vfs.findChild("outer.jar/jar1.jar");
+      VirtualFile jar1MF = vf.findChild("META-INF/MANIFEST.MF");
+      InputStream mfIS = jar1MF.toURL().openStream();
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1", version);
+      mfIS.close();
+   }
+
+   /**
+    * Test a scan of the outer.jar vfs to locate all .class files
+    * @throws Exception
+    */
+   public void testClassScan()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test/outer.jar");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      HashSet<String> expectedClasses = new HashSet<String>();
+      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1.class");
+      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
+      expectedClasses.add("jar2.jar/org/jboss/test/vfs/support/jar2/ClassInJar2.class");
+      expectedClasses.add("org/jboss/test/vfs/support/CommonClass.class");
+      super.enableTrace("org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter");
+      SuffixMatchFilter classVisitor = new SuffixMatchFilter(".class", VisitorAttributes.RECURSE);
+      List<VirtualFile> classes = vfs.getChildren(classVisitor);
+      int count = 0;
+      for (VirtualFile cf : classes)
+      {
+         String path = cf.getPathName();
+         if( path.endsWith(".class") )
+         {
+            assertTrue(path, expectedClasses.contains(path));
+            count ++;
+         }
+      }
+      assertEquals("There were 4 classes", 4, count);
+   }
+
+   /**
+    * Test a scan of the unpacked-outer.jar vfs to locate all .class files
+    * @throws Exception
+    */
+   public void testClassScanUnpacked()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test/unpacked-outer.jar");
+      VFS vfs = VFS.getVFS(rootURL);
+   
+      HashSet<String> expectedClasses = new HashSet<String>();
+      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1.class");
+      expectedClasses.add("jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
+      expectedClasses.add("jar2.jar/org/jboss/test/vfs/support/jar2/ClassInJar2.class");
+      expectedClasses.add("org/jboss/test/vfs/support/CommonClass.class");
+      super.enableTrace("org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter");
+      SuffixMatchFilter classVisitor = new SuffixMatchFilter(".class", VisitorAttributes.RECURSE);
+      List<VirtualFile> classes = vfs.getChildren(classVisitor);
+      int count = 0;
+      for (VirtualFile cf : classes)
+      {
+         String path = cf.getPathName();
+         if( path.endsWith(".class") )
+         {
+            assertTrue(path, expectedClasses.contains(path));
+            count ++;
+         }
+      }
+      assertEquals("There were 4 classes", 4, count);
+   }
+
+   /**
+    * Test a scan of the jar1-filesonly.jar vfs to locate all .class files
+    * @throws Exception
+    */
+   public void testClassScanFilesonly()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test/jar1-filesonly.jar");
+      VFS vfs = VFS.getVFS(rootURL);
+   
+      HashSet<String> expectedClasses = new HashSet<String>();
+      expectedClasses.add("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
+      expectedClasses.add("org/jboss/test/vfs/support/jar1/ClassInJar1$InnerClass.class");
+      super.enableTrace("org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter");
+      SuffixMatchFilter classVisitor = new SuffixMatchFilter(".class", VisitorAttributes.RECURSE);
+      List<VirtualFile> classes = vfs.getChildren(classVisitor);
+      int count = 0;
+      for (VirtualFile cf : classes)
+      {
+         String path = cf.getPathName();
+         if( path.endsWith(".class") )
+         {
+            assertTrue(path, expectedClasses.contains(path));
+            count ++;
+         }
+      }
+      assertEquals("There were 2 classes", 2, count);
+
+      // Make sure we can walk path-wise to the class
+      VirtualFile jar1 = vfs.getRoot();
+      VirtualFile parent = jar1;
+      String className = "org/jboss/test/vfs/support/jar1/ClassInJar1.class";
+      VirtualFile ClassInJar1 = vfs.findChild(className);
+      String[] paths = className.split("/");
+      StringBuilder vfsPath = new StringBuilder();
+      for(String path : paths)
+      {
+         vfsPath.append(path);
+         VirtualFile vf = parent.findChild(path);
+         if( path.equals("ClassInJar1.class") )
+            assertEquals("ClassInJar1.class", ClassInJar1, vf);
+         else
+         {
+            assertEquals("vfsPath", vfsPath.toString(), vf.getPathName());
+            assertEquals("lastModified", ClassInJar1.getLastModified(), vf.getLastModified());
+         }
+         vfsPath.append('/');
+         parent = vf;
+      }
+   }
+
+   /**
+    * Test access of directories in a jar that only stores files
+    * @throws Exception
+    */
+   public void testFilesOnlyJar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      VirtualFile jar = vfs.findChild("jar1-filesonly.jar");
+      VirtualFile metadataLocation = jar.findChild("META-INF");
+      assertNotNull(metadataLocation);
+      VirtualFile mfFile = metadataLocation.findChild("MANIFEST.MF");
+      assertNotNull(mfFile);
+      InputStream is = mfFile.openStream();
+      Manifest mf = new Manifest(is);
+      mfFile.close();
+      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1-filesonly", title);
+
+      // Retry starting from the jar root
+      mfFile = jar.findChild("META-INF/MANIFEST.MF");
+      is = mfFile.openStream();
+      mf = new Manifest(is);
+      mfFile.close();
+      title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1-filesonly", title);
+   }
+
+   /**
+    * Test the serialization of VirtualFiles
+    * @throws Exception
+    */
+   public void testVFSerialization()
+      throws Exception
+   {
+      File tmpRoot = File.createTempFile("vfs", ".root");
+      tmpRoot.delete();
+      tmpRoot.mkdir();
+      tmpRoot.deleteOnExit();
+      File tmp = new File(tmpRoot, "vfs.ser");
+      tmp.createNewFile();
+      tmp.deleteOnExit();
+      log.info("+++ testVFSerialization, tmp="+tmp.getCanonicalPath());
+      URL rootURL = tmpRoot.toURL();
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tmpVF = vfs.findChild("vfs.ser");
+      FileOutputStream fos = new FileOutputStream(tmp);
+      ObjectOutputStream oos = new ObjectOutputStream(fos);
+      oos.writeObject(tmpVF);
+      oos.close();
+
+      // Check the tmpVF attributes against the tmp file
+      long lastModified = tmp.lastModified();
+      long size = tmp.length();
+      String name = tmp.getName();
+      String vfsPath = tmp.getPath();
+      vfsPath = vfsPath.substring(tmpRoot.getPath().length()+1);
+      URL url = new URL("vfs" + tmp.toURL());
+      log.debug("name: "+name);
+      log.debug("vfsPath: "+vfsPath);
+      log.debug("url: "+url);
+      log.debug("lastModified: "+lastModified);
+      log.debug("size: "+size);
+      assertEquals("name", name, tmpVF.getName());
+      assertEquals("pathName", vfsPath, tmpVF.getPathName());
+      assertEquals("lastModified", lastModified, tmpVF.getLastModified());
+      assertEquals("size", size, tmpVF.getSize());
+      assertEquals("url", url, tmpVF.toURL());
+      assertEquals("isLeaf", true, tmpVF.isLeaf());
+      assertEquals("isHidden", false, tmpVF.isHidden());
+
+      // Read in the VF from the serialized file
+      FileInputStream fis = new FileInputStream(tmp);
+      ObjectInputStream ois = new ObjectInputStream(fis);
+      VirtualFile tmpVF2 = (VirtualFile) ois.readObject();
+      ois.close();
+      // Validated the deserialized attribtes against the tmp file
+      assertEquals("name", name, tmpVF2.getName());
+      assertEquals("pathName", vfsPath, tmpVF2.getPathName());
+      assertEquals("lastModified", lastModified, tmpVF2.getLastModified());
+      assertEquals("size", size, tmpVF2.getSize());
+      assertEquals("url", url, tmpVF2.toURL());
+      assertEquals("isLeaf", true, tmpVF2.isLeaf());
+      assertEquals("isHidden", false, tmpVF2.isHidden());
+   }
+
+   /**
+    * Test the serialization of VirtualFiles representing a jar
+    * @throws Exception
+    */
+   public void testVFJarSerialization()
+      throws Exception
+   {
+      File tmpRoot = File.createTempFile("vfs", ".root");
+      tmpRoot.delete();
+      tmpRoot.mkdir();
+      tmpRoot.deleteOnExit();
+      // Create a test jar containing a txt file
+      File tmpJar = new File(tmpRoot, "tst.jar");
+      tmpJar.createNewFile();
+      tmpJar.deleteOnExit();
+      FileOutputStream fos = new FileOutputStream(tmpJar);
+      JarOutputStream jos = new JarOutputStream(fos);
+      // Write a text file to include in a test jar
+      JarEntry txtEntry = new JarEntry("tst.txt");
+      jos.putNextEntry(txtEntry);
+      txtEntry.setSize("testVFJarSerialization".length());
+      txtEntry.setTime(System.currentTimeMillis());
+      jos.write("testVFJarSerialization".getBytes());
+      jos.close();
+      log.info("+++ testVFJarSerialization, tmp="+tmpJar.getCanonicalPath());
+
+      URI rootURI = tmpRoot.toURI();
+      VFS vfs = VFS.getVFS(rootURI);
+      File vfsSer = new File(tmpRoot, "vfs.ser");
+      vfsSer.createNewFile();
+      vfsSer.deleteOnExit();
+
+      VirtualFile tmpVF = vfs.findChild("tst.jar");
+      // Validate the vf jar against the tmp file attributes
+      long lastModified = tmpJar.lastModified();
+      long size = tmpJar.length();
+      String name = tmpJar.getName();
+      String vfsPath = tmpJar.getPath();
+      vfsPath = vfsPath.substring(tmpRoot.getPath().length()+1);
+      URL url = new URL("vfs" + tmpJar.toURL());
+      //url = JarUtils.createJarURL(url);
+      log.debug("name: "+name);
+      log.debug("vfsPath: "+vfsPath);
+      log.debug("url: "+url);
+      log.debug("lastModified: "+lastModified);
+      log.debug("size: "+size);
+      assertEquals("name", name, tmpVF.getName());
+      assertEquals("pathName", vfsPath, tmpVF.getPathName());
+      assertEquals("lastModified", lastModified, tmpVF.getLastModified());
+      assertEquals("size", size, tmpVF.getSize());
+      assertEquals("url", url, tmpVF.toURL());
+      // TODO: these should pass
+      //assertEquals("isFile", true, tmpVF.isFile());
+      //assertEquals("isDirectory", false, tmpVF.isDirectory());
+      assertEquals("isHidden", false, tmpVF.isHidden());
+      // Write out the vfs jar file
+      fos = new FileOutputStream(vfsSer);
+      ObjectOutputStream oos = new ObjectOutputStream(fos);
+      oos.writeObject(tmpVF);
+      oos.close();
+
+      // Read in the VF from the serialized file
+      FileInputStream fis = new FileInputStream(vfsSer);
+      ObjectInputStream ois = new ObjectInputStream(fis);
+      VirtualFile tmpVF2 = (VirtualFile) ois.readObject();
+      ois.close();
+      // Validate the vf jar against the tmp file attributes
+      assertEquals("name", name, tmpVF2.getName());
+      assertEquals("pathName", vfsPath, tmpVF2.getPathName());
+      assertEquals("lastModified", lastModified, tmpVF2.getLastModified());
+      assertEquals("size", size, tmpVF2.getSize());
+      assertEquals("url", url, tmpVF2.toURL());
+      // TODO: these should pass
+      //assertEquals("isFile", true, tmpVF2.isFile());
+      //assertEquals("isDirectory", false, tmpVF2.isDirectory());
+      assertEquals("isHidden", false, tmpVF2.isHidden());
+   }
+
+   /**
+    * Test the serialization of VirtualFiles representing a jar
+    * @throws Exception
+    */
+   public void testVFNestedJarSerialization()
+      throws Exception
+   {
+      // this expects to be run with a working dir of the container root
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile inner = vfs.findChild("outer.jar/jar1.jar");
+
+      File vfsSer = File.createTempFile("testVFNestedJarSerialization", ".ser");
+      vfsSer.deleteOnExit();
+      // Write out the vfs inner jar file
+      FileOutputStream fos = new FileOutputStream(vfsSer);
+      ObjectOutputStream oos = new ObjectOutputStream(fos);
+      oos.writeObject(inner);
+      oos.close();
+      
+      // Read in the VF from the serialized file
+      FileInputStream fis = new FileInputStream(vfsSer);
+      ObjectInputStream ois = new ObjectInputStream(fis);
+      inner = (VirtualFile) ois.readObject();
+      ois.close();
+      List<VirtualFile> contents = inner.getChildren();
+      // META-INF/*, org/jboss/test/vfs/support/jar1/* at least
+      assertTrue("jar1.jar children.length("+contents.size()+") >= 2", contents.size() >= 2);
+      for(VirtualFile vf : contents)
+      {
+         log.info("  "+vf.getName());
+      }
+      VirtualFile vf = vfs.findChild("outer.jar/jar1.jar");
+      VirtualFile jar1MF = vf.findChild("META-INF/MANIFEST.MF");
+      InputStream mfIS = jar1MF.openStream();
+      Manifest mf = new Manifest(mfIS);
+      Attributes mainAttrs = mf.getMainAttributes();
+      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
+      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1", version);
+      mfIS.close();
+   }
+
+   /**
+    * Test parsing of a vfs link properties file. It contains test.classes.url
+    * and test.lib.url system property references that are configured to
+    * point to the CodeSource location of this class and /vfs/sundry/jar/
+    * respectively.
+    * 
+    * @throws Exception
+    */
+   public void testVfsLinkProperties()
+      throws Exception
+   {
+      URL linkURL = super.getResource("/vfs/links/war1.vfslink.properties");
+      assertNotNull("vfs/links/war1.vfslink.properties", linkURL);
+      // Find resources to use as the WEB-INF/{classes,lib} link targets
+      URL classesURL = getClass().getProtectionDomain().getCodeSource().getLocation();
+      assertNotNull("classesURL", classesURL);
+      System.setProperty("test.classes.url", classesURL.toString());
+      URL libURL = super.getResource("/vfs/sundry/jar");
+      assertNotNull("libURL", libURL);      
+      System.setProperty("test.lib.url", libURL.toString());
+
+      assertTrue("isLink", VFSUtils.isLink(linkURL.getPath()));
+      Properties props = new Properties();
+      InputStream linkIS = linkURL.openStream();
+      List<LinkInfo> infos = VFSUtils.readLinkInfo(linkIS, linkURL.getPath(), props);
+      assertEquals("LinkInfo count", 2, infos.size());
+      LinkInfo classesInfo = null;
+      LinkInfo libInfo = null;
+      for(LinkInfo info :infos)
+      {
+         if( info.getName().equals("WEB-INF/classes") )
+            classesInfo = info;
+         else if(info.getName().equals("WEB-INF/lib") )
+            libInfo = info;
+      }
+      assertNotNull("classesInfo", classesInfo);
+      assertEquals("classesInfo.target", classesURL.toURI(), classesInfo.getLinkTarget());
+      assertNotNull("libInfo", libInfo);
+      assertEquals("libInfo.target", libURL.toURI(), libInfo.getLinkTarget());
+   }
+
+   /**
+    * Test the test-link.war link
+    * @throws Exception
+    */
+   public void testWarLink()
+      throws Exception
+   {
+      // Find resources to use as the WEB-INF/{classes,lib} link targets
+      URL classesURL = getClass().getProtectionDomain().getCodeSource().getLocation();
+      assertNotNull("classesURL", classesURL);
+      System.setProperty("test.classes.url", classesURL.toString());
+      URL libURL = super.getResource("/vfs/sundry/jar");
+      assertNotNull("libURL", libURL);      
+      System.setProperty("test.lib.url", libURL.toString());
+
+      // Root the vfs at the link file parent directory
+      URL linkURL = super.getResource("/vfs/links/war1.vfslink.properties");
+      File linkFile = new File(linkURL.toURI());
+      File vfsRoot = linkFile.getParentFile();
+      assertNotNull("vfs/links/war1.vfslink.properties", linkURL);
+      VFS vfs = VFS.getVFS(vfsRoot.toURI());
+
+      // We should find the test-link.war the link represents
+      VirtualFile war = vfs.findChild("test-link.war");
+      assertNotNull("war", war);
+
+      // Validate the WEB-INF/classes child link
+      VirtualFile classes = war.findChild("WEB-INF/classes");
+      String classesName = classes.getName();
+      String classesPathName = classes.getPathName();
+      boolean classesIsDirectory = classes.isLeaf() == false;
+      assertEquals("classes.name", "classes", classesName);
+      assertEquals("classes.pathName", "test-link.war/WEB-INF/classes", classesPathName);
+      assertEquals("classes.isDirectory", true, classesIsDirectory);
+      // Should be able to find this class since classes points to out codesource
+      VirtualFile thisClass = classes.findChild("org/jboss/test/virtual/test/FileVFSUnitTestCase.class");
+      assertEquals("FileVFSUnitTestCase.class", thisClass.getName());
+
+      // Validate the WEB-INF/lib child link
+      VirtualFile lib = war.findChild("WEB-INF/lib");
+      String libName = lib.getName();
+      String libPathName = lib.getPathName();
+      boolean libIsDirectory = lib.isLeaf() == false;
+      assertEquals("lib.name", "lib", libName);
+      assertEquals("lib.pathName", "test-link.war/WEB-INF/lib", libPathName);
+      assertEquals("lib.isDirectory", true, libIsDirectory);
+      // Should be able to find archive.jar under lib
+      VirtualFile archiveJar = lib.findChild("archive.jar");
+      assertEquals("archive.jar", archiveJar.getName());
+   }
+
+  /**
+    * Test that the URL of a VFS corresponding to a directory ends in '/' so that
+    * URLs created relative to it are under the directory. This requires that
+    * build-test.xml artifacts exist.
+    * 
+    * @throws Exception
+    */
+   public void testDirURLs() throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      VirtualFile outerJar = vfs.findChild("unpacked-outer.jar");
+      URL outerURL = outerJar.toURL();
+      log.debug("outerURL: "+outerURL);
+      assertTrue(outerURL+" ends in '/'", outerURL.getPath().endsWith("/"));
+      // Validate that jar1 is under unpacked-outer.jar
+      URL jar1URL = new URL(outerURL, "jar1.jar");
+      log.debug("jar1URL: "+jar1URL+", path="+jar1URL.getPath());
+      assertTrue("jar1URL path ends in unpacked-outer.jar/jar1.jar!/",
+            jar1URL.getPath().endsWith("unpacked-outer.jar/jar1.jar"));
+      VirtualFile jar1 = outerJar.findChild("jar1.jar");
+      assertEquals(jar1URL, jar1.toURL());
+
+      VirtualFile packedJar = vfs.findChild("jar1.jar");
+      jar1URL = packedJar.findChild("org/jboss/test/vfs/support").toURL();
+      assertTrue("Jar directory entry URLs must end in /: " + jar1URL.toString(), jar1URL.toString().endsWith("/"));
+   }
+
+   /**
+    * Test that the URI of a VFS corresponding to a directory ends in '/' so that
+    * URIs created relative to it are under the directory. This requires that
+    * build-test.xml artifacts exist.
+    * 
+    * @throws Exception
+    */
+   public void testDirURIs() throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+
+      VirtualFile outerJar = vfs.findChild("unpacked-outer.jar");
+      URI outerURI = outerJar.toURI();
+      log.debug("outerURI: "+outerURI);
+      assertTrue(outerURI+" ends in '/'", outerURI.getPath().endsWith("/"));
+      // Validate that jar1 is under unpacked-outer.jar
+      URI jar1URI = new URI(outerURI+"jar1.jar");
+      log.debug("jar1URI: "+jar1URI+", path="+jar1URI.getPath());
+      assertTrue("jar1URI path ends in unpacked-outer.jar/jar1.jar!/",
+            jar1URI.getPath().endsWith("unpacked-outer.jar/jar1.jar"));
+      VirtualFile jar1 = outerJar.findChild("jar1.jar");
+      assertEquals(jar1URI, jar1.toURI());
+
+      VirtualFile packedJar = vfs.findChild("jar1.jar");
+      jar1URI = packedJar.findChild("org/jboss/test/vfs/support").toURI();
+      assertTrue("Jar directory entry URLs must end in /: " + jar1URI.toString(),
+            jar1URI.toString().endsWith("/"));
+   }
+
+   /**
+    * Test copying a jar
+    * 
+    * @throws Exception
+    */
+   public void testCopyJar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile jar = vfs.findChild("outer.jar");
+      assertTrue("outer.jar != null", jar != null);
+      File tmpJar = File.createTempFile("testCopyJar", ".jar");
+      tmpJar.deleteOnExit();
+
+      try
+      {
+         InputStream is = jar.openStream();
+         FileOutputStream fos = new FileOutputStream(tmpJar);
+         byte[] buffer = new byte[1024];
+         int read;
+         while( (read = is.read(buffer)) > 0 )
+         {
+            fos.write(buffer, 0, read);
+         }
+         fos.close();
+         log.debug("outer.jar size is: "+jar.getSize());
+         log.debug(tmpJar.getAbsolutePath()+" size is: "+tmpJar.length());
+         assertTrue("outer.jar > 0", jar.getSize() > 0);
+         assertEquals("copy jar size", jar.getSize(), tmpJar.length());
+         jar.close();
+      }
+      finally
+      {
+         try
+         {
+            tmpJar.delete();
+         }
+         catch(Exception ignore)
+         {
+         }
+      }
+   }
+
+   /**
+    * Test copying a jar that is nested in another jar.
+    * 
+    * @throws Exception
+    */
+   public void testCopyInnerJar()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile outerjar = vfs.findChild("outer.jar");
+      assertTrue("outer.jar != null", outerjar != null);
+      VirtualFile jar = outerjar.findChild("jar1.jar");
+      assertTrue("outer.jar/jar1.jar != null", jar != null);
+
+      File tmpJar = File.createTempFile("testCopyInnerJar", ".jar");
+      tmpJar.deleteOnExit();
+
+      try
+      {
+         InputStream is = jar.openStream();
+         FileOutputStream fos = new FileOutputStream(tmpJar);
+         byte[] buffer = new byte[1024];
+         int read;
+         while( (read = is.read(buffer)) > 0 )
+         {
+            fos.write(buffer, 0, read);
+         }
+         fos.close();
+         log.debug("outer.jar/jar1.jar size is: "+jar.getSize());
+         log.debug(tmpJar.getAbsolutePath()+" size is: "+tmpJar.length());
+         assertTrue("outer.jar > 0", jar.getSize() > 0);
+         assertEquals("copy jar size", jar.getSize(), tmpJar.length());
+         jar.close();
+      }
+      finally
+      {
+         try
+         {
+            tmpJar.delete();
+         }
+         catch(Exception ignore)
+         {
+         }
+      }
+   }
+
+   /**
+    * Test that the outermf.jar manifest classpath is parsed
+    * correctly.
+    * 
+    * @throws Exception
+    */
+   public void testManifestClasspath()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile outerjar = vfs.findChild("outermf.jar");
+      assertNotNull("outermf.jar != null", outerjar);
+
+      ArrayList<VirtualFile> cp = new ArrayList<VirtualFile>();
+      VFSUtils.addManifestLocations(outerjar, cp);
+      // The p0.jar should be found in the classpath
+      assertEquals("cp size 2", 2, cp.size());
+      assertEquals("jar1.jar == cp[0]", "jar1.jar", cp.get(0).getName());
+      assertEquals("jar2.jar == cp[1]", "jar2.jar", cp.get(1).getName());
+   }
+   /**
+    * Test that an inner-inner jar that is extracted does not blowup
+    * the addManifestLocations routine.
+    * 
+    * @throws Exception
+    */
+   public void testInnerManifestClasspath()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile outerjar = vfs.findChild("withalong/rootprefix/outermf.jar");
+      VirtualFile conatinerjar = outerjar.findChild("inner-container.jar");
+      VirtualFile innerjar = conatinerjar.findChild("innermf.jar");
+      assertNotNull("innermf.jar != null", innerjar);
+   
+      ArrayList<VirtualFile> cp = new ArrayList<VirtualFile>();
+      VFSUtils.addManifestLocations(innerjar, cp);
+      // Don't really care what the cp is...
+   }
+
+   /**
+    * Validate accessing an packed jar vf and its uri when the vfs path
+    * contains spaces
+    * @throws Exception
+    */
+   public void testJarWithSpacesInPath()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tstjar = vfs.findChild("path with spaces/tst.jar");
+      assertNotNull("tstjar != null", tstjar);
+      URI uri = tstjar.toURI();
+      URI expectedURI = new URI("vfs"+rootURL.toString()+"/path%20with%20spaces/tst.jar");
+      assertEquals(uri, expectedURI);
+   }
+
+   public static void main(String[] args) throws Exception
+   {
+      File file = new File("C:\\Documents and Settings");
+      System.out.println(file.toURI());
+      System.out.println(file.toURL().getHost());
+      URI uri = new URI("file", null, "/Document and Settings", null);
+      System.out.println(uri);
+   }
+
+   /**
+    * Validate accessing an unpacked jar vf and its uri when the vfs path
+    * contains spaces
+    * @throws Exception
+    */
+   public void testUnpackedJarWithSpacesInPath()
+      throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tstjar = vfs.findChild("path with spaces/unpacked-tst.jar");
+      assertNotNull("tstjar != null", tstjar);
+      URI uri = tstjar.toURI();
+      URI expectedURI = new URI("vfs" + rootURL.toString()+"/path%20with%20spaces/unpacked-tst.jar/");
+      assertEquals(uri, expectedURI);
+   }
+
+   /**
+    * Tests that we can find the META-INF/some-data.xml in an unpacked deployment
+    * 
+    * @throws Exception for any error
+    */
+   public void testGetMetaDataUnpackedJar() throws Exception
+   {
+      testGetMetaDataFromJar("unpacked-with-metadata.jar");
+   }
+   
+   /**
+    * Tests that we can find the META-INF/some-data.xml in a packed deployment
+    * 
+    * @throws Exception for any error
+    */
+   public void testGetMetaDataPackedJar() throws Exception
+   {
+      testGetMetaDataFromJar("with-metadata.jar");
+   }
+   
+   private void testGetMetaDataFromJar(String name) throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      
+      VirtualFile jar = vfs.findChild(name);
+      assertNotNull(jar);
+      VirtualFile metadataLocation = jar.findChild("META-INF");
+      assertNotNull(metadataLocation);
+
+      VirtualFile metadataByName = metadataLocation.findChild("some-data.xml");
+      assertNotNull(metadataByName);
+      
+      //This is the same code as is called by AbstractDeploymentContext.getMetaDataFiles(String name, String suffix). 
+      //The MetaDataMatchFilter is a copy of the one used there
+      List<VirtualFile> metaDataList = metadataLocation.getChildren(new MetaDataMatchFilter(null, "-data.xml"));
+      assertNotNull(metaDataList);
+      assertEquals("Wrong size", 1, metaDataList.size());
+   }
+
+   /**
+    * Validate that a URLClassLoader.findReource/getResourceAsStream calls for non-existing absolute
+    * resources that should fail as expected with null results. Related to JBMICROCONT-139.
+    * 
+    * @throws Exception
+    */
+   public void testURLClassLoaderFindResourceFailure() throws Exception
+   {
+      URL rootURL = getResource("/vfs/test");
+      VFS vfs = VFS.getVFS(rootURL);
+      URL[] cp = {vfs.getRoot().toURL()};
+      URLClassLoader ucl = new URLClassLoader(cp);
+      // Search for a non-existent absolute resource
+      URL qp = ucl.findResource("/nosuch-quartz.props");
+      assertNull("findResource(/nosuch-quartz.props)", qp);
+      InputStream is = ucl.getResourceAsStream("/nosuch-quartz.props");
+      assertNull("getResourceAsStream(/nosuch-quartz.props)", is);
+   }
+
+   /**
+    * Test VirtualFile.exists for vfsfile based urls.
+    * 
+    * @throws Exception
+    */
+   public void testFileExists()
+      throws Exception
+   {
+      File tmpRoot = File.createTempFile("vfs", ".root");
+      tmpRoot.delete();
+      tmpRoot.mkdir();
+      File tmp = File.createTempFile("testFileExists", null, tmpRoot);
+      log.info("+++ testFileExists, tmp="+tmp.getCanonicalPath());
+
+      URL rootURL = tmpRoot.toURL();
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tmpVF = vfs.findChild(tmp.getName());
+      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertTrue("tmp.delete()", tmp.delete());
+      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
+   }
+
+   /**
+    * Test VirtualFile.exists for vfsfile based urls for a directory.
+    * 
+    * @throws Exception
+    */
+   public void testDirFileExists()
+      throws Exception
+   {
+      File tmpRoot = File.createTempFile("vfs", ".root");
+      tmpRoot.delete();
+      tmpRoot.mkdir();
+      File tmp = File.createTempFile("testFileExists", null, tmpRoot);
+      assertTrue(tmp+".delete()", tmp.delete());
+      assertTrue(tmp+".mkdir()", tmp.mkdir());
+      log.info("+++ testDirFileExists, tmp="+tmp.getCanonicalPath());
+
+      URL rootURL = tmpRoot.toURL();
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tmpVF = vfs.findChild(tmp.getName());
+      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertFalse(tmpVF.getPathName()+".isLeaf()", tmpVF.isLeaf());
+      assertTrue(tmp+".delete()", tmp.delete());
+      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
+   }
+
+   /**
+    * Test VirtualFile.exists for vfsjar based urls.
+    * 
+    * @throws Exception
+    */
+   public void testJarExists()
+      throws Exception
+   {
+      File tmpRoot = File.createTempFile("vfs", ".root");
+      tmpRoot.delete();
+      tmpRoot.mkdir();
+      File tmpJar = File.createTempFile("testJarExists", ".jar", tmpRoot);
+      log.info("+++ testJarExists, tmpJar="+tmpJar.getCanonicalPath());
+      Manifest mf = new Manifest();
+      mf.getMainAttributes().putValue("Created-By", "FileVFSUnitTestCase.testJarExists");
+      FileOutputStream fos = new FileOutputStream(tmpJar);
+      JarOutputStream jos = new JarOutputStream(fos, mf);
+      jos.setComment("testJarExists");
+      jos.setLevel(0);
+      jos.close();
+
+      URL rootURL = tmpRoot.toURL();
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tmpVF = vfs.findChild(tmpJar.getName());
+      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertTrue(tmpVF.getPathName()+".size() > 0", tmpVF.getSize() > 0);
+      assertTrue("tmp.delete()", tmpJar.delete());
+      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
+   }
+
+   /**
+    * Test VirtualFile.exists for vfsjar based urls for a directory.
+    * 
+    * @throws Exception
+    */
+   public void testDirJarExists()
+      throws Exception
+   {
+      File tmpRoot = File.createTempFile("vfs", ".root");
+      tmpRoot.delete();
+      tmpRoot.mkdir();
+      File tmp = File.createTempFile("testDirJarExists", ".jar", tmpRoot);
+      assertTrue(tmp+".delete()", tmp.delete());
+      assertTrue(tmp+".mkdir()", tmp.mkdir());
+      log.info("+++ testDirJarExists, tmp="+tmp.getCanonicalPath());
+
+      URL rootURL = tmpRoot.toURL();
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tmpVF = vfs.findChild(tmp.getName());
+      log.info(tmpVF.getHandler());
+      assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertFalse(tmpVF.getPathName()+".isLeaf()", tmpVF.isLeaf());
+      assertTrue(tmp+".delete()", tmp.delete());
+      assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
+      assertTrue(tmpRoot+".delete()", tmpRoot.delete());
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,329 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.test.virtual.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-
-import org.jboss.test.BaseTestCase;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
-import org.jboss.virtual.plugins.context.memory.MemoryContextHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactory;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.virtual.spi.VirtualFileHandler;
-import junit.framework.Test;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class MemoryTestCase extends BaseTestCase
-{
-   public MemoryTestCase(String name)
-   {
-      super(name);
-   }
-
-   public static Test suite()
-   {
-      return suite(MemoryTestCase.class);
-   }
-
-   public void testSerializable() throws Exception
-   {
-      URI uri = new URI("vfsmemory://aopdomain");
-      URL root = new URL("vfsmemory://aopdomain");
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
-      VFSContext ctx = factory.getVFS(uri);
-      MemoryContextHandler parent = new MemoryContextHandler(ctx, null, root, "aopdomain");
-
-      URI uri2 = new URI("vfsmemory://aopdomain/child");
-      URL root2 = new URL("vfsmemory://aopdomain/child");
-      VFSContextFactory factory2 = VFSContextFactoryLocator.getFactory(uri2);
-      VFSContext ctx2 = factory2.getVFS(uri);
-      MemoryContextHandler child = new MemoryContextHandler(ctx2, parent, root2, "child");
-
-      serializeDeserialize(child, MemoryContextHandler.class);
-
-      byte[] bytes = serialize(parent);
-      Object deserializedObject = deserialize(bytes);
-      assertInstanceOf(deserializedObject, MemoryContextHandler.class);
-      MemoryContextHandler desParent = (MemoryContextHandler)deserializedObject;
-
-      List<VirtualFileHandler> list = desParent.getChildren(true);
-      assertNotNull(list);
-      assertFalse(list.isEmpty());
-      assertNotNull(desParent.findChild("child"));
-   }
-
-   public void testContextFactory()throws Exception
-   {
-      URI uri = new URI("vfsmemory://aopdomain");
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
-      assertNotNull(factory);
-   }
-   
-   public void testContext() throws Exception
-   {
-      URI uri = new URI("vfsmemory://aopdomain");
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
-      VFSContext ctx = factory.getVFS(uri);
-      assertNotNull(ctx);
-      
-      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
-      assertNotNull(mfactory);
-      assertSame(factory, mfactory);
-      
-      VFSContext mctx = mfactory.createRoot(uri.toURL());
-      assertNotNull(mctx);
-      assertSame(ctx, mctx);
-   }
-   
-   public void testWriteAndReadData() throws Exception
-   {
-      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
-      URL root = new URL("vfsmemory://aopdomain");
-      try
-      {
-         long now = System.currentTimeMillis();
-         VFSContext ctx = mfactory.createRoot(root);
-         URL url = new URL("vfsmemory://aopdomain/org/acme/test/Test.class");
-         mfactory.putFile(url,  new byte[] {'a', 'b', 'c'});
-         
-         String read = readURL(url);
-         assertEquals("abc", read);
-
-         VirtualFile classFile = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/test/Test.class");
-         InputStream bis = classFile.openStream();
-         read = readIS(bis);
-         assertEquals("abc", read);
-         assertEquals(3, classFile.getSize());
-         assertTrue(classFile.exists());
-         assertTrue(classFile.isLeaf());
-         assertTrue(classFile.getLastModified() >= now);
-
-         assertTrue(mfactory.delete(url));
-         try
-         {
-            InputStream is = url.openStream();
-            fail("Should not have found file");
-         }
-         catch(Exception expected)
-         {
-         }
-         
-         ctx = mfactory.find("aopdomain");
-         assertNotNull(ctx);
-         
-         assertTrue(mfactory.deleteRoot(root));
-         ctx = mfactory.find("aopdomain");
-         assertNull(ctx);
-      }
-      finally
-      {
-         mfactory.deleteRoot(root);
-      }
-   }
-   
-   public void testMultipleFiles() throws Exception
-   {
-      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
-      URL root = new URL("vfsmemory://aopdomain");
-      try
-      {
-         VFSContext ctx = mfactory.createRoot(root);
-         
-         URL urlA = new URL("vfsmemory://aopdomain/org/acme/test/Test.class");
-         mfactory.putFile(urlA,  new byte[] {'a', 'b', 'c'});
-         
-         URL urlB = new URL("vfsmemory://aopdomain/org/foo/test/Test.class");
-         mfactory.putFile(urlB,  new byte[] {'d', 'e', 'f'});
-         
-         String readA = readURL(urlA);
-         assertEquals("abc", readA);
-         
-         String readB = readURL(urlB);
-         assertEquals("def", readB);
-      }
-      finally
-      {
-         mfactory.deleteRoot(root);
-      }
-   }
-
-   public void testNavigate() throws Exception
-   {
-      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
-      URL root = new URL("vfsmemory://aopdomain");
-      try
-      {
-         VFSContext ctx = mfactory.createRoot(root);
-         URL url = new URL("vfsmemory://aopdomain/org/acme/test/Test.class");
-         mfactory.putFile(url,  new byte[] {'a', 'b', 'c'});
-         URL url2 = new URL("vfsmemory://aopdomain/org/acme/test/Test2.class");
-         mfactory.putFile(url2,  new byte[] {'a', 'b', 'c'});
-         URL url3 = new URL("vfsmemory://aopdomain/org/acme/test/Test3.class");
-         mfactory.putFile(url3,  new byte[] {'a', 'b', 'c'});
-         
-         VFS vfs = ctx.getVFS();
-         VirtualFile file = vfs.getVirtualFile(root, "/org/acme/test/Test.class");
-         assertNotNull(file);
-         
-         VirtualFile file2 = vfs.getVirtualFile(root, "/org");
-         assertNotNull(file2);
-         VirtualFile test = file2.findChild("/acme/test/Test.class");
-         assertNotNull(test);
-         assertSame(file.getHandler(), test.getHandler());
-         
-         //acme
-         List<VirtualFile> children = file2.getChildren();
-         assertEquals(1,children.size());
-         VirtualFile child = children.get(0);
-         //test
-         children = child.getChildren();
-         assertEquals(1,children.size());
-         child = children.get(0);
-         //test/*.class
-         children = child.getChildren();
-         assertEquals(3,children.size());
-         HashMap<String, VirtualFile> childMap = new HashMap<String, VirtualFile>();  
-         for (VirtualFile cur : children)
-         {
-            childMap.put(cur.getName(), cur);
-         }
-         assertNotNull(childMap.get("Test.class"));
-         assertNotNull(childMap.get("Test2.class"));
-         assertNotNull(childMap.get("Test3.class"));
-      }
-      finally
-      {
-         mfactory.deleteRoot(root);
-      }
-   }
-
-   public void testLeaf() throws Exception
-   {
-      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
-      URL root = new URL("vfsmemory://aopdomain");
-      try
-      {
-         VFSContext ctx = mfactory.createRoot(root);
-         URL url = new URL("vfsmemory://aopdomain/org/acme/leaf");
-         mfactory.putFile(url,  new byte[] {'a', 'b', 'c'});
-
-         URL url2 = new URL("vfsmemory://aopdomain/org/acme/leaf/shouldnotwork");
-         try
-         {
-            mfactory.putFile(url2,  new byte[] {'d', 'e', 'f'});
-            fail("It should not have been possible to add a child to a leaf node");
-         }
-         catch(Exception e)
-         {
-         }
-         
-         VirtualFile classFile = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/leaf");
-         assertNotNull(classFile);
-         try
-         {
-            VirtualFile classFile2 = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/leaf/shouldnotwork");
-            fail("It should not have been possible to find a child of a leaf node");
-         }
-         catch (Exception expected)
-         {
-         }
-         
-         
-         try
-         {
-            URL url3 = new URL("vfsmemory://aopdomain/org/acme");
-            mfactory.putFile(url3, new byte[] {'1', '2', '3'});
-            fail("Should not have been possible to set contents for a non-leaf node");
-         }
-         catch (Exception expected)
-         {
-         }
-         
-         try
-         {
-            URL url4 = new URL("vfsmemory://aopdomain/org");
-            mfactory.putFile(url4, new byte[] {'1', '2', '3'});
-            fail("Should not have been possible to set contents for a non-leaf node");
-         }
-         catch (Exception expected)
-         {
-         }
-      }
-      finally
-      {
-         mfactory.deleteRoot(root);
-      }
-   }
-   
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      VFS.init();
-      getLog().info("java.protocol.handler.pkgs: " + System.getProperty("java.protocol.handler.pkgs"));
-   }
-
-   private String readURL(URL url) throws IOException
-   {
-      InputStream is = url.openStream();
-      return readIS(is);
-   }
-
-   private String readIS(InputStream is)
-      throws IOException
-   {
-      try
-      {
-         StringBuffer sb = new StringBuffer();
-         while (is.available() != 0)
-         {
-            sb.append((char)is.read());
-         }
-         return sb.toString();
-      }
-      finally
-      {
-         if (is != null)
-         {
-            try
-            {
-               is.close();
-            }
-            catch(Exception ignore)
-            {
-            }
-         }
-      }      
-   }
-   
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,329 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+
+import org.jboss.test.BaseTestCase;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
+import org.jboss.virtual.plugins.context.memory.MemoryContextHandler;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VFSContextFactory;
+import org.jboss.virtual.spi.VFSContextFactoryLocator;
+import org.jboss.virtual.spi.VirtualFileHandler;
+import junit.framework.Test;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MemoryTestCase extends BaseTestCase
+{
+   public MemoryTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(MemoryTestCase.class);
+   }
+
+   public void testSerializable() throws Exception
+   {
+      URI uri = new URI("vfsmemory://aopdomain");
+      URL root = new URL("vfsmemory://aopdomain");
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
+      VFSContext ctx = factory.getVFS(uri);
+      MemoryContextHandler parent = new MemoryContextHandler(ctx, null, root, "aopdomain");
+
+      URI uri2 = new URI("vfsmemory://aopdomain/child");
+      URL root2 = new URL("vfsmemory://aopdomain/child");
+      VFSContextFactory factory2 = VFSContextFactoryLocator.getFactory(uri2);
+      VFSContext ctx2 = factory2.getVFS(uri);
+      MemoryContextHandler child = new MemoryContextHandler(ctx2, parent, root2, "child");
+
+      serializeDeserialize(child, MemoryContextHandler.class);
+
+      byte[] bytes = serialize(parent);
+      Object deserializedObject = deserialize(bytes);
+      assertInstanceOf(deserializedObject, MemoryContextHandler.class);
+      MemoryContextHandler desParent = (MemoryContextHandler)deserializedObject;
+
+      List<VirtualFileHandler> list = desParent.getChildren(true);
+      assertNotNull(list);
+      assertFalse(list.isEmpty());
+      assertNotNull(desParent.getChild("child"));
+   }
+
+   public void testContextFactory()throws Exception
+   {
+      URI uri = new URI("vfsmemory://aopdomain");
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
+      assertNotNull(factory);
+   }
+   
+   public void testContext() throws Exception
+   {
+      URI uri = new URI("vfsmemory://aopdomain");
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(uri);
+      VFSContext ctx = factory.getVFS(uri);
+      assertNotNull(ctx);
+      
+      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
+      assertNotNull(mfactory);
+      assertSame(factory, mfactory);
+      
+      VFSContext mctx = mfactory.createRoot(uri.toURL());
+      assertNotNull(mctx);
+      assertSame(ctx, mctx);
+   }
+   
+   public void testWriteAndReadData() throws Exception
+   {
+      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
+      URL root = new URL("vfsmemory://aopdomain");
+      try
+      {
+         long now = System.currentTimeMillis();
+         VFSContext ctx = mfactory.createRoot(root);
+         URL url = new URL("vfsmemory://aopdomain/org/acme/test/Test.class");
+         mfactory.putFile(url,  new byte[] {'a', 'b', 'c'});
+         
+         String read = readURL(url);
+         assertEquals("abc", read);
+
+         VirtualFile classFile = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/test/Test.class");
+         InputStream bis = classFile.openStream();
+         read = readIS(bis);
+         assertEquals("abc", read);
+         assertEquals(3, classFile.getSize());
+         assertTrue(classFile.exists());
+         assertTrue(classFile.isLeaf());
+         assertTrue(classFile.getLastModified() >= now);
+
+         assertTrue(mfactory.delete(url));
+         try
+         {
+            InputStream is = url.openStream();
+            fail("Should not have found file");
+         }
+         catch(Exception expected)
+         {
+         }
+         
+         ctx = mfactory.find("aopdomain");
+         assertNotNull(ctx);
+         
+         assertTrue(mfactory.deleteRoot(root));
+         ctx = mfactory.find("aopdomain");
+         assertNull(ctx);
+      }
+      finally
+      {
+         mfactory.deleteRoot(root);
+      }
+   }
+   
+   public void testMultipleFiles() throws Exception
+   {
+      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
+      URL root = new URL("vfsmemory://aopdomain");
+      try
+      {
+         VFSContext ctx = mfactory.createRoot(root);
+         
+         URL urlA = new URL("vfsmemory://aopdomain/org/acme/test/Test.class");
+         mfactory.putFile(urlA,  new byte[] {'a', 'b', 'c'});
+         
+         URL urlB = new URL("vfsmemory://aopdomain/org/foo/test/Test.class");
+         mfactory.putFile(urlB,  new byte[] {'d', 'e', 'f'});
+         
+         String readA = readURL(urlA);
+         assertEquals("abc", readA);
+         
+         String readB = readURL(urlB);
+         assertEquals("def", readB);
+      }
+      finally
+      {
+         mfactory.deleteRoot(root);
+      }
+   }
+
+   public void testNavigate() throws Exception
+   {
+      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
+      URL root = new URL("vfsmemory://aopdomain");
+      try
+      {
+         VFSContext ctx = mfactory.createRoot(root);
+         URL url = new URL("vfsmemory://aopdomain/org/acme/test/Test.class");
+         mfactory.putFile(url,  new byte[] {'a', 'b', 'c'});
+         URL url2 = new URL("vfsmemory://aopdomain/org/acme/test/Test2.class");
+         mfactory.putFile(url2,  new byte[] {'a', 'b', 'c'});
+         URL url3 = new URL("vfsmemory://aopdomain/org/acme/test/Test3.class");
+         mfactory.putFile(url3,  new byte[] {'a', 'b', 'c'});
+         
+         VFS vfs = ctx.getVFS();
+         VirtualFile file = vfs.getVirtualFile(root, "/org/acme/test/Test.class");
+         assertNotNull(file);
+         
+         VirtualFile file2 = vfs.getVirtualFile(root, "/org");
+         assertNotNull(file2);
+         VirtualFile test = file2.findChild("/acme/test/Test.class");
+         assertNotNull(test);
+         assertSame(file.getHandler(), test.getHandler());
+         
+         //acme
+         List<VirtualFile> children = file2.getChildren();
+         assertEquals(1,children.size());
+         VirtualFile child = children.get(0);
+         //test
+         children = child.getChildren();
+         assertEquals(1,children.size());
+         child = children.get(0);
+         //test/*.class
+         children = child.getChildren();
+         assertEquals(3,children.size());
+         HashMap<String, VirtualFile> childMap = new HashMap<String, VirtualFile>();  
+         for (VirtualFile cur : children)
+         {
+            childMap.put(cur.getName(), cur);
+         }
+         assertNotNull(childMap.get("Test.class"));
+         assertNotNull(childMap.get("Test2.class"));
+         assertNotNull(childMap.get("Test3.class"));
+      }
+      finally
+      {
+         mfactory.deleteRoot(root);
+      }
+   }
+
+   public void testLeaf() throws Exception
+   {
+      MemoryContextFactory mfactory = MemoryContextFactory.getInstance();
+      URL root = new URL("vfsmemory://aopdomain");
+      try
+      {
+         VFSContext ctx = mfactory.createRoot(root);
+         URL url = new URL("vfsmemory://aopdomain/org/acme/leaf");
+         mfactory.putFile(url,  new byte[] {'a', 'b', 'c'});
+
+         URL url2 = new URL("vfsmemory://aopdomain/org/acme/leaf/shouldnotwork");
+         try
+         {
+            mfactory.putFile(url2,  new byte[] {'d', 'e', 'f'});
+            fail("It should not have been possible to add a child to a leaf node");
+         }
+         catch(Exception e)
+         {
+         }
+         
+         VirtualFile classFile = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/leaf");
+         assertNotNull(classFile);
+         try
+         {
+            VirtualFile classFile2 = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/leaf/shouldnotwork");
+            fail("It should not have been possible to find a child of a leaf node");
+         }
+         catch (Exception expected)
+         {
+         }
+         
+         
+         try
+         {
+            URL url3 = new URL("vfsmemory://aopdomain/org/acme");
+            mfactory.putFile(url3, new byte[] {'1', '2', '3'});
+            fail("Should not have been possible to set contents for a non-leaf node");
+         }
+         catch (Exception expected)
+         {
+         }
+         
+         try
+         {
+            URL url4 = new URL("vfsmemory://aopdomain/org");
+            mfactory.putFile(url4, new byte[] {'1', '2', '3'});
+            fail("Should not have been possible to set contents for a non-leaf node");
+         }
+         catch (Exception expected)
+         {
+         }
+      }
+      finally
+      {
+         mfactory.deleteRoot(root);
+      }
+   }
+   
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      VFS.init();
+      getLog().info("java.protocol.handler.pkgs: " + System.getProperty("java.protocol.handler.pkgs"));
+   }
+
+   private String readURL(URL url) throws IOException
+   {
+      InputStream is = url.openStream();
+      return readIS(is);
+   }
+
+   private String readIS(InputStream is)
+      throws IOException
+   {
+      try
+      {
+         StringBuffer sb = new StringBuffer();
+         while (is.available() != 0)
+         {
+            sb.append((char)is.read());
+         }
+         return sb.toString();
+      }
+      finally
+      {
+         if (is != null)
+         {
+            try
+            {
+               is.close();
+            }
+            catch(Exception ignore)
+            {
+            }
+         }
+      }      
+   }
+   
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,1383 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jboss.test.virtual.support.MockURLStreamHandler;
-import org.jboss.test.virtual.support.MockVFSContext;
-import org.jboss.test.virtual.support.MockVirtualFileFilter;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
-
-/**
- * VFSUnitTestCase.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSUnitTestCase extends AbstractMockVFSTest
-{
-   public VFSUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   public static Test suite()
-   {
-      return new TestSuite(VFSUnitTestCase.class);
-   }
-
-   public void testGetVFSURI() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      MockVFSContext context2 = registerSimple2VFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      assertNotNull(vfs);
-      assertEquals(context.getVFS(), vfs);
-      
-      VFS vfs2 = VFS.getVFS(context2.getRootURI());
-      assertNotNull(vfs2);
-      assertEquals(context2.getVFS(), vfs2);
-   }
-
-   public void testGetVFSURINull() throws Exception
-   {
-      try
-      {
-         VFS.getVFS((URI) null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetVFSURINoFactory() throws Exception
-   {
-      try
-      {
-         URI uri = new URI("doesnotexist:///");
-         VFS.getVFS(uri);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVFSURIIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      mockVFSContextFactory.setIOException("getVFSURI");
-
-      try
-      {
-         VFS.getVFS(context.getRootURI());
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVFSURL() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      MockVFSContext context2 = registerSimple2VFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURL());
-      assertNotNull(vfs);
-      assertEquals(context.getVFS(), vfs);
-      
-      VFS vfs2 = VFS.getVFS(context2.getRootURL());
-      assertNotNull(vfs2);
-      assertEquals(context2.getVFS(), vfs2);
-   }
-
-   public void testGetVFSURLNull() throws Exception
-   {
-      try
-      {
-         VFS.getVFS((URL) null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetVFSURLNoFactory() throws Exception
-   {
-      try
-      {
-         URL url = new URL("doesnotexist", "", 0, "", MockURLStreamHandler.INSTANCE);
-         VFS.getVFS(url);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVFSURLIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      mockVFSContextFactory.setIOException("getVFSURL");
-
-      try
-      {
-         VFS.getVFS(context.getRootURL());
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetRootURI() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertNotNull(file);
-      assertEquals(context.getRoot().getVirtualFile(), file);
-   }
-
-   public void testGetRootURINullURI() throws Exception
-   {
-      try
-      {
-         VFS.getRoot((URI) null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetRootURINoFactory() throws Exception
-   {
-      try
-      {
-         URI uri = new URI("doesnotexist:///");
-         VFS.getRoot(uri);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetRootURIIOExceptionGetVFS() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      mockVFSContextFactory.setIOException("getVFSURI");
-
-      try
-      {
-         VFS.getRoot(context.getRootURI());
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetRootURIIOExceptionGetRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.setIOException("getRoot");
-
-      try
-      {
-         VFS.getRoot(context.getRootURI());
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURIRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      VirtualFile file = VFS.getVirtualFile(context.getRootURI(), "");
-      assertNotNull(file);
-      assertEquals(context.getRoot().getVirtualFile(), file);
-   }
-
-   public void testGetVirtualFileURIChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file1 = VFS.getVirtualFile(context.getRootURI(), "child1");
-      assertNotNull(file1);
-      assertEquals(child1, file1);
-      
-      VirtualFile file2 = VFS.getVirtualFile(context.getRootURI(), "child2");
-      assertNotNull(file2);
-      assertEquals(child2, file2);
-      
-      VirtualFile file3 = VFS.getVirtualFile(context.getRootURI(), "child3");
-      assertNotNull(file3);
-      assertEquals(child3, file3);
-   }
-
-   public void testGetVirtualFileURINullURI() throws Exception
-   {
-      try
-      {
-         VFS.getVirtualFile((URI) null, "");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURINullPath() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURI(), null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURINoFactory() throws Exception
-   {
-      try
-      {
-         URI uri = new URI("doesnotexist:///");
-         VFS.getVirtualFile(uri, "");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURIDoesNotExist() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURI(), "doesnotexist");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURIIOExceptionGetVFS() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      mockVFSContextFactory.setIOException("getVFSURI");
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURI(), "child1");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURIIOExceptionFindChild() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("findChild");
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURI(), "child1");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetRootURL() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURL());
-      assertNotNull(file);
-      assertEquals(context.getRoot().getVirtualFile(), file);
-   }
-
-   public void testGetRootURLNullURL() throws Exception
-   {
-      try
-      {
-         VFS.getRoot((URL) null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetRootURLNoFactory() throws Exception
-   {
-      URL url = new URL("doesnotexist", "", 0, "", MockURLStreamHandler.INSTANCE);
-      try
-      {
-         VFS.getRoot(url);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetRootURLIOExceptionGetVFS() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      mockVFSContextFactory.setIOException("getVFSURL");
-
-      URL url = context.getRootURL();
-      try
-      {
-         VFS.getRoot(url);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetRootURLIOExceptionGetRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.setIOException("getRoot");
-
-      URL url = context.getRootURL();
-      try
-      {
-         VFS.getRoot(url);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURLRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      VirtualFile file = VFS.getVirtualFile(context.getRootURL(), "");
-      assertNotNull(file);
-      assertEquals(context.getRoot().getVirtualFile(), file);
-   }
-
-   public void testGetVirtualFileURLChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file1 = VFS.getVirtualFile(context.getRootURL(), "child1");
-      assertNotNull(file1);
-      assertEquals(child1, file1);
-      
-      VirtualFile file2 = VFS.getVirtualFile(context.getRootURL(), "child2");
-      assertNotNull(file2);
-      assertEquals(child2, file2);
-      
-      VirtualFile file3 = VFS.getVirtualFile(context.getRootURL(), "child3");
-      assertNotNull(file3);
-      assertEquals(child3, file3);
-   }
-
-   public void testGetVirtualFileURLNullURL() throws Exception
-   {
-      try
-      {
-         VFS.getVirtualFile((URL) null, "");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURLNullPath() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURL(), null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURLNoFactory() throws Exception
-   {
-      try
-      {
-         URL url = new URL("doesnotexist", "", 0, "", MockURLStreamHandler.INSTANCE);
-         VFS.getVirtualFile(url, "");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURLIOExceptionGetVFS() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      mockVFSContextFactory.setIOException("getVFSURL");
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURL(), "child1");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURLDoesNotExist() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURL(), "doesnotexist");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetVirtualFileURLIOExceptionFindChild() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("findChild");
-
-      try
-      {
-         VFS.getVirtualFile(context.getRootURL(), "child1");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      assertNotNull(vfs);
-
-      VirtualFile root = vfs.getRoot();
-      assertNotNull(root);
-      
-      assertEquals(context.getRoot().getVirtualFile(), root);
-   }
-
-   public void testGetRootIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.setIOException("getRoot");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      assertNotNull(vfs);
-
-      try
-      {
-         vfs.getRoot();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testFindChildRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      
-      assertFindChild(vfs, "", vfs.getRoot());
-   }
-
-   public void testFindChildChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      assertFindChild(vfs, "child1", child1);
-      assertFindChild(vfs, "child2", child2);
-      assertFindChild(vfs, "child3", child3);
-   }
-
-   public void testFindChildSubChildren() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      assertFindChild(vfs, "child1", child1);
-      assertFindChild(vfs, "child1/child1,1", child11);
-      assertFindChild(vfs, "child2", child2);
-      assertFindChild(vfs, "child2/child2,1", child21);
-      assertFindChild(vfs, "child2/child2,2", child22);
-      assertFindChild(vfs, "child3", child3);
-      assertFindChild(vfs, "child3/child3,1", child31);
-      assertFindChild(vfs, "child3/child3,2", child32);
-      assertFindChild(vfs, "child3/child3,3", child33);
-   }
-
-   public void testFindChildNullPath() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      try
-      {
-         VFS vfs = VFS.getVFS(context.getRootURI());
-         vfs.findChild(null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testFindChildSimpleDoesNotExist() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      try
-      {
-         VFS vfs = VFS.getVFS(context.getRootURI());
-         vfs.findChild("doesnotexist");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testFindChildStructuredDoesNotExist() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-
-      try
-      {
-         VFS vfs = VFS.getVFS(context.getRootURI());
-         vfs.findChild("child1/doesnotexist");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testFindChildIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("findChild");
-
-      try
-      {
-         VFS vfs = VFS.getVFS(context.getRootURI());
-         vfs.findChild("child1");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildren();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildren();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildren();
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildren();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildren();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithNullFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildren(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenWithNullFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildren(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenWithNullFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildren(null);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenWithNullFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildren(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithNullFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildren(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = vfs.getChildren(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenWithFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = vfs.getChildren(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenWithFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = vfs.getChildren(filter);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-      assertEmpty(filter.getVisited());
-   }
-
-   public void testGetAllChildrenWithFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         vfs.getChildren(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         vfs.getChildren(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursively() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildrenRecursively();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildrenRecursively();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child11);
-      expected.add(child2);
-      expected.add(child21);
-      expected.add(child22);
-      expected.add(child3);
-      expected.add(child31);
-      expected.add(child32);
-      expected.add(child33);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildrenRecursively();
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenRecursivelyIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildrenRecursively();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildrenRecursively();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildrenRecursively(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildrenRecursively(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child11);
-      expected.add(child2);
-      expected.add(child21);
-      expected.add(child22);
-      expected.add(child3);
-      expected.add(child31);
-      expected.add(child32);
-      expected.add(child33);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      List<VirtualFile> children = vfs.getChildrenRecursively(null);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildrenRecursively(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.getChildrenRecursively(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = vfs.getChildrenRecursively(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = vfs.getChildrenRecursively(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child11);
-      expected.add(child2);
-      expected.add(child21);
-      expected.add(child22);
-      expected.add(child3);
-      expected.add(child31);
-      expected.add(child32);
-      expected.add(child33);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = vfs.getChildrenRecursively(filter);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-      assertEmpty(filter.getVisited());
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         vfs.getChildren(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         vfs.getChildrenRecursively(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testVisitAllChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      vfs.visit(visitor);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testVisitAllChildrenStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      vfs.visit(visitor);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testVisitAllChildrenNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      vfs.visit(visitor);
-
-      assertEmpty(filter.getVisited());
-   }
-
-   public void testVisitAllChildrenIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      try
-      {
-         vfs.visit(visitor);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testVisitAllChildrenNullVisitor() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      try
-      {
-         vfs.visit(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testVisitAllChildrenIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VFS vfs = VFS.getVFS(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      try
-      {
-         vfs.visit(visitor);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-   
-   public void testToString() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      VFS vfs = context.getVFS();
-      
-      assertEquals(context.toString(), vfs.toString());
-   }
-   
-   public void testHashCode() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      VFS vfs = context.getVFS();
-      
-      assertEquals(context.hashCode(), vfs.hashCode());
-   }
-   
-   public void testEquals() throws Exception
-   {
-      MockVFSContext context1 = createSimpleVFSContext();
-      MockVFSContext context2 = createSimpleVFSContext();
-      
-      VFS vfs1 = context1.getVFS();
-      VFS vfs2 = context2.getVFS();
-
-      assertEquals(vfs1, vfs2);
-      
-      MockVFSContext context3 = createSimple2VFSContext();
-      VFS vfs3 = context3.getVFS();
-
-      assertFalse(vfs1.equals(vfs3));
-      assertFalse(vfs2.equals(vfs3));
-
-      assertFalse(vfs1.equals(null));
-
-      assertFalse(vfs1.equals(new Object()));
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,1418 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.virtual.support.MockURLStreamHandler;
+import org.jboss.test.virtual.support.MockVFSContext;
+import org.jboss.test.virtual.support.MockVirtualFileFilter;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+
+/**
+ * VFSUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSUnitTestCase extends AbstractMockVFSTest
+{
+   public VFSUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(VFSUnitTestCase.class);
+   }
+
+   public void testGetVFSURI() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      MockVFSContext context2 = registerSimple2VFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      assertNotNull(vfs);
+      assertEquals(context.getVFS(), vfs);
+      
+      VFS vfs2 = VFS.getVFS(context2.getRootURI());
+      assertNotNull(vfs2);
+      assertEquals(context2.getVFS(), vfs2);
+   }
+
+   public void testGetVFSURINull() throws Exception
+   {
+      try
+      {
+         VFS.getVFS((URI) null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetVFSURINoFactory() throws Exception
+   {
+      try
+      {
+         URI uri = new URI("doesnotexist:///");
+         VFS.getVFS(uri);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVFSURIIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      mockVFSContextFactory.setIOException("getVFSURI");
+
+      try
+      {
+         VFS.getVFS(context.getRootURI());
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVFSURL() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      MockVFSContext context2 = registerSimple2VFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURL());
+      assertNotNull(vfs);
+      assertEquals(context.getVFS(), vfs);
+      
+      VFS vfs2 = VFS.getVFS(context2.getRootURL());
+      assertNotNull(vfs2);
+      assertEquals(context2.getVFS(), vfs2);
+   }
+
+   public void testGetVFSURLNull() throws Exception
+   {
+      try
+      {
+         VFS.getVFS((URL) null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetVFSURLNoFactory() throws Exception
+   {
+      try
+      {
+         URL url = new URL("doesnotexist", "", 0, "", MockURLStreamHandler.INSTANCE);
+         VFS.getVFS(url);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVFSURLIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      mockVFSContextFactory.setIOException("getVFSURL");
+
+      try
+      {
+         VFS.getVFS(context.getRootURL());
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetRootURI() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertNotNull(file);
+      assertEquals(context.getRoot().getVirtualFile(), file);
+   }
+
+   public void testGetRootURINullURI() throws Exception
+   {
+      try
+      {
+         VFS.getRoot((URI) null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetRootURINoFactory() throws Exception
+   {
+      try
+      {
+         URI uri = new URI("doesnotexist:///");
+         VFS.getRoot(uri);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetRootURIIOExceptionGetVFS() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      mockVFSContextFactory.setIOException("getVFSURI");
+
+      try
+      {
+         VFS.getRoot(context.getRootURI());
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetRootURIIOExceptionGetRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.setIOException("getRoot");
+
+      try
+      {
+         VFS.getRoot(context.getRootURI());
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURIRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      VirtualFile file = VFS.getVirtualFile(context.getRootURI(), "");
+      assertNotNull(file);
+      assertEquals(context.getRoot().getVirtualFile(), file);
+   }
+
+   public void testGetVirtualFileURIChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file1 = VFS.getVirtualFile(context.getRootURI(), "child1");
+      assertNotNull(file1);
+      assertEquals(child1, file1);
+      
+      VirtualFile file2 = VFS.getVirtualFile(context.getRootURI(), "child2");
+      assertNotNull(file2);
+      assertEquals(child2, file2);
+      
+      VirtualFile file3 = VFS.getVirtualFile(context.getRootURI(), "child3");
+      assertNotNull(file3);
+      assertEquals(child3, file3);
+   }
+
+   public void testGetVirtualFileURINullURI() throws Exception
+   {
+      try
+      {
+         VFS.getVirtualFile((URI) null, "");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURINullPath() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURI(), null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURINoFactory() throws Exception
+   {
+      try
+      {
+         URI uri = new URI("doesnotexist:///");
+         VFS.getVirtualFile(uri, "");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURIDoesNotExist() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURI(), "doesnotexist");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURIIOExceptionGetVFS() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      mockVFSContextFactory.setIOException("getVFSURI");
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURI(), "child1");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURIIOExceptionFindChild() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChild");
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURI(), "child1");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetRootURL() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURL());
+      assertNotNull(file);
+      assertEquals(context.getRoot().getVirtualFile(), file);
+   }
+
+   public void testGetRootURLNullURL() throws Exception
+   {
+      try
+      {
+         VFS.getRoot((URL) null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetRootURLNoFactory() throws Exception
+   {
+      URL url = new URL("doesnotexist", "", 0, "", MockURLStreamHandler.INSTANCE);
+      try
+      {
+         VFS.getRoot(url);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetRootURLIOExceptionGetVFS() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      mockVFSContextFactory.setIOException("getVFSURL");
+
+      URL url = context.getRootURL();
+      try
+      {
+         VFS.getRoot(url);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetRootURLIOExceptionGetRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.setIOException("getRoot");
+
+      URL url = context.getRootURL();
+      try
+      {
+         VFS.getRoot(url);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURLRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      VirtualFile file = VFS.getVirtualFile(context.getRootURL(), "");
+      assertNotNull(file);
+      assertEquals(context.getRoot().getVirtualFile(), file);
+   }
+
+   public void testGetVirtualFileURLChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file1 = VFS.getVirtualFile(context.getRootURL(), "child1");
+      assertNotNull(file1);
+      assertEquals(child1, file1);
+      
+      VirtualFile file2 = VFS.getVirtualFile(context.getRootURL(), "child2");
+      assertNotNull(file2);
+      assertEquals(child2, file2);
+      
+      VirtualFile file3 = VFS.getVirtualFile(context.getRootURL(), "child3");
+      assertNotNull(file3);
+      assertEquals(child3, file3);
+   }
+
+   public void testGetVirtualFileURLNullURL() throws Exception
+   {
+      try
+      {
+         VFS.getVirtualFile((URL) null, "");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURLNullPath() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURL(), null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURLNoFactory() throws Exception
+   {
+      try
+      {
+         URL url = new URL("doesnotexist", "", 0, "", MockURLStreamHandler.INSTANCE);
+         VFS.getVirtualFile(url, "");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURLIOExceptionGetVFS() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      mockVFSContextFactory.setIOException("getVFSURL");
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURL(), "child1");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURLDoesNotExist() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURL(), "doesnotexist");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetVirtualFileURLIOExceptionFindChild() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChild");
+
+      try
+      {
+         VFS.getVirtualFile(context.getRootURL(), "child1");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      assertNotNull(vfs);
+
+      VirtualFile root = vfs.getRoot();
+      assertNotNull(root);
+      
+      assertEquals(context.getRoot().getVirtualFile(), root);
+   }
+
+   public void testGetRootIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.setIOException("getRoot");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      assertNotNull(vfs);
+
+      try
+      {
+         vfs.getRoot();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testFindChildRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      
+      assertFindChild(vfs, "", vfs.getRoot());
+   }
+
+   public void testFindChildChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      assertFindChild(vfs, "child1", child1);
+      assertFindChild(vfs, "child2", child2);
+      assertFindChild(vfs, "child3", child3);
+   }
+
+   public void testFindChildSubChildren() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      assertFindChild(vfs, "child1", child1);
+      assertFindChild(vfs, "child1/child1,1", child11);
+      assertFindChild(vfs, "child2", child2);
+      assertFindChild(vfs, "child2/child2,1", child21);
+      assertFindChild(vfs, "child2/child2,2", child22);
+      assertFindChild(vfs, "child3", child3);
+      assertFindChild(vfs, "child3/child3,1", child31);
+      assertFindChild(vfs, "child3/child3,2", child32);
+      assertFindChild(vfs, "child3/child3,3", child33);
+   }
+
+   public void testFindChildNullPath() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      try
+      {
+         VFS vfs = VFS.getVFS(context.getRootURI());
+         vfs.findChild(null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testGetChildNullPath() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      try
+      {
+         VFS vfs = VFS.getVFS(context.getRootURI());
+         vfs.getChild(null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildSimpleDoesNotExist() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.findChild("doesnotexist");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+         assertNull(vfs.getChild("doesnotexist"));
+      }
+   }
+
+   public void testFindChildStructuredDoesNotExist() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.findChild("child1/doesnotexist");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+         assertNull(vfs.getChild("child1/doesnotexist"));
+      }
+   }
+
+   public void testFindChildIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChild");
+
+      try
+      {
+         VFS vfs = VFS.getVFS(context.getRootURI());
+         vfs.findChild("child1");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetChildIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChild");
+
+      try
+      {
+         VFS vfs = VFS.getVFS(context.getRootURI());
+         vfs.getChild("child1");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildren();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildren();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildren();
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildren();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildren();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithNullFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildren(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenWithNullFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildren(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenWithNullFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildren(null);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenWithNullFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildren(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithNullFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildren(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = vfs.getChildren(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenWithFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = vfs.getChildren(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenWithFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = vfs.getChildren(filter);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+      assertEmpty(filter.getVisited());
+   }
+
+   public void testGetAllChildrenWithFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         vfs.getChildren(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         vfs.getChildren(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursively() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildrenRecursively();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildrenRecursively();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child11);
+      expected.add(child2);
+      expected.add(child21);
+      expected.add(child22);
+      expected.add(child3);
+      expected.add(child31);
+      expected.add(child32);
+      expected.add(child33);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildrenRecursively();
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenRecursivelyIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildrenRecursively();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildrenRecursively();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildrenRecursively(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildrenRecursively(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child11);
+      expected.add(child2);
+      expected.add(child21);
+      expected.add(child22);
+      expected.add(child3);
+      expected.add(child31);
+      expected.add(child32);
+      expected.add(child33);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      List<VirtualFile> children = vfs.getChildrenRecursively(null);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildrenRecursively(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.getChildrenRecursively(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = vfs.getChildrenRecursively(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = vfs.getChildrenRecursively(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child11);
+      expected.add(child2);
+      expected.add(child21);
+      expected.add(child22);
+      expected.add(child3);
+      expected.add(child31);
+      expected.add(child32);
+      expected.add(child33);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = vfs.getChildrenRecursively(filter);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+      assertEmpty(filter.getVisited());
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         vfs.getChildren(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         vfs.getChildrenRecursively(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testVisitAllChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      vfs.visit(visitor);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testVisitAllChildrenStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      vfs.visit(visitor);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testVisitAllChildrenNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      vfs.visit(visitor);
+
+      assertEmpty(filter.getVisited());
+   }
+
+   public void testVisitAllChildrenIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      try
+      {
+         vfs.visit(visitor);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testVisitAllChildrenNullVisitor() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      try
+      {
+         vfs.visit(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testVisitAllChildrenIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VFS vfs = VFS.getVFS(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      try
+      {
+         vfs.visit(visitor);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+   
+   public void testToString() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      VFS vfs = context.getVFS();
+      
+      assertEquals(context.toString(), vfs.toString());
+   }
+   
+   public void testHashCode() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      VFS vfs = context.getVFS();
+      
+      assertEquals(context.hashCode(), vfs.hashCode());
+   }
+   
+   public void testEquals() throws Exception
+   {
+      MockVFSContext context1 = createSimpleVFSContext();
+      MockVFSContext context2 = createSimpleVFSContext();
+      
+      VFS vfs1 = context1.getVFS();
+      VFS vfs2 = context2.getVFS();
+
+      assertEquals(vfs1, vfs2);
+      
+      MockVFSContext context3 = createSimple2VFSContext();
+      VFS vfs3 = context3.getVFS();
+
+      assertFalse(vfs1.equals(vfs3));
+      assertFalse(vfs2.equals(vfs3));
+
+      assertFalse(vfs1.equals(null));
+
+      assertFalse(vfs1.equals(new Object()));
+   }
+}

Deleted: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java	2008-01-14 10:45:48 UTC (rev 68940)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -1,1392 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jboss.test.virtual.support.MockVFSContext;
-import org.jboss.test.virtual.support.MockVirtualFileFilter;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * VirtualFileUnitTestCase.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VirtualFileUnitTestCase extends AbstractMockVFSTest
-{
-   public VirtualFileUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   public static Test suite()
-   {
-      return new TestSuite(VirtualFileUnitTestCase.class);
-   }
-
-   public void testGetNameRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      URI uri = context.getRootURI();
-      assertGetName(uri, "");
-   }
-
-   public void testGetNameChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      URI uri = context.getRootURI();
-      assertGetName(uri, "child1");
-      assertGetName(uri, "child2");
-      assertGetName(uri, "child3");
-   }
-
-   public void testGetNameSubChildren() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      
-      URI uri = context.getRootURI();
-      assertGetName(uri, "child1/child1,1", "child1,1");
-      assertGetName(uri, "child2/child2,1", "child2,1");
-      assertGetName(uri, "child2/child2,2", "child2,2");
-      assertGetName(uri, "child3/child3,1", "child3,1");
-      assertGetName(uri, "child3/child3,2", "child3,2");
-      assertGetName(uri, "child3/child3,3", "child3,3");
-   }
-
-   public void testGetPathNameRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      URI uri = context.getRootURI();
-      assertGetPathName(uri, "");
-   }
-
-   public void testGetPathNameChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      URI uri = context.getRootURI();
-      assertGetPathName(uri, "");
-      assertGetPathName(uri, "child1");
-      assertGetPathName(uri, "child2");
-      assertGetPathName(uri, "child3");
-   }
-
-   public void testGetPathNameSubChildren() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      
-      URI uri = context.getRootURI();
-      assertGetPathName(uri, "");
-      assertGetPathName(uri, "child1");
-      assertGetPathName(uri, "child1/child1,1");
-      assertGetPathName(uri, "child2");
-      assertGetPathName(uri, "child2/child2,1");
-      assertGetPathName(uri, "child2/child2,2");
-      assertGetPathName(uri, "child3");
-      assertGetPathName(uri, "child3/child3,1");
-      assertGetPathName(uri, "child3/child3,2");
-      assertGetPathName(uri, "child3/child3,3");
-   }
-
-   public void testToURI() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      URI uri = context.getRootURI();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      
-      VirtualFile root = VFS.getRoot(uri);
-      assertEquals(uri, root.toURI());
-
-      VirtualFile found1 = root.findChild("child1");
-      assertEquals(child1.toURI(), found1.toURI());
-
-      VirtualFile found11 = root.findChild("child1/child1,1");
-      assertEquals(child11.toURI(), found11.toURI());
-   }
-
-   public void testToURL() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      URL url = context.getRootURL();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      
-      VirtualFile root = VFS.getRoot(url);
-      assertEquals(url, root.toURL());
-
-      VirtualFile found1 = root.findChild("child1");
-      assertEquals(child1.toURL(), found1.toURL());
-
-      VirtualFile found11 = root.findChild("child1/child1,1");
-      assertEquals(child11.toURL(), found11.toURL());
-   }
-
-   public void testGetLastModfied() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLastModified(12345l);
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertEquals(12345l, file.getLastModified());
-
-      context.getMockRoot().setLastModified(67890l);
-      assertEquals(67890l, file.getLastModified());
-   }
-
-   public void testGetLastModfiedIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setIOException("getLastModified");
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getLastModified();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetLastModfiedClosed() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      try
-      {
-         file.getLastModified();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-   
-   public void testGetSize() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setSize(12345l);
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertEquals(12345l, file.getSize());
-
-      context.getMockRoot().setSize(67890l);
-      assertEquals(67890l, file.getSize());
-   }
-
-   public void testGetSizeIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setIOException("getSize");
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getSize();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetSizeClosed() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      try
-      {
-         file.getSize();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertEquals(false, file.isLeaf());
-
-      context.getMockRoot().setLeaf(true);
-      assertEquals(true, file.isLeaf());
-   }
-
-   public void testIsLeafIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setIOException("isLeaf");
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.isLeaf();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testIsLeafClosed() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      try
-      {
-         file.isLeaf();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-   
-   public void testIsHidden() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setHidden(true);
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertEquals(true, file.isHidden());
-
-      context.getMockRoot().setHidden(false);
-      assertEquals(false, file.isHidden());
-   }
-
-   public void testIsHiddenIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setIOException("isHidden");
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.isHidden();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testIsHiddenClosed() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      try
-      {
-         file.isHidden();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testOpenStream() throws Exception
-   {
-      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setStream(bytes);
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      InputStream stream = file.openStream();
-      byte[] buffer = new byte[bytes.length];
-      stream.read(buffer);
-      
-      assertTrue(stream.read() == -1);
-      assertTrue(Arrays.equals(bytes, buffer));
-   }
-
-   public void testOpenStreamIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setIOException("openStream");
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.openStream();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testOpenStreamClosed() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      try
-      {
-         file.openStream();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testCloseStreams() throws Exception
-   {
-      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setStream(bytes);
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      InputStream stream = file.openStream();
-      assertEquals(1, stream.read());
-      
-      file.closeStreams();
-      assertEquals(-1, stream.read());
-   }
-
-   public void testCloseStreamViaClose() throws Exception
-   {
-      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setStream(bytes);
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      InputStream stream = file.openStream();
-      assertEquals(1, stream.read());
-      
-      file.close();
-      assertEquals(-1, stream.read());
-   }
-
-   public void testClose() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-   }
-   
-   public void testCloseDuplicate() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      file.close();
-   }
-
-   public void testGetVFS() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertEquals(context.getVFS(), file.getVFS());
-   }
-
-   public void testGetVFSClosed() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      try
-      {
-         file.getVFS();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-   
-   public void testGetParentRoot() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertNull(file.getParent());
-   }
-   
-   public void testGetParentSimpleChild() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      VirtualFile root = VFS.getRoot(context.getRootURI());
-      VirtualFile child = root.findChild("child1");
-      VirtualFile parent = child.getParent();
-      assertEquals(root, parent);
-   }
-   
-   public void testGetParentStructuredChild() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-
-      VirtualFile root = VFS.getRoot(context.getRootURI());
-      VirtualFile child = root.findChild("child1");
-      VirtualFile subChild = child.findChild("child1,1");
-      VirtualFile parent = child.getParent();
-      assertEquals(root, parent);
-      parent = subChild.getParent();
-      assertEquals(child, parent);
-   }
-
-   public void testGetParentIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setIOException("getParent");
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getParent();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetParentClosed() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      file.close();
-      try
-      {
-         file.getParent();
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildren();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildren();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildren();
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildren();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildren();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithNullFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildren(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenWithNullFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildren(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenWithNullFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildren(null);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenWithNullFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildren(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithNullFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildren(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = file.getChildren(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenWithFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = file.getChildren(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenWithFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = file.getChildren(filter);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-      assertEmpty(filter.getVisited());
-   }
-
-   public void testGetAllChildrenWithFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         file.getChildren(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenWithFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         file.getChildren(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursively() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildrenRecursively();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildrenRecursively();
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child11);
-      expected.add(child2);
-      expected.add(child21);
-      expected.add(child22);
-      expected.add(child3);
-      expected.add(child31);
-      expected.add(child32);
-      expected.add(child33);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildrenRecursively();
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenRecursivelyIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildrenRecursively();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenIOExceptionRecursively() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildrenRecursively();
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildrenRecursively(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildrenRecursively(null);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child11);
-      expected.add(child2);
-      expected.add(child21);
-      expected.add(child22);
-      expected.add(child3);
-      expected.add(child31);
-      expected.add(child32);
-      expected.add(child33);
-      
-      assertEquals(expected, children);
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      List<VirtualFile> children = file.getChildrenRecursively(null);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildrenRecursively(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithNullFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.getChildrenRecursively(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilter() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = file.getChildrenRecursively(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = file.getChildrenRecursively(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child11);
-      expected.add(child2);
-      expected.add(child21);
-      expected.add(child22);
-      expected.add(child3);
-      expected.add(child31);
-      expected.add(child32);
-      expected.add(child33);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = file.getChildrenRecursively(filter);
-      assertNotNull(children);
-      
-      assertEmpty(children);
-      assertEmpty(filter.getVisited());
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         file.getChildren(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testGetAllChildrenRecursivelyWithFilterIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      try
-      {
-         file.getChildrenRecursively(filter);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testVisitAllChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      List<VirtualFile> children = file.getChildren(filter);
-      assertNotNull(children);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, children);
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testVisitAllChildrenStructured() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      file.visit(visitor);
-      
-      List<VirtualFile> expected = new ArrayList<VirtualFile>();
-      expected.add(child1);
-      expected.add(child2);
-      expected.add(child3);
-      
-      assertEquals(expected, filter.getVisited());
-   }
-
-   public void testVisitAllChildrenNoChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      file.visit(visitor);
-      
-      assertEmpty(filter.getVisited());
-   }
-
-   public void testVisitAllChildrenIsLeaf() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      try
-      {
-         file.visit(visitor);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalStateException.class, t);
-      }
-   }
-
-   public void testVisitAllChildrenNullVisitor() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.visit(null);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testVisitChildrenIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("getChildren");
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      MockVirtualFileFilter filter = new MockVirtualFileFilter();
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
-      try
-      {
-         file.visit(visitor);
-         fail("Should not be here!");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-   
-   public void testFindChildSame() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      context.getMockRoot().setLeaf(false);
-      
-      VirtualFile root = VFS.getRoot(context.getRootURI());
-      
-      assertFindChild(root, "", root);
-   }
-   
-   public void testFindChildChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      
-      VirtualFile root = VFS.getRoot(context.getRootURI());
-      
-      assertFindChild(root, "", root);
-      assertFindChild(root, "child1", child1);
-      assertFindChild(root, "child2", child2);
-      assertFindChild(root, "child3", child3);
-   }
-
-   public void testFindFolderChildren() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildrenAndNonLeafs();
-      VirtualFile child1 = getChildHandler(context, "folder1/child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "folder2/child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "folder3/child3").getVirtualFile();
-
-      VirtualFile root = VFS.getRoot(context.getRootURI());
-
-      assertFindChild(root, "", root);
-      assertFindChild(root, "folder1/child1", child1);
-      assertFindChild(root, "folder2/child2", child2);
-      assertFindChild(root, "folder3/child3", child3);
-   }
-
-   public void testFindSimpleReverse() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildrenAndNonLeafs();
-      VirtualFile child1 = getChildHandler(context, "folder1/child1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "folder2/child2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "folder3/child3").getVirtualFile();
-
-      VirtualFile root = VFS.getRoot(context.getRootURI());
-
-      assertFindChild(root, "", root);
-      assertFindChild(root, "folder2/../folder1/child1", child1);
-      assertFindChild(root, "folder3/child1/../../folder2/child2", child2);
-      try
-      {
-         assertFindChild(root, "../folder3/child3", child3);
-      }
-      catch (Exception e)
-      {
-         checkThrowable(IOException.class, e);
-      }
-      try
-      {
-         assertFindChild(root, "folder2/../../folder3/child3", child3);
-      }
-      catch (Exception e)
-      {
-         checkThrowable(IOException.class, e);
-      }
-   }
-
-   public void testFindChildSubChildren() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
-      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
-      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
-      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
-      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
-      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
-      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
-      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
-      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
-      
-      VirtualFile root = VFS.getRoot(context.getRootURI());
-      
-      assertFindChild(root, "", root);
-      VirtualFile found1 = assertFindChild(root, "child1", child1);
-      assertFindChild(root, "child1/child1,1", child11);
-      assertFindChild(found1, "child1,1", child11);
-      VirtualFile found2 = assertFindChild(root, "child2", child2);
-      assertFindChild(root, "child2/child2,1", child21);
-      assertFindChild(found2, "child2,1", child21);
-      assertFindChild(root, "child2/child2,2", child22);
-      assertFindChild(found2, "child2,2", child22);
-      VirtualFile found3 = assertFindChild(root, "child3", child3);
-      assertFindChild(root, "child3/child3,1", child31);
-      assertFindChild(found3, "child3,1", child31);
-      assertFindChild(root, "child3/child3,2", child32);
-      assertFindChild(found3, "child3,2", child32);
-      assertFindChild(root, "child3/child3,3", child33);
-      assertFindChild(found3, "child3,3", child33);
-   }
-
-   public void testFindChildNullPath() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.findChild(null);
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IllegalArgumentException.class, t);
-      }
-   }
-
-   public void testFindChildSimpleDoesNotExist() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.findChild("doesnotexist");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testFindChildStructuredDoesNotExist() throws Exception
-   {
-      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.findChild("child1/doesnotexist");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-
-   public void testFindChildIOException() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContextWithChildren();
-      context.getMockRoot().setIOException("findChild");
-
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      try
-      {
-         file.findChild("child1");
-         fail("Should not be here");
-      }
-      catch (Throwable t)
-      {
-         checkThrowable(IOException.class, t);
-      }
-   }
-   
-   public void testToString() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      VirtualFileHandler handler = context.getRoot();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertEquals(handler.toString(), file.toString());
-   }
-   
-   public void testHashCode() throws Exception
-   {
-      MockVFSContext context = registerSimpleVFSContext();
-      VirtualFileHandler handler = context.getRoot();
-      
-      VirtualFile file = VFS.getRoot(context.getRootURI());
-      assertEquals(handler.hashCode(), file.hashCode());
-   }
-   
-   public void testEquals() throws Exception
-   {
-      MockVFSContext context1 = createSimpleVFSContext();
-      MockVFSContext context2 = createSimpleVFSContext();
-      
-      VirtualFile file1 = context1.getVFS().getRoot();
-      VirtualFile file2 = context2.getVFS().getRoot();
-
-      assertEquals(file1, file2);
-      
-      MockVFSContext context3 = createSimple2VFSContext();
-      VirtualFile file3 = context3.getVFS().getRoot();
-
-      assertFalse(file1.equals(file3));
-      assertFalse(file2.equals(file3));
-
-      assertFalse(file1.equals(null));
-
-      assertFalse(file1.equals(new Object()));
-   }
-}

Copied: projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java (from rev 69082, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java)
===================================================================
--- projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java	                        (rev 0)
+++ projects/vfs/tags/2.0.0.Beta7/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java	2008-01-17 20:18:02 UTC (rev 69084)
@@ -0,0 +1,1392 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.virtual.support.MockVFSContext;
+import org.jboss.test.virtual.support.MockVirtualFileFilter;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * VirtualFileUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VirtualFileUnitTestCase extends AbstractMockVFSTest
+{
+   public VirtualFileUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(VirtualFileUnitTestCase.class);
+   }
+
+   public void testGetNameRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      URI uri = context.getRootURI();
+      assertGetName(uri, "");
+   }
+
+   public void testGetNameChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      URI uri = context.getRootURI();
+      assertGetName(uri, "child1");
+      assertGetName(uri, "child2");
+      assertGetName(uri, "child3");
+   }
+
+   public void testGetNameSubChildren() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      
+      URI uri = context.getRootURI();
+      assertGetName(uri, "child1/child1,1", "child1,1");
+      assertGetName(uri, "child2/child2,1", "child2,1");
+      assertGetName(uri, "child2/child2,2", "child2,2");
+      assertGetName(uri, "child3/child3,1", "child3,1");
+      assertGetName(uri, "child3/child3,2", "child3,2");
+      assertGetName(uri, "child3/child3,3", "child3,3");
+   }
+
+   public void testGetPathNameRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      URI uri = context.getRootURI();
+      assertGetPathName(uri, "");
+   }
+
+   public void testGetPathNameChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      URI uri = context.getRootURI();
+      assertGetPathName(uri, "");
+      assertGetPathName(uri, "child1");
+      assertGetPathName(uri, "child2");
+      assertGetPathName(uri, "child3");
+   }
+
+   public void testGetPathNameSubChildren() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      
+      URI uri = context.getRootURI();
+      assertGetPathName(uri, "");
+      assertGetPathName(uri, "child1");
+      assertGetPathName(uri, "child1/child1,1");
+      assertGetPathName(uri, "child2");
+      assertGetPathName(uri, "child2/child2,1");
+      assertGetPathName(uri, "child2/child2,2");
+      assertGetPathName(uri, "child3");
+      assertGetPathName(uri, "child3/child3,1");
+      assertGetPathName(uri, "child3/child3,2");
+      assertGetPathName(uri, "child3/child3,3");
+   }
+
+   public void testToURI() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      URI uri = context.getRootURI();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      
+      VirtualFile root = VFS.getRoot(uri);
+      assertEquals(uri, root.toURI());
+
+      VirtualFile found1 = root.findChild("child1");
+      assertEquals(child1.toURI(), found1.toURI());
+
+      VirtualFile found11 = root.findChild("child1/child1,1");
+      assertEquals(child11.toURI(), found11.toURI());
+   }
+
+   public void testToURL() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      URL url = context.getRootURL();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      
+      VirtualFile root = VFS.getRoot(url);
+      assertEquals(url, root.toURL());
+
+      VirtualFile found1 = root.findChild("child1");
+      assertEquals(child1.toURL(), found1.toURL());
+
+      VirtualFile found11 = root.findChild("child1/child1,1");
+      assertEquals(child11.toURL(), found11.toURL());
+   }
+
+   public void testGetLastModfied() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLastModified(12345l);
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertEquals(12345l, file.getLastModified());
+
+      context.getMockRoot().setLastModified(67890l);
+      assertEquals(67890l, file.getLastModified());
+   }
+
+   public void testGetLastModfiedIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setIOException("getLastModified");
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getLastModified();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetLastModfiedClosed() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      try
+      {
+         file.getLastModified();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   public void testGetSize() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setSize(12345l);
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertEquals(12345l, file.getSize());
+
+      context.getMockRoot().setSize(67890l);
+      assertEquals(67890l, file.getSize());
+   }
+
+   public void testGetSizeIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setIOException("getSize");
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getSize();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetSizeClosed() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      try
+      {
+         file.getSize();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertEquals(false, file.isLeaf());
+
+      context.getMockRoot().setLeaf(true);
+      assertEquals(true, file.isLeaf());
+   }
+
+   public void testIsLeafIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setIOException("isLeaf");
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.isLeaf();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testIsLeafClosed() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      try
+      {
+         file.isLeaf();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   public void testIsHidden() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setHidden(true);
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertEquals(true, file.isHidden());
+
+      context.getMockRoot().setHidden(false);
+      assertEquals(false, file.isHidden());
+   }
+
+   public void testIsHiddenIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setIOException("isHidden");
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.isHidden();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testIsHiddenClosed() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      try
+      {
+         file.isHidden();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testOpenStream() throws Exception
+   {
+      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setStream(bytes);
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      InputStream stream = file.openStream();
+      byte[] buffer = new byte[bytes.length];
+      stream.read(buffer);
+      
+      assertTrue(stream.read() == -1);
+      assertTrue(Arrays.equals(bytes, buffer));
+   }
+
+   public void testOpenStreamIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setIOException("openStream");
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.openStream();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testOpenStreamClosed() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      try
+      {
+         file.openStream();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testCloseStreams() throws Exception
+   {
+      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setStream(bytes);
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      InputStream stream = file.openStream();
+      assertEquals(1, stream.read());
+      
+      file.closeStreams();
+      assertEquals(-1, stream.read());
+   }
+
+   public void testCloseStreamViaClose() throws Exception
+   {
+      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setStream(bytes);
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      InputStream stream = file.openStream();
+      assertEquals(1, stream.read());
+      
+      file.close();
+      assertEquals(-1, stream.read());
+   }
+
+   public void testClose() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+   }
+   
+   public void testCloseDuplicate() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      file.close();
+   }
+
+   public void testGetVFS() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertEquals(context.getVFS(), file.getVFS());
+   }
+
+   public void testGetVFSClosed() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      try
+      {
+         file.getVFS();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   public void testGetParentRoot() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertNull(file.getParent());
+   }
+   
+   public void testGetParentSimpleChild() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      VirtualFile root = VFS.getRoot(context.getRootURI());
+      VirtualFile child = root.findChild("child1");
+      VirtualFile parent = child.getParent();
+      assertEquals(root, parent);
+   }
+   
+   public void testGetParentStructuredChild() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+
+      VirtualFile root = VFS.getRoot(context.getRootURI());
+      VirtualFile child = root.findChild("child1");
+      VirtualFile subChild = child.findChild("child1,1");
+      VirtualFile parent = child.getParent();
+      assertEquals(root, parent);
+      parent = subChild.getParent();
+      assertEquals(child, parent);
+   }
+
+   public void testGetParentIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setIOException("getParent");
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getParent();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetParentClosed() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      file.close();
+      try
+      {
+         file.getParent();
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildren();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildren();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildren();
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildren();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildren();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithNullFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildren(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenWithNullFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildren(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenWithNullFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildren(null);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenWithNullFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildren(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithNullFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildren(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = file.getChildren(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenWithFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = file.getChildren(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenWithFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = file.getChildren(filter);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+      assertEmpty(filter.getVisited());
+   }
+
+   public void testGetAllChildrenWithFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         file.getChildren(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenWithFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         file.getChildren(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursively() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildrenRecursively();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildrenRecursively();
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child11);
+      expected.add(child2);
+      expected.add(child21);
+      expected.add(child22);
+      expected.add(child3);
+      expected.add(child31);
+      expected.add(child32);
+      expected.add(child33);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildrenRecursively();
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenRecursivelyIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildrenRecursively();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenIOExceptionRecursively() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildrenRecursively();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildrenRecursively(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildrenRecursively(null);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child11);
+      expected.add(child2);
+      expected.add(child21);
+      expected.add(child22);
+      expected.add(child3);
+      expected.add(child31);
+      expected.add(child32);
+      expected.add(child33);
+      
+      assertEquals(expected, children);
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      List<VirtualFile> children = file.getChildrenRecursively(null);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildrenRecursively(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithNullFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.getChildrenRecursively(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilter() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = file.getChildrenRecursively(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = file.getChildrenRecursively(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child11);
+      expected.add(child2);
+      expected.add(child21);
+      expected.add(child22);
+      expected.add(child3);
+      expected.add(child31);
+      expected.add(child32);
+      expected.add(child33);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = file.getChildrenRecursively(filter);
+      assertNotNull(children);
+      
+      assertEmpty(children);
+      assertEmpty(filter.getVisited());
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         file.getChildren(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetAllChildrenRecursivelyWithFilterIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      try
+      {
+         file.getChildrenRecursively(filter);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testVisitAllChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      List<VirtualFile> children = file.getChildren(filter);
+      assertNotNull(children);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, children);
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testVisitAllChildrenStructured() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      file.visit(visitor);
+      
+      List<VirtualFile> expected = new ArrayList<VirtualFile>();
+      expected.add(child1);
+      expected.add(child2);
+      expected.add(child3);
+      
+      assertEquals(expected, filter.getVisited());
+   }
+
+   public void testVisitAllChildrenNoChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      file.visit(visitor);
+      
+      assertEmpty(filter.getVisited());
+   }
+
+   public void testVisitAllChildrenIsLeaf() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      try
+      {
+         file.visit(visitor);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testVisitAllChildrenNullVisitor() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.visit(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testVisitChildrenIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChildren");
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      MockVirtualFileFilter filter = new MockVirtualFileFilter();
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
+      try
+      {
+         file.visit(visitor);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+   
+   public void testFindChildSame() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      context.getMockRoot().setLeaf(false);
+      
+      VirtualFile root = VFS.getRoot(context.getRootURI());
+      
+      assertFindChild(root, "", root);
+   }
+   
+   public void testFindChildChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      
+      VirtualFile root = VFS.getRoot(context.getRootURI());
+      
+      assertFindChild(root, "", root);
+      assertFindChild(root, "child1", child1);
+      assertFindChild(root, "child2", child2);
+      assertFindChild(root, "child3", child3);
+   }
+
+   public void testFindFolderChildren() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildrenAndNonLeafs();
+      VirtualFile child1 = getChildHandler(context, "folder1/child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "folder2/child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "folder3/child3").getVirtualFile();
+
+      VirtualFile root = VFS.getRoot(context.getRootURI());
+
+      assertFindChild(root, "", root);
+      assertFindChild(root, "folder1/child1", child1);
+      assertFindChild(root, "folder2/child2", child2);
+      assertFindChild(root, "folder3/child3", child3);
+   }
+
+   public void testFindSimpleReverse() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildrenAndNonLeafs();
+      VirtualFile child1 = getChildHandler(context, "folder1/child1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "folder2/child2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "folder3/child3").getVirtualFile();
+
+      VirtualFile root = VFS.getRoot(context.getRootURI());
+
+      assertFindChild(root, "", root);
+      assertFindChild(root, "folder2/../folder1/child1", child1);
+      assertFindChild(root, "folder3/child1/../../folder2/child2", child2);
+      try
+      {
+         assertFindChild(root, "../folder3/child3", child3);
+      }
+      catch (Exception e)
+      {
+         checkThrowable(IOException.class, e);
+      }
+      try
+      {
+         assertFindChild(root, "folder2/../../folder3/child3", child3);
+      }
+      catch (Exception e)
+      {
+         checkThrowable(IOException.class, e);
+      }
+   }
+
+   public void testFindChildSubChildren() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
+      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
+      VirtualFile child2 = getChildHandler(context, "child2").getVirtualFile();
+      VirtualFile child21 = getChildHandler(context, "child2/child2,1").getVirtualFile();
+      VirtualFile child22 = getChildHandler(context, "child2/child2,2").getVirtualFile();
+      VirtualFile child3 = getChildHandler(context, "child3").getVirtualFile();
+      VirtualFile child31 = getChildHandler(context, "child3/child3,1").getVirtualFile();
+      VirtualFile child32 = getChildHandler(context, "child3/child3,2").getVirtualFile();
+      VirtualFile child33 = getChildHandler(context, "child3/child3,3").getVirtualFile();
+      
+      VirtualFile root = VFS.getRoot(context.getRootURI());
+      
+      assertFindChild(root, "", root);
+      VirtualFile found1 = assertFindChild(root, "child1", child1);
+      assertFindChild(root, "child1/child1,1", child11);
+      assertFindChild(found1, "child1,1", child11);
+      VirtualFile found2 = assertFindChild(root, "child2", child2);
+      assertFindChild(root, "child2/child2,1", child21);
+      assertFindChild(found2, "child2,1", child21);
+      assertFindChild(root, "child2/child2,2", child22);
+      assertFindChild(found2, "child2,2", child22);
+      VirtualFile found3 = assertFindChild(root, "child3", child3);
+      assertFindChild(root, "child3/child3,1", child31);
+      assertFindChild(found3, "child3,1", child31);
+      assertFindChild(root, "child3/child3,2", child32);
+      assertFindChild(found3, "child3,2", child32);
+      assertFindChild(root, "child3/child3,3", child33);
+      assertFindChild(found3, "child3,3", child33);
+   }
+
+   public void testFindChildNullPath() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.findChild(null);
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildSimpleDoesNotExist() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.findChild("doesnotexist");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testFindChildStructuredDoesNotExist() throws Exception
+   {
+      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.findChild("child1/doesnotexist");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+
+   public void testFindChildIOException() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContextWithChildren();
+      context.getMockRoot().setIOException("getChild");
+
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      try
+      {
+         file.findChild("child1");
+         fail("Should not be here");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IOException.class, t);
+      }
+   }
+   
+   public void testToString() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      VirtualFileHandler handler = context.getRoot();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertEquals(handler.toString(), file.toString());
+   }
+   
+   public void testHashCode() throws Exception
+   {
+      MockVFSContext context = registerSimpleVFSContext();
+      VirtualFileHandler handler = context.getRoot();
+      
+      VirtualFile file = VFS.getRoot(context.getRootURI());
+      assertEquals(handler.hashCode(), file.hashCode());
+   }
+   
+   public void testEquals() throws Exception
+   {
+      MockVFSContext context1 = createSimpleVFSContext();
+      MockVFSContext context2 = createSimpleVFSContext();
+      
+      VirtualFile file1 = context1.getVFS().getRoot();
+      VirtualFile file2 = context2.getVFS().getRoot();
+
+      assertEquals(file1, file2);
+      
+      MockVFSContext context3 = createSimple2VFSContext();
+      VirtualFile file3 = context3.getVFS().getRoot();
+
+      assertFalse(file1.equals(file3));
+      assertFalse(file2.equals(file3));
+
+      assertFalse(file1.equals(null));
+
+      assertFalse(file1.equals(new Object()));
+   }
+}




More information about the jboss-cvs-commits mailing list