[Jboss-cvs] JBossAS SVN: r56648 - in projects/microcontainer/trunk/container/src: main/org/jboss/virtual/plugins/context main/org/jboss/virtual/plugins/context/jar main/org/jboss/virtual/spi tests/org/jboss/test/virtual/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 8 10:22:57 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-09-08 10:22:52 -0400 (Fri, 08 Sep 2006)
New Revision: 56648

Added:
   projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java
   projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java
Modified:
   projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVFSContext.java
   projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/AbstractJarHandler.java
   projects/microcontainer/trunk/container/src/main/org/jboss/virtual/spi/VFSContext.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/TestFileVFS.java
Log:
Add an options notion to the VFSContext and add support for nested jars without copying

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVFSContext.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVFSContext.java	2006-09-08 14:11:44 UTC (rev 56647)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVFSContext.java	2006-09-08 14:22:52 UTC (rev 56648)
@@ -24,9 +24,11 @@
 import java.io.IOException;
 import java.net.URL;
 import java.util.List;
+import java.util.Map;
 
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VFS;
+import org.jboss.virtual.VFSUtils;
 import org.jboss.virtual.VisitorAttributes;
 import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VirtualFileHandler;
@@ -48,7 +50,9 @@
    
    /** The root url */
    private final URL rootURL;
