[jboss-cvs] JBossAS SVN: r62033 - in projects/vfs/trunk/src: main/java/org/jboss/virtual/protocol/vfs and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 3 10:33:32 EDT 2007


Author: bill.burke at jboss.com
Date: 2007-04-03 10:33:32 -0400 (Tue, 03 Apr 2007)
New Revision: 62033

Added:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/Assembled.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java
Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContext.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java
Log:
Added javadocs for Assembled stuff as weill as a new ByteArrayHandler for it.

Added: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/Assembled.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/Assembled.java	                        (rev 0)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/Assembled.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -0,0 +1,38 @@
+/*
+* 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.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Marker annotation
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME)
+public @interface Assembled
+{
+}

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContext.java	2007-04-03 14:12:16 UTC (rev 62032)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContext.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -29,7 +29,7 @@
 import java.io.IOException;
 
 /**
- * JarContext.
+ * AssembledContext.
  *
  * @author Scott.Stark at jboss.org
  * @author <a href="adrian at jboss.com">Adrian Brock</a>

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java	2007-04-03 14:12:16 UTC (rev 62032)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -26,7 +26,7 @@
 import java.io.IOException;
 
 /**
- * comment
+ * Factory for creating AssembledDirectory.
  *
  * @author <a href="bill at jboss.com">Bill Burke</a>
  * @version $Revision: 1.1 $
@@ -35,8 +35,16 @@
 {
    private ConcurrentHashMap<String, AssembledDirectory> registry = new ConcurrentHashMap<String, AssembledDirectory>();
    private volatile int count;
-   private static  AssembledContextFactory singleton = new AssembledContextFactory();
+   private static  AssembledContextFactory instance = new AssembledContextFactory();
 
+   /**
+    * Creates an assembly returning the root AssembledDirectory .
+    * Creates an assembly base and registers it with a local hashmap under name.
+    *
+    * @param name the name of this assembly
+    * @param rootName the name of the root directory you want
+    * @return
+    */
    public AssembledDirectory create(String name, String rootName)
    {
       if (registry.containsKey(name)) throw new RuntimeException("Assembled context already exists for name: " + name);
@@ -57,17 +65,36 @@
       }
    }
 
+   /**
+    * Find an assembly.  Usually used only by the URL protocol handlers.
+    *
+    * @param name
+    * @return
+    */
    public AssembledDirectory find(String name)
    {
       return registry.get(name);
    }
 
+   /**
+    * Creates an assembly returning the root AssembledDirectory .
+    * 
+    * The assembly name will be randomly generated and registered with the internal hashmap registry.
+    *
+    * @param rootName the name of the root AssembledDirectory
+    * @return
+    */
    public AssembledDirectory create(String rootName)
    {
       String name = "" + System.currentTimeMillis() + "" + count++;
       return create(name, rootName);
    }
 
+   /**
+    * Remove an assembly
+    *
+    * @param directory
+    */
    public void remove(AssembledDirectory directory)
    {
       try
@@ -81,13 +108,13 @@
       registry.remove(((AssembledContext)directory.getHandler().getVFSContext()).getName());
    }
 
-   public static AssembledContextFactory getSingleton()
+   public static AssembledContextFactory getInstance()
    {
-      return singleton;
+      return instance;
    }
 
-   public static void setSingleton(AssembledContextFactory singleton)
+   public static void setInstance(AssembledContextFactory instance)
    {
-      AssembledContextFactory.singleton = singleton;
+      AssembledContextFactory.instance = instance;
    }
 }

Modified: projects/vfs/trunk/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	2007-04-03 14:12:16 UTC (rev 62032)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -36,7 +36,8 @@
 import java.util.List;
 
 /**
- * comment
+ * 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 $
@@ -51,16 +52,44 @@
       directory = (AssembledDirectoryHandler) 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
+    */
    public void addClass(Class 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)
    {
       String resource = className.replace('.', '/') + ".class";
@@ -101,17 +130,60 @@
       return p;
    }
 