-   
+   /** Options associated with the root URL */
+   private Map<String, String> rootOptions;
+
    /**
     * Create a new AbstractVFSContext.
     * 
@@ -60,6 +64,8 @@
       if (rootURL == null)
          throw new IllegalArgumentException("Null rootURL");
       this.rootURL = rootURL;
+      String query = rootURL.getQuery();
+      rootOptions = VFSUtils.parseURLQuery(query);
    }
 
    public VFS getVFS()
@@ -74,6 +80,11 @@
       return rootURL;
    }
 
+   public Map<String, String> getOptions()
+   {
+      return rootOptions;
+   }
+
    public List<VirtualFileHandler> getChildren(VirtualFileHandler parent, boolean ignoreErrors) throws IOException
    {
       if (parent == null)

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/AbstractJarHandler.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/AbstractJarHandler.java	2006-09-08 14:11:44 UTC (rev 56647)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/AbstractJarHandler.java	2006-09-08 14:22:52 UTC (rev 56648)
@@ -201,9 +201,22 @@
       URL url = new URL(buffer.toString());
 
       VFSContext context = parent.getVFSContext();
-      
+
+      VirtualFileHandler vfh;
       if (JarUtils.isArchive(entry.getName()))
-         return new NestedJarHandler(context, parent, jar, entry, url);
-      return new JarEntryHandler(context, parent, jar, entry, url);
+      {
+         String flag = context.getOptions().get("useNoCopyJarHandler");
+         boolean useNoCopyJarHandler = Boolean.valueOf(flag);
+
+         if( useNoCopyJarHandler )
+            vfh = new NoCopyNestedJarHandler(context, parent, jar, entry, url);
+         else
+            vfh = new NestedJarHandler(context, parent, jar, entry, url);
+      }
+      else
+      {
+         vfh = new JarEntryHandler(context, parent, jar, entry, url);         
+      }
+      return vfh;
    }
 }

Added: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java	2006-09-08 14:11:44 UTC (rev 56647)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java	2006-09-08 14:22:52 UTC (rev 56648)
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.jboss.virtual.plugins.context.jar;
+
+import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/**
+ * A nested jar implementation used to represent a jar within a jar.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 44334 $
+ */
+public class NestedJarFromStream
+   extends AbstractVirtualFileHandler
+{
+   private ZipInputStream zis;
+   private HashMap<String, JarEntryContents> entries = new HashMap<String, JarEntryContents>();
+   private URL jarURL;
+   private URL entryURL;
+   private String vfsPath;
+   private String name;
+   private long lastModified;
+   private long size;
+   private boolean inited;
+
+   /**
+    * 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 entry - the parent jar ZipEntry for the nested jar
+    */
+   public NestedJarFromStream(VFSContext context, VirtualFileHandler parent, ZipInputStream zis, URL jarURL, ZipEntry entry)
+   {
+      super(context, parent, entry.getName());
+      this.jarURL = jarURL;
+      this.name = entry.getName();
+      this.lastModified = entry.getTime();
+      this.size = entry.getSize();
+      this.zis = zis;
+   }
+
+
+   public VirtualFileHandler findChild(String path) throws IOException
+   {
+      if( inited == false )
+         init();
+      VirtualFileHandler child = entries.get(name);
+      return child;
+   }
+
+
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      if( inited == false )
+         init();
+      List<VirtualFileHandler> children = new ArrayList<VirtualFileHandler>();
+      children.addAll(entries.values());
+      return children;
+   }
+
+
+   public boolean isFile()
+   {
+      return true;
+   }
+   public boolean isDirectory()
+   {
+      return false;
+   }
+   public boolean isArchive()
+   {
+      return true;
+   }
+   public boolean isHidden()
+   {
+      return false;
+   }
+
+   public long getSize()
+   {
+      return entries.size();
+   }
+
+   public long getLastModified() throws IOException
+   {
+      return lastModified;
+   }
+
+
+   public Iterator<JarEntryContents> getEntries()
+      throws IOException
+   {
+      if( inited == false )
+         init();
+      return entries.values().iterator();
+   }
+   public JarEntryContents getEntry(String name)
+      throws IOException
+   {
+      if( inited == false )
+         init();
+      JarEntryContents jec = entries.get(name);
+      return jec;
+   }
+   public ZipEntry getJarEntry(String name)
+      throws IOException
+   {
+      if( inited == false )
+         init();
+      JarEntryContents jec = entries.get(name);
+      ZipEntry entry = (jec != null ? jec.getEntry() : null);
+      return entry;
+   }
+   public byte[] getContents(String name)
+      throws IOException
+   {
+      if( inited == false )
+         init();
+      JarEntryContents jec = entries.get(name);
+      byte[] contents = (jec != null ? jec.getContents() : null);
+      return contents;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+   public String getPathName()
+   {
+      return vfsPath;
+   }
+
+   // Stream accessor
+   public InputStream openStream() throws IOException
+   {
+      return zis;
+   }
+
+   public void close()
+   {
+      entries.clear();
+      if( zis != null )
+      {
+         try
+         {
+            zis.close();
+         }
+         catch(IOException e)
+         {
+            log.error("close error", e);
+         }
+         zis = null;
+      }
+   }
+
+   public URL toURL() throws MalformedURLException
+   {
+      if( entryURL == null )
+         entryURL = new URL(jarURL, getName());
+      return entryURL;
+   }
+
+   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(",URL=");
+      try
+      {
+         tmp.append(toURL());
+      }
+      catch(MalformedURLException e)
+      {
+      }
+      tmp.append(']');
+      return tmp.toString();
+   }
+
+   protected void init()
+      throws IOException
+   {
+      inited = true;
+      ZipEntry entry = zis.getNextEntry();
+      while( entry != null )
+      {
+         try
+         {
+            String url = toURL().toExternalForm() + "!/" +  entry.getName();
+            URL jecURL = new URL(url);
+            JarEntryContents jec = new JarEntryContents(getVFSContext(), this, entry, jecURL, zis, getPathName());
+            entries.put(entry.getName(), jec);
+            entry = zis.getNextEntry();
+         }
+         catch(MalformedURLException e)
+         {
+            e.printStackTrace();
+         }
+      }
+      zis.close();
+      zis = null;
+   }
+
+   public static class JarEntryContents
+      extends AbstractVirtualFileHandler
+   {
+      private ZipEntry entry;
+      private URL entryURL;
+      private String vfsPath;
+      private byte[] contents;
+      private boolean isJar;
+      private NestedJarFromStream njar;
+      private InputStream openStream;
+
+      JarEntryContents(VFSContext context, VirtualFileHandler parent, ZipEntry entry, URL entryURL, InputStream zis,
+         String parentVfsPath)
+         throws IOException
+      {
+         super(context, parent, entry.getName());
+         this.entry = entry;
+         this.entryURL = entryURL;
+         this.vfsPath = parentVfsPath + "/" + entry.getName();
+         this.isJar = JarUtils.isArchive(entry.getName());
+         int size = (int) entry.getSize();
+         if( size <= 0 )
+            return;
+
+         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();
+      }
+
+      public boolean isHidden() throws IOException
+      {
+         return false;
+      }
+
+      public boolean isArchive()
+      {
+         return isJar;
+      }
+
+      public ZipEntry getEntry()
+      {
+         return entry;
+      }
+      public byte[] getContents()
+      {
+         return contents;
+      }
+
+      public String getName()
+      {
+         return entry.getName();
+      }
+      public String getPathName()
+      {
+         return vfsPath;
+      }
+
+      public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+      {
+         List<VirtualFileHandler> children = null;
+         if( isJar )
+         {
+            initNestedJar();
+            children = njar.getChildren(ignoreErrors);
+         }
+         return children;
+      }
+      public VirtualFileHandler findChild(String path) throws IOException
+      {
+         VirtualFileHandler child = null;
+         if( isJar )
+         {
+            initNestedJar();
+            child = njar.findChild(path);
+         }
+         else
+         {
+            throw new FileNotFoundException("JarEntryContents("+entry.getName()+") has no children");
+         }
+         return child;
+      }
+
+      // Convience attribute accessors
+      public long getLastModified()
+      {
+         return entry.getTime();
+      }
+
+      public long getSize()
+      {
+         return entry.getSize();
+      }
+
+      public boolean isDirectory()
+      {
+         return isJar;
+      }
+
+      public boolean isFile()
+      {
+         return isJar == 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 URL toURL() throws MalformedURLException
+      {
+         return entryURL;
+      }
+
+      public String toString()
+      {
+         StringBuffer tmp = new StringBuffer(super.toString());
+         tmp.append('[');
+         tmp.append("name=");
+         tmp.append(entry.getName());
+         tmp.append(",size=");
+         tmp.append(entry.getSize());
+         tmp.append(",time=");
+         tmp.append(entry.getTime());
+         tmp.append(",URL=");
+         try
+         {
+            tmp.append(toURL());
+         }
+         catch(MalformedURLException e)
+         {
+         }
+         tmp.append(']');
+         return tmp.toString();
+      }
+
+      private synchronized void initNestedJar()
+         throws IOException
+      {
+         if( isJar && njar == null )
+         {
+            ByteArrayInputStream bais = new ByteArrayInputStream(contents);
+            ZipInputStream zis = new ZipInputStream(bais);
+            njar = new NestedJarFromStream(getVFSContext(), this, zis, entryURL, entry);
+         }
+      }
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java	2006-09-08 14:11:44 UTC (rev 56647)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java	2006-09-08 14:22:52 UTC (rev 56648)
@@ -0,0 +1,133 @@
+/*
+* 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.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.zip.ZipInputStream;
+
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Nested Jar Handler.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class NoCopyNestedJarHandler extends AbstractJarHandler
+{
+   /** The jar entry */
+   private JarEntry entry;
+   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
+    * @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, JarEntry entry, URL url) throws IOException
+   {
+      super(context, parent, url, getEntryName(entry));
+
+      
+      try
+      {
+         InputStream is = parentJar.getInputStream(entry);
+         ZipInputStream jis;
+         if( (is instanceof ZipInputStream) )
+         {
+            jis = (ZipInputStream) is;
+         }
+         else
+         {
+            jis = new ZipInputStream(is);
+         }
+         njar = new NestedJarFromStream(context, parent, jis, url, entry); 
+      }
+      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;
+      }
+      
+      this.entry = entry;
+   }
+   
+   /**
+    * Get the entry
+    * 
+    * @return the file
+    */
+   protected JarEntry getEntry()
+   {
+      checkClosed();
+      return entry;
+   }
+
+   @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());
+   }
+
+   @Override
+   public VirtualFileHandler findChild(String path) throws IOException
+   {
+      return njar.findChild(path);
+   }
+
+   @Override
+   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+   {
+      // TODO Auto-generated method stub
+      return super.getChildren(ignoreErrors);
+   }
+   
+}

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/spi/VFSContext.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/spi/VFSContext.java	2006-09-08 14:11:44 UTC (rev 56647)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/spi/VFSContext.java	2006-09-08 14:22:52 UTC (rev 56648)
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.net.URL;
 import java.util.List;
+import java.util.Map;
 
 import org.jboss.virtual.VFS;
 
@@ -58,7 +59,9 @@
     * @throws IOException for any problem accessing the VFS
     */
    VirtualFileHandler getRoot() throws IOException;
-   
+
+   Map<String, String> getOptions();
+
    /**
     * Get the children
     * 

Modified: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/TestFileVFS.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/TestFileVFS.java	2006-09-08 14:11:44 UTC (rev 56647)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/TestFileVFS.java	2006-09-08 14:22:52 UTC (rev 56648)
@@ -7,17 +7,26 @@
 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.URL;
 import java.util.HashSet;
 import java.util.List;
 import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import java.util.zip.ZipInputStream;
 
 import org.jboss.test.BaseTestCase;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.jar.NestedJarFromStream;
 import org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter;
+import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VFSContextFactory;
 import org.jboss.virtual.spi.VFSContextFactoryLocator;
 
@@ -51,22 +60,23 @@
     * Test that NestedJarFromStream can provide access to nested jar content
     * @throws Exception
     */
-   /*
    public void testInnerJarFile()
       throws Exception
    {
-      MemoryMXBean mem = ManagementFactory.getMemoryMXBean();
-      log.info("Starting heap usage: "+mem.getHeapMemoryUsage());
-
       // this expects to be run with a working dir of the container root
       File outerJar = new File("output/lib/outer.jar");
       assertTrue(outerJar.getAbsolutePath()+" exists", outerJar.exists());
       JarFile jf = new JarFile(outerJar);
 
+      URL rootURL = outerJar.getParentFile().toURL();
+      VFS vfs = VFS.getVFS(rootURL);
+      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
+      VFSContext context = factory.getVFS(rootURL);
+
       JarEntry jar1 = jf.getJarEntry("jar1.jar");
       URL jar1URL = new URL(outerJar.toURL(), "jar1.jar");
       ZipInputStream jis1 = new ZipInputStream(jf.getInputStream(jar1));
-      NestedJarFromStream njfs = new NestedJarFromStream(jis1, jar1URL, "/jar1.jar", jar1);
+      NestedJarFromStream njfs = new NestedJarFromStream(context, null, jis1, jar1URL, jar1);
       NestedJarFromStream.JarEntryContents e1 = njfs.getEntry("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
       assertNotNull(e1);
       log.info("org/jboss/test/vfs/support/CommonClass.class: "+e1);
@@ -83,7 +93,7 @@
       JarEntry jar2 = jf.getJarEntry("jar2.jar");
       URL jar2URL = new URL(outerJar.toURL(), "jar2.jar");
       ZipInputStream jis2 = new ZipInputStream(jf.getInputStream(jar2));
-      NestedJarFromStream njfs2 = new NestedJarFromStream(jis2, jar2URL, "/jar2.jar", jar2);
+      NestedJarFromStream njfs2 = new NestedJarFromStream(context, null, jis2, jar2URL, jar2);
       NestedJarFromStream.JarEntryContents e2 = njfs2.getEntry("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
       assertNotNull(e2);
       log.info("org/jboss/test/vfs/support/CommonClass.class: "+e2);
@@ -96,9 +106,7 @@
       assertEquals("jar2", version2);
       mf2IS.close();
       njfs2.close();
-      log.info("Ending heap usage: "+mem.getHeapMemoryUsage());
    }
-   */
 
    /**
     * Basic tests of accessing resources in a jar
@@ -328,7 +336,6 @@
     * Test the serialization of VirtualFiles
     * @throws Exception
     */
-   /*
    public void testVFSerialization()
       throws Exception
    {
@@ -337,12 +344,12 @@
       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();
-      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURL);
-      ReadOnlyVFS vfs = factory.getVFS(rootURL);
-      VirtualFile tmpVF = vfs.resolveFile("vfs.ser");
+      VFS vfs = VFS.getVFS(rootURL);
+      VirtualFile tmpVF = vfs.findChildFromRoot("vfs.ser");
       FileOutputStream fos = new FileOutputStream(tmp);
       ObjectOutputStream oos = new ObjectOutputStream(fos);
       oos.writeObject(tmpVF);
@@ -364,7 +371,6 @@
       assertEquals("size", size, tmpVF2.getSize());
       assertEquals("url", url, tmpVF2.toURL());
    }
-   */
 
    /**
     * Test that the URL of a VFS corresponding to a directory ends in '/' so that




More information about the jboss-cvs-commits mailing list