+   /**
+    * 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)
    {
       String resource = baseResource.getName().replace('.', '/') + ".class";
       addResources(resource, includes, excludes);
    }
 
+   /**
+    * 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)
    {
       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)
    {
       URL url = loader.getResource(baseResource);
@@ -171,6 +243,12 @@
       }
    }
 
+   /**
+    * Create a regular expression pattern from an Ant file matching pattern
+    *
+    * @param matcher
+    * @return
+    */
    public static Pattern getPattern(String matcher)
    {
       matcher = matcher.replace(".", "\\.");
@@ -180,6 +258,13 @@
 
    }
 
+   /**
+    * 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.startsWith("/")) path = path.substring(1);
@@ -220,16 +305,30 @@
       return true;
    }
 
-   public void addChild(VirtualFile vf)
+   /**
+    * Add a VirtualFile as a child to this AssembledDirectory.
+    *
+    * @param vf
+    */
+   public VirtualFile addChild(VirtualFile vf)
    {
-      directory.addChld(vf.getHandler());
+      return directory.addChld(vf.getHandler()).getVirtualFile();
    }
 
-   public void addChild(VirtualFile vf, String newName)
+   /**
+    * 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
       {
-         directory.addChld(new AssembledFileHandler((AssembledContext) directory.getVFSContext(), directory, newName, vf.getHandler()));
+         AssembledFileHandler handler = new AssembledFileHandler((AssembledContext) directory.getVFSContext(), directory, newName, vf.getHandler());
+         directory.addChld(handler);
+         return handler.getVirtualFile();
       }
       catch (IOException e)
       {
@@ -237,30 +336,61 @@
       }
    }
 
-   public void addResource(String resource)
+   /**
+    * 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)
    {
-      addResource(resource, Thread.currentThread().getContextClassLoader());
+      return addResource(resource, Thread.currentThread().getContextClassLoader());
    }
 
-   public void addResource(String resource, String newName)
+   /**
+    * 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)
    {
-      addResource(resource, Thread.currentThread().getContextClassLoader(), newName);
+      return addResource(resource, Thread.currentThread().getContextClassLoader(), newName);
    }
 
-   public void addResource(String resource, ClassLoader loader)
+   /**
+    * 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)
    {
       URL url = loader.getResource(resource);
       if (url == null) throw new RuntimeException("Could not find resource: " + resource);
 
-      addResource(url);
+      return addResource(url);
    }
 
-   public void addResource(URL url)
+   /**
+    * Add a resource identified by the URL as a child to this AssembledDirectory.
+    *
+    * @param url
+    */
+   public VirtualFile addResource(URL url)
    {
       try
       {
          VirtualFile vf = VFS.getRoot(url);
-         addChild(vf);
+         return addChild(vf);
       }
       catch (IOException e)
       {
@@ -268,14 +398,24 @@
       }
    }
 
-   public void addResource(String resource, ClassLoader loader, String newName)
+   /**
+    * 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)
    {
       URL url = loader.getResource(resource);
       if (url == null) throw new RuntimeException("Could not find resource: " + resource);
       try
       {
          VirtualFile vf = VFS.getRoot(url);
-         addChild(vf, newName);
+         return addChild(vf, newName);
       }
       catch (IOException e)
       {
@@ -283,6 +423,35 @@
       }
    }
 
+   /**
+    * Add raw bytes as a file to this assembled directory
+    *
+    *
+    * @param bytes
+    * @param name
+    * @return
+    */
+   public VirtualFile addBytes(byte[] bytes, String name)
+   {
+      ByteArrayHandler handler = null;
+      try
+      {
+         handler = new ByteArrayHandler((AssembledContext) directory.getVFSContext(), directory, name, bytes);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+      directory.addChld(handler);
+      return handler.getVirtualFile();
+   }
+
+   /**
+    * Create a directory within this directory.
+    *
+    * @param name
+    * @return
+    */
    public AssembledDirectory mkdir(String name)
    {
       AssembledDirectoryHandler handler = null;
@@ -297,4 +466,5 @@
       }
       return new AssembledDirectory(handler);
    }
+
 }

Modified: projects/vfs/trunk/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	2007-04-03 14:12:16 UTC (rev 62032)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -38,11 +38,11 @@
 import java.util.HashMap;
 
 /**
- * comment
  *
  * @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();
@@ -58,9 +58,9 @@
       vfsUrl = new URL("vfs", context.getName(), -1, path, new AssembledUrlStreamHandler(context));
    }
 
-   public void addChld(VirtualFileHandler handler)
+   public VirtualFileHandler addChld(VirtualFileHandler handler)
    {
-      if (!(handler instanceof AssembledDirectoryHandler || handler instanceof AssembledFileHandler))
+      if (!handler.getClass().isAnnotationPresent(Assembled.class))
       {
          try
          {
@@ -74,6 +74,7 @@
       children.add(handler);
       childrenMap.put(handler.getName(), handler);
       lastModified = System.currentTimeMillis();
+      return handler;
    }
 
    public VirtualFileHandler getChild(String name)

Modified: projects/vfs/trunk/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	2007-04-03 14:12:16 UTC (rev 62032)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -33,11 +33,11 @@
 import java.util.List;
 
 /**
- * comment
  *
  * @author <a href="bill at jboss.com">Bill Burke</a>
  * @version $Revision: 1.1 $
  */
+ at Assembled
 public class AssembledFileHandler extends AbstractVirtualFileHandler
 {
    private VirtualFileHandler delegate;

Added: projects/vfs/trunk/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	                        (rev 0)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -0,0 +1,108 @@
+/*
+* 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 org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+import java.util.List;
+
+/**
+ * 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 = System.currentTimeMillis();
+
+
+   public ByteArrayHandler(AssembledContext context, VirtualFileHandler parent, String name, byte[] bytes) throws IOException
+   {
+      super(context, parent, name);
+      this.bytes = bytes;
+      vfsUrl = new URL("vfs", context.getName(), -1, getPathName(), new AssembledUrlStreamHandler(context));
+   }
+
+
+   @Override
+   public URL toURL() throws MalformedURLException, URISyntaxException
+   {
+      return vfsUrl;
+   }
+
+   public URI toURI() throws URISyntaxException
+   {
+      return vfsUrl.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");
+   }
+}

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java	2007-04-03 14:12:16 UTC (rev 62032)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -42,7 +42,7 @@
    protected URLConnection openConnection(URL u) throws IOException
    {
       String host = u.getHost();
-      AssembledDirectory directory = AssembledContextFactory.getSingleton().find(host);
+      AssembledDirectory directory = AssembledContextFactory.getInstance().find(host);
       if (directory == null) throw new IOException("vfs does not exist: " + u.toString());
       VirtualFile vf = directory.findChild(u.getPath());
       if (vf == null) throw new IOException("vfs does not exist: " + u.toString());

Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java	2007-04-03 14:12:16 UTC (rev 62032)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java	2007-04-03 14:33:32 UTC (rev 62033)
@@ -142,7 +142,7 @@
 
    public void testAddClass() throws Exception
    {
-      AssembledDirectory directory = AssembledContextFactory.getSingleton().create("foo.jar");
+      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
       directory.addClass(VirtualFile.class);
 
 
@@ -180,7 +180,7 @@
 
    public void testAddResources() throws Exception
    {
-      AssembledDirectory directory = AssembledContextFactory.getSingleton().create("foo.jar");
+      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());
@@ -249,12 +249,12 @@
       {
          if (child.getName().startsWith("Nested")) throw new RuntimeException("did not exclude propertly");
       }
-      AssembledContextFactory.getSingleton().remove(directory);
+      AssembledContextFactory.getInstance().remove(directory);
    }
 
    public void testMkDir() throws Exception
    {
-      AssembledDirectory directory = AssembledContextFactory.getSingleton().create("foo.jar");
+      AssembledDirectory directory = AssembledContextFactory.getInstance().create("foo.jar");
       directory.mkdir("META-INF");
       assertNotNull(directory.findChild("META-INF"));
 




More information about the jboss-cvs-commits mailing list