[jboss-cvs] JBossAS SVN: r91992 - in projects/embedded/trunk/core/src: main/java/org/jboss/embedded/core/incubation/virtual/impl and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 4 21:37:13 EDT 2009


Author: ALRubinger
Date: 2009-08-04 21:37:12 -0400 (Tue, 04 Aug 2009)
New Revision: 91992

Added:
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/SecurityActions.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/TempFileArchiveImpl.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/AbstractVfsVirtualArchive.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/MemoryArchiveImpl.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/jdk/
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/jdk/VirtualJdkArchive.java
Removed:
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/VirtualVfsArchiveImpl.java
Modified:
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/api/VirtualArchiveFactory.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/vfs/VirtualVfsArchive.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java
   projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableFactoryTestCase.java
   projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableImplTestCase.java
   projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/virtual/vfs/VirtualVfsArchiveTestCase.java
Log:
[EMB-32] Start a pure JDK impl of virtual archives using a temp directory

Modified: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/api/VirtualArchiveFactory.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/api/VirtualArchiveFactory.java	2009-08-05 01:13:02 UTC (rev 91991)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/api/VirtualArchiveFactory.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -54,7 +54,7 @@
    /**
     * FQN of implementation Class used in creating new archives 
     */
-   private static final String CLASS_NAME_ARCHIVE_IMPL = "org.jboss.embedded.core.incubation.virtual.impl.vfs.VirtualVfsArchiveImpl";
+   private static final String CLASS_NAME_ARCHIVE_IMPL = "org.jboss.embedded.core.incubation.virtual.impl.vfs.MemoryArchiveImpl";
 
    /**
     * FQNs of type of parameters to implementation class constructor

Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/SecurityActions.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/SecurityActions.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/SecurityActions.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -0,0 +1,47 @@
+package org.jboss.embedded.core.incubation.virtual.impl.jdk;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ * 
+ * A set of privileged actions that are not to leak out
+ * of this package 
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+   //-------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * No external instanciation
+    */
+   private SecurityActions()
+   {
+
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Utility Methods --------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the Thread Context ClassLoader
+    */
+   static ClassLoader getThreadContextClassLoader()
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+      {
+         public ClassLoader run()
+         {
+            return Thread.currentThread().getContextClassLoader();
+         }
+      });
+   }
+}


Property changes on: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/SecurityActions.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/TempFileArchiveImpl.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/TempFileArchiveImpl.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/jdk/TempFileArchiveImpl.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -0,0 +1,304 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.incubation.virtual.impl.jdk;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.jboss.embedded.core.incubation.virtual.impl.base.AbstractVirtualArchive;
+import org.jboss.embedded.core.incubation.virtual.spi.jdk.VirtualJdkArchive;
+import org.jboss.logging.Logger;
+
+/**
+ * TempFileArchiveImpl
+ * 
+ * Concrete implementation of a virtual archive which
+ * stores contents in a directory structure in the temp directory
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class TempFileArchiveImpl extends AbstractVirtualArchive implements VirtualJdkArchive
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(TempFileArchiveImpl.class);
+
+   /**
+    * Prefix to be applied to the virtual archive temp directory
+    */
+   private static final String PREFIX_TEMP = "virtualarchive";
+
+   /**
+    * Empty String
+    */
+   private static final String EMPTY_STRING = "";
+
+   /**
+    * Root of all virtual archives
+    */
+   private static final File archivesRoot;
+
+   /*
+    * Initialize the temp directory location once on load/init
+    */
+   static
+   {
+      try
+      {
+
+         // Make a new temp file to get unique namespace
+         final File tempStub = File.createTempFile(PREFIX_TEMP, EMPTY_STRING);
+         // Delete it
+         tempStub.delete();
+         // Make a new directory in the place of the temp file
+         final File temp = new File(tempStub.getAbsolutePath());
+         if (!temp.mkdir())
+         {
+            throw new RuntimeException("Could not create the temp virtual archive location at: "
+                  + temp.getAbsolutePath());
+         }
+         // Mark the archives to delete on exit
+         temp.deleteOnExit();
+         log.debug("Virtual archives root: " + temp.getAbsolutePath());
+         // Set the archives root
+         archivesRoot = temp;
+      }
+      catch (final IOException ioe)
+      {
+         throw new RuntimeException("Could not create the temp location for virtual archives", ioe);
+      }
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Root of the archive
+    */
+   private final File root;
+
+   //-------------------------------------------------------------------------------------||
+   // Constructors -----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Constructor
+    * 
+    * Creates a new instance using the Thread Context  
+    * ClassLoader.
+    * 
+    * @param name Unique name for the deployment
+    * @throws IllegalArgumentException If the name was not specified
+    */
+   public TempFileArchiveImpl(final String name) throws IllegalArgumentException
+   {
+      this(name, SecurityActions.getThreadContextClassLoader());
+   }
+
+   /**
+    * Constructor
+    * 
+    * @param name Unique name for the deployment
+    * @param cl ClassLoader to be used in loading resources and classes
+    * @throws IllegalArgumentException If the name or ClassLoader was not specified
+    */
+   public TempFileArchiveImpl(final String name, final ClassLoader cl) throws IllegalArgumentException
+   {
+      // Invoke super
+      super(cl);
+
+      // Precondition Check
+      if (name == null || name.length() == 0)
+      {
+         throw new IllegalArgumentException("name must be specified");
+      }
+      if (cl == null)
+      {
+         throw new IllegalArgumentException("ClassLoader must be specified");
+      }
+
+      /*
+       * Set root
+       */
+
+      // Make pointer
+      final File root = new File(archivesRoot, name);
+      if (!root.mkdir())
+      {
+         throw new RuntimeException("Could not create new temp file virtual archive root: " + root.getAbsolutePath());
+      }
+
+      // Set
+      this.root = root;
+
+      // Delete it on exit
+      this.deleteOnExit(root);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.embedded.core.incubation.virtual.impl.base.AbstractVirtualArchive#addContent(byte[], java.lang.String)
+    */
+   @Override
+   protected void addContent(final byte[] content, final String location) throws IllegalArgumentException
+   {
+      // Make the new pointer
+      final File newFile = new File(this.getRoot(), location);
+      this.deleteOnExit(newFile);
+      final String newPath = newFile.getAbsolutePath();
+
+      // Ensure the parent location exists, or we can make it
+      final File parent = newFile.getParentFile();
+      if (!parent.exists() && !parent.mkdirs())
+      {
+         throw new RuntimeException("Could not make " + parent.getAbsolutePath());
+      }
+
+      // Get an OutputStream to write into the buffer
+      final BufferedOutputStream out;
+      try
+      {
+         out = new BufferedOutputStream(new FileOutputStream(newFile));
+      }
+      catch (final FileNotFoundException e)
+      {
+         throw new RuntimeException("Could not obtain file: " + newPath, e);
+      }
+
+      // Write
+      try
+      {
+         out.write(content);
+         log.debug("Wrote " + content.length + " bytes to " + newPath);
+      }
+      catch (final IOException ioe)
+      {
+         throw new RuntimeException("Error in writing to file " + newPath, ioe);
+      }
+      // Close
+      finally
+      {
+         try
+         {
+            out.close();
+         }
+         catch (final IOException e)
+         {
+            // Ignore
+         }
+      }
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.embedded.core.incubation.virtual.api.VirtualArchive#toString(boolean)
+    */
+   @Override
+   public String toString(final boolean verbose)
+   {
+      // Short form
+      if (!verbose)
+      {
+         return this.toString();
+      }
+      // Verbose
+      else
+      {
+         return "";
+      }
+   }
+
+   /* (non-Javadoc)
+    * @see java.lang.Object#toString()
+    */
+   @Override
+   public String toString()
+   {
+      return super.toString() + ": " + this.getRoot().getAbsolutePath();
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.embedded.core.incubation.virtual.spi.jdk.VirtualJdkArchive#getRoot()
+    */
+   @Override
+   public File getRoot()
+   {
+      return this.root;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Marks the specified File, and all parents of that file up to the
+    * root of this archive, to delete upon JVM normal exit as documented by
+    * {@link File#deleteOnExit()}
+    * 
+    * @param File the File, and parents to to the root, to delete
+    * @throws IllegalArgumentException If the specified file is null
+    * @throws IllegalStateException If the root is not yet set
+    */
+   private void deleteOnExit(final File file) throws IllegalArgumentException, IllegalStateException
+   {
+      // Precondition check
+      assert file != null : "file was null";
+
+      // Get the root
+      final File root = archivesRoot;
+      if (root == null)
+      {
+         throw new IllegalStateException("root must first be set");
+      }
+
+      // If this is the root, exit
+      if (file.equals(root))
+      {
+         return;
+      }
+
+      // Delete the parent (if not the root)
+      final File parent = file.getParentFile();
+      this.deleteOnExit(parent);
+
+      // Mark to delete
+      file.deleteOnExit();
+      log.debug("Going to delete on exit: " + file.getAbsolutePath());
+   }
+
+}

Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/AbstractVfsVirtualArchive.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/AbstractVfsVirtualArchive.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/AbstractVfsVirtualArchive.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -0,0 +1,254 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.incubation.virtual.impl.vfs;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.embedded.core.incubation.virtual.impl.base.AbstractVirtualArchive;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * AbstractVfsVirtualArchive
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+abstract class AbstractVfsVirtualArchive extends AbstractVirtualArchive
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(AbstractVfsVirtualArchive.class);
+
+   /**
+    * Newline character
+    */
+   private static final char NEWLINE = '\n';
+
+   //-------------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * The root of the deployment
+    */
+   private VirtualFile root;
+
+   /**
+    * The URL to the root deployment
+    */
+   private URL rootUrl;
+
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Constructor
+    * 
+    * Creates a new instance with the specified root and rootURL
+    * 
+    * @param root
+    * @param rootUrl
+    * @param cl
+    */
+   public AbstractVfsVirtualArchive(final ClassLoader cl)
+   {
+      // Invoke super
+      super(cl);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.core.deployment.ExtensibleVirtualDeployment#toString(boolean)
+    */
+   @Override
+   public String toString(final boolean verbose)
+   {
+      // If we want verbose output
+      if (verbose)
+      {
+         // Describe the root
+         return this.describe(this.getRoot());
+      }
+
+      // Fall back on toString
+      return this.toString();
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Initializes the archive with the specified root and root URL
+    *  
+    * @param root
+    * @param rootUrl
+    * @throws IllegalArgumentException If either the root or root URL is not specified
+    */
+   void initialize(final VirtualFile root, final URL rootUrl) throws IllegalArgumentException
+   {
+      // Precondition checks
+      if (root == null)
+      {
+         throw new IllegalArgumentException("root is null");
+      }
+      if (rootUrl == null)
+      {
+         throw new IllegalArgumentException("rootUrl is null");
+      }
+
+      // Set properties
+      this.root = root;
+      this.rootUrl = rootUrl;
+   }
+
+   /**
+    * Describes this file in form:
+    * 
+    * "/path/resource.ext - x bytes"
+    * 
+    * In addition to all children of the given file root.
+    * 
+    * @param file The root to describe
+    * @return
+    * @throws IllegalArgumentException If either the file or builder are not specified
+    */
+   private String describe(final VirtualFile file)
+   {
+      // Precondition checks
+      if (file == null)
+      {
+         throw new IllegalArgumentException("file must be specified");
+      }
+
+      // Make a StringBuilder
+      final StringBuilder sb = new StringBuilder();
+
+      // Start the output
+      sb.append(file);
+      sb.append(NEWLINE);
+
+      // Describe in depth
+      return this.describe(file, sb);
+   }
+
+   /**
+    * Describes this file in form:
+    * 
+    * "/path/resource.ext - x bytes"
+    * 
+    * In addition to all children of the given file root.
+    * 
+    * @param file The root to describe
+    * @param sb The builder to which the description will be appended
+    * @return
+    * @throws IllegalArgumentException If either the file or builder are not specified
+    */
+   private String describe(final VirtualFile file, final StringBuilder sb) throws IllegalArgumentException
+   {
+      // Precondition checks
+      if (file == null)
+      {
+         throw new IllegalArgumentException("file must be specified");
+      }
+      if (sb == null)
+      {
+         throw new IllegalArgumentException("builder must be specified");
+      }
+
+      // Get information for this root
+      final String path = file.getPathName();
+      final long size;
+      try
+      {
+         size = file.getSize();
+      }
+      catch (final IOException ioe)
+      {
+         throw new RuntimeException("Could not get size for: " + file, ioe);
+      }
+
+      // Append this information
+      sb.append(path);
+      sb.append(" - ");
+      sb.append(size);
+      sb.append(" bytes");
+      sb.append(NEWLINE);
+
+      // Recurse into any children
+      final List<VirtualFile> children;
+      try
+      {
+         children = file.getChildren();
+      }
+      catch (final IOException ioe)
+      {
+         throw new RuntimeException("Could not obtain children for: " + file, ioe);
+      }
+      if (children != null && children.size() > 0)
+      {
+         for (final VirtualFile child : children)
+         {
+            this.describe(child, sb);
+         }
+      }
+
+      // Return
+      return sb.toString();
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Accessors / Mutators ---------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * @return the root
+    */
+   public final VirtualFile getRoot()
+   {
+      return root;
+   }
+
+   /**
+    * Returns a copy of this root's URL (not the
+    * actual reference as we want to protect internal 
+    * state from mutation)
+    * @return
+    */
+   final URL getRootUrl()
+   {
+      return this.copyURL(this.rootUrl);
+   }
+}

Copied: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/MemoryArchiveImpl.java (from rev 91914, projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/VirtualVfsArchiveImpl.java)
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/MemoryArchiveImpl.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/MemoryArchiveImpl.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -0,0 +1,198 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.incubation.virtual.impl.vfs;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.embedded.core.incubation.virtual.spi.vfs.VirtualVfsArchive;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.MemoryFileFactory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * MemoryArchiveImpl
+ * 
+ * Concrete implementation of a VFS-backed virtual archive which
+ * stores contents in-memory
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class MemoryArchiveImpl extends AbstractVfsVirtualArchive implements VirtualVfsArchive
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(MemoryArchiveImpl.class);
+
+   /**
+    * Protocol of VFS in-memory 
+    */
+   private static final String PROTOCOL_VFS_MEMORY = "vfsmemory";
+
+   /**
+    * Empty String
+    */
+   private static final String EMPTY_STRING = "";
+
+   /**
+    * Separator
+    */
+   private static final char SEPARATOR = '/';
+
+   //-------------------------------------------------------------------------------------||
+   // Constructors -----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Constructor
+    * 
+    * Creates a new instance using the Thread Context  
+    * ClassLoader.
+    * 
+    * @param name Unique name for the deployment
+    * @throws IllegalArgumentException If the name was not specified
+    */
+   public MemoryArchiveImpl(final String name) throws IllegalArgumentException
+   {
+      this(name, SecurityActions.getThreadContextClassLoader());
+   }
+
+   /**
+    * Constructor
+    * 
+    * @param name Unique name for the deployment
+    * @param cl ClassLoader to be used in loading resources and classes
+    * @throws IllegalArgumentException If the name or ClassLoader was not specified
+    */
+   public MemoryArchiveImpl(final String name, final ClassLoader cl) throws IllegalArgumentException
+   {
+      // Invoke super
+      super(cl);
+
+      // Precondition Check
+      if (name == null || name.length() == 0)
+      {
+         throw new IllegalArgumentException("name must be specified");
+      }
+      if (cl == null)
+      {
+         throw new IllegalArgumentException("ClassLoader must be specified");
+      }
+
+      // Create the root for the archive
+      VirtualFile file = null;
+      URL url = null;
+      try
+      {
+         final URL memoryRootUrl = new URL(PROTOCOL_VFS_MEMORY, name, EMPTY_STRING);
+         MemoryFileFactory.createRoot(memoryRootUrl);
+         final URL stubUrl = new URL(memoryRootUrl, name);
+         MemoryFileFactory.createDirectory(stubUrl);
+         url = stubUrl;
+         file = VFS.getRoot(memoryRootUrl);
+      }
+      catch (final IOException ioe)
+      {
+         throw new RuntimeException("Error in creating the root for virtual deployment \"" + name + "\"", ioe);
+      }
+
+      // Set properties for the root
+      this.initialize(file, url);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Puts the specified content at the specified location as a memory file
+    * @param content
+    * @param location
+    * @throws IllegalArgumentException
+    */
+   void addContent(final byte[] content, final URL location) throws IllegalArgumentException
+   {
+      // Precondition check
+      if (content == null)
+      {
+         throw new IllegalArgumentException("content must be specified");
+      }
+      if (location == null)
+      {
+         throw new IllegalArgumentException("location must be specified");
+      }
+
+      // Put the new memory file in place
+      MemoryFileFactory.putFile(location, content);
+      log.debug("Added: " + location);
+
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.embedded.core.incubation.virtual.impl.base.AbstractVirtualArchive#addContent(byte[], java.lang.String)
+    */
+   @Override
+   protected void addContent(final byte[] content, final String location) throws IllegalArgumentException
+   {
+      // Precondition check
+      if (content == null)
+      {
+         throw new IllegalArgumentException("content must be specified");
+      }
+      if (location == null || location.length() == 0)
+      {
+         throw new IllegalArgumentException("location must be specified");
+      }
+
+      // Get the root URL of the memory file
+      final URL rootUrl = this.getRootUrl();
+
+      // Construct a new URL for this new memoryfile
+      URL url = null;
+      try
+      {
+         final StringBuilder sb = new StringBuilder();
+         sb.append(rootUrl.toExternalForm());
+         sb.append(SEPARATOR);
+         sb.append(location);
+         url = new URL(sb.toString());
+      }
+      catch (final MalformedURLException murle)
+      {
+         throw new RuntimeException("Could not form URL for new resource \"" + location + "\" in " + this, murle);
+      }
+
+      // Add the content
+      this.addContent(content, url);
+   }
+
+}

Deleted: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/VirtualVfsArchiveImpl.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/VirtualVfsArchiveImpl.java	2009-08-05 01:13:02 UTC (rev 91991)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/VirtualVfsArchiveImpl.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -1,359 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.embedded.core.incubation.virtual.impl.vfs;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.embedded.core.incubation.virtual.impl.base.AbstractVirtualArchive;
-import org.jboss.embedded.core.incubation.virtual.spi.vfs.VirtualVfsArchive;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.MemoryFileFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * VirtualVfsArchiveImpl
- * 
- * Concrete implementation of a VFS-backed virtual archive
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class VirtualVfsArchiveImpl extends AbstractVirtualArchive implements VirtualVfsArchive
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(VirtualVfsArchiveImpl.class);
-
-   /**
-    * Protocol of VFS in-memory 
-    */
-   private static final String PROTOCOL_VFS_MEMORY = "vfsmemory";
-
-   /**
-    * Newline character
-    */
-   private static final char NEWLINE = '\n';
-
-   /**
-    * Empty String
-    */
-   private static final String EMPTY_STRING = "";
-
-   /**
-    * Separator
-    */
-   private static final char SEPARATOR = '/';
-
-   //-------------------------------------------------------------------------------------||
-   // Instance Members -------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * The root of the deployment
-    */
-   private final VirtualFile root;
-
-   /**
-    * The URL to the root deployment
-    */
-   private final URL rootUrl;
-
-   //-------------------------------------------------------------------------------------||
-   // Constructors -----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Constructor
-    * 
-    * Creates a new instance using the Thread Context  
-    * ClassLoader.
-    * 
-    * @param name Unique name for the deployment
-    * @throws IllegalArgumentException If the name was not specified
-    */
-   public VirtualVfsArchiveImpl(final String name) throws IllegalArgumentException
-   {
-      this(name, SecurityActions.getThreadContextClassLoader());
-   }
-
-   /**
-    * Constructor
-    * 
-    * @param name Unique name for the deployment
-    * @param cl ClassLoader to be used in loading resources and classes
-    * @throws IllegalArgumentException If the name, actual class or ClassLoader was not specified
-    */
-   public VirtualVfsArchiveImpl(final String name, final ClassLoader cl) throws IllegalArgumentException
-   {
-      // Invoke super
-      super(cl);
-
-      // Precondition Check
-      if (name == null || name.length() == 0)
-      {
-         throw new IllegalArgumentException("name must be specified");
-      }
-      if (cl == null)
-      {
-         throw new IllegalArgumentException("ClassLoader must be specified");
-      }
-
-      // Create the root for the deployment
-      VirtualFile file = null;
-      URL url = null;
-      try
-      {
-         final URL memoryRootUrl = new URL(PROTOCOL_VFS_MEMORY, name, EMPTY_STRING);
-         MemoryFileFactory.createRoot(memoryRootUrl);
-         final URL stubUrl = new URL(memoryRootUrl, name);
-         MemoryFileFactory.createDirectory(stubUrl);
-         url = stubUrl;
-         file = VFS.getRoot(memoryRootUrl);
-      }
-      catch (final IOException ioe)
-      {
-         throw new RuntimeException("Error in creating the root for virtual deployment \"" + name + "\"", ioe);
-      }
-
-      // Set properties for the root
-      this.root = file;
-      this.rootUrl = url;
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations -----------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /*
-    * (non-Javadoc)
-    * @see org.jboss.embedded.core.deployment.ExtensibleVirtualVfsArchive#getRoot()
-    */
-   @Override
-   public VirtualFile getRoot()
-   {
-      return this.root;
-   }
-
-   /*
-    * (non-Javadoc)
-    * @see org.jboss.embedded.core.incubation.virtual.impl.base.AbstractVirtualArchive#addContent(byte[], java.lang.String)
-    */
-   @Override
-   protected void addContent(final byte[] content, final String location) throws IllegalArgumentException
-   {
-      // Precondition check
-      if (content == null)
-      {
-         throw new IllegalArgumentException("content must be specified");
-      }
-      if (location == null || location.length() == 0)
-      {
-         throw new IllegalArgumentException("location must be specified");
-      }
-
-      // Get the root URL of the memory file
-      final URL rootUrl = this.getRootUrl();
-
-      // Construct a new URL for this new memoryfile
-      URL url = null;
-      try
-      {
-         final StringBuilder sb = new StringBuilder();
-         sb.append(rootUrl.toExternalForm());
-         sb.append(SEPARATOR);
-         sb.append(location);
-         url = new URL(sb.toString());
-      }
-      catch (final MalformedURLException murle)
-      {
-         throw new RuntimeException("Could not form URL for new resource \"" + location + "\" in " + this, murle);
-      }
-
-      // Add the content
-      this.addContent(content, url);
-   }
-
-   /* (non-Javadoc)
-    * @see org.jboss.embedded.core.deployment.ExtensibleVirtualDeployment#toString(boolean)
-    */
-   @Override
-   public String toString(final boolean verbose)
-   {
-      // If we want verbose output
-      if (verbose)
-      {
-         // Describe the root
-         return this.describe(this.getRoot());
-      }
-
-      // Fall back on toString
-      return this.toString();
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Describes this file in form:
-    * 
-    * "/path/resource.ext - x bytes"
-    * 
-    * In addition to all children of the given file root.
-    * 
-    * @param file The root to describe
-    * @return
-    * @throws IllegalArgumentException If either the file or builder are not specified
-    */
-   private String describe(final VirtualFile file)
-   {
-      // Precondition checks
-      if (file == null)
-      {
-         throw new IllegalArgumentException("file must be specified");
-      }
-
-      // Make a StringBuilder
-      final StringBuilder sb = new StringBuilder();
-
-      // Start the output
-      sb.append(file);
-      sb.append(NEWLINE);
-
-      // Describe in depth
-      return this.describe(file, sb);
-   }
-
-   /**
-    * Describes this file in form:
-    * 
-    * "/path/resource.ext - x bytes"
-    * 
-    * In addition to all children of the given file root.
-    * 
-    * @param file The root to describe
-    * @param sb The builder to which the description will be appended
-    * @return
-    * @throws IllegalArgumentException If either the file or builder are not specified
-    */
-   private String describe(final VirtualFile file, final StringBuilder sb) throws IllegalArgumentException
-   {
-      // Precondition checks
-      if (file == null)
-      {
-         throw new IllegalArgumentException("file must be specified");
-      }
-      if (sb == null)
-      {
-         throw new IllegalArgumentException("builder must be specified");
-      }
-
-      // Get information for this root
-      final String path = file.getPathName();
-      final long size;
-      try
-      {
-         size = file.getSize();
-      }
-      catch (final IOException ioe)
-      {
-         throw new RuntimeException("Could not get size for: " + file, ioe);
-      }
-
-      // Append this information
-      sb.append(path);
-      sb.append(" - ");
-      sb.append(size);
-      sb.append(" bytes");
-      sb.append(NEWLINE);
-
-      // Recurse into any children
-      final List<VirtualFile> children;
-      try
-      {
-         children = file.getChildren();
-      }
-      catch (final IOException ioe)
-      {
-         throw new RuntimeException("Could not obtain children for: " + file, ioe);
-      }
-      if (children != null && children.size() > 0)
-      {
-         for (final VirtualFile child : children)
-         {
-            this.describe(child, sb);
-         }
-      }
-
-      // Return
-      return sb.toString();
-   }
-
-   /**
-    * Puts the specified content at the specified location as a memory file
-    * @param content
-    * @param location
-    * @throws IllegalArgumentException
-    */
-   private void addContent(final byte[] content, final URL location) throws IllegalArgumentException
-   {
-      // Precondition check
-      if (content == null)
-      {
-         throw new IllegalArgumentException("content must be specified");
-      }
-      if (location == null)
-      {
-         throw new IllegalArgumentException("location must be specified");
-      }
-
-      // Put the new memory file in place
-      MemoryFileFactory.putFile(location, content);
-      log.debug("Added: " + location);
-
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Accessors / Mutators ---------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Returns a copy of this root's URL (not the
-    * actual reference as we want to protect internal 
-    * state from mutation)
-    * @return
-    */
-   protected final URL getRootUrl()
-   {
-      return this.copyURL(this.rootUrl);
-   }
-}

Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/jdk/VirtualJdkArchive.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/jdk/VirtualJdkArchive.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/jdk/VirtualJdkArchive.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.core.incubation.virtual.spi.jdk;
+
+import java.io.File;
+
+import org.jboss.embedded.core.incubation.virtual.api.VirtualArchive;
+
+/**
+ * VirtualJdkArchive
+ * 
+ * Represents a single collection
+ * of resources which may
+ * be constructed declaratively / programmatically.  Adds
+ * the constraint to providers that this is backed by JDK IO.
+ * 
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface VirtualJdkArchive extends VirtualArchive
+{
+   //-------------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the File which is the root level
+    * of this archive
+    * 
+    * @return
+    */
+   File getRoot();
+}

Modified: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/vfs/VirtualVfsArchive.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/vfs/VirtualVfsArchive.java	2009-08-05 01:13:02 UTC (rev 91991)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/vfs/VirtualVfsArchive.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -27,7 +27,7 @@
 /**
  * VirtualVfsArchive
  * 
- * Represents a single in-memory collection
+ * Represents a single collection
  * of resources which may
  * be constructed declaratively / programmatically.  Adds
  * the constraint to providers that this is backed by the Virtual

Modified: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java	2009-08-05 01:13:02 UTC (rev 91991)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/server/JBossASEmbeddedServerImpl.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -41,6 +41,7 @@
 import org.jboss.embedded.core.incubation.deployable.impl.vdf.VfsVdfDeployableImpl;
 import org.jboss.embedded.core.incubation.deployable.spi.vdf.VdfDeployable;
 import org.jboss.embedded.core.incubation.virtual.api.VirtualArchive;
+import org.jboss.embedded.core.incubation.virtual.spi.jdk.VirtualJdkArchive;
 import org.jboss.embedded.core.incubation.virtual.spi.vfs.VirtualVfsArchive;
 import org.jboss.embedded.core.lifecycle.IgnoreXbUnorderedSequenceLifecycleEventHandler;
 import org.jboss.embedded.core.lifecycle.InitLoggingManagerLifecycleEventHandler;
@@ -435,6 +436,20 @@
    }
 
    /**
+    * Returns a view of the specified VirtualArchive as {@link VirtualJdkArchive}s
+    *  
+    * @param archives
+    * @return
+    * @throws IllegalArgumentException If the archives are either null, empty, or
+    *   contain any non-JDK IO types
+    */
+   private Collection<VirtualJdkArchive> asJdkArchives(final VirtualArchive... archives)
+         throws IllegalArgumentException
+   {
+      return this.asExpectedTypeCollection(VirtualJdkArchive.class, archives);
+   }
+
+   /**
     * Obtains the specified array of objects as a Collection of the specified
     * type.  Each object in the array must be assignable to the target type.
     * 

Modified: projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableFactoryTestCase.java
===================================================================
--- projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableFactoryTestCase.java	2009-08-05 01:13:02 UTC (rev 91991)
+++ projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableFactoryTestCase.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -27,7 +27,7 @@
 import org.jboss.embedded.core.incubation.deployable.api.DeployableFactory;
 import org.jboss.embedded.core.incubation.deployable.impl.vdf.VfsVdfDeployableImpl;
 import org.jboss.embedded.core.incubation.virtual.api.VirtualArchive;
-import org.jboss.embedded.core.incubation.virtual.impl.vfs.VirtualVfsArchiveImpl;
+import org.jboss.embedded.core.incubation.virtual.impl.vfs.MemoryArchiveImpl;
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VFS;
 import org.junit.BeforeClass;
@@ -83,7 +83,7 @@
       log.info("testDeployableFactory");
 
       // Make an archive
-      final VirtualArchive archive = new VirtualVfsArchiveImpl("test.jar").addClass(this.getClass());
+      final VirtualArchive archive = new MemoryArchiveImpl("test.jar").addClass(this.getClass());
 
       // Make a Deployable
       final Deployable deployable = DeployableFactory.createDeployable(archive);

Modified: projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableImplTestCase.java
===================================================================
--- projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableImplTestCase.java	2009-08-05 01:13:02 UTC (rev 91991)
+++ projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/deployable/vfs/VfsVdfDeployableImplTestCase.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -25,7 +25,7 @@
 
 import org.jboss.embedded.core.incubation.deployable.api.Deployable;
 import org.jboss.embedded.core.incubation.deployable.impl.vdf.VfsVdfDeployableImpl;
-import org.jboss.embedded.core.incubation.virtual.impl.vfs.VirtualVfsArchiveImpl;
+import org.jboss.embedded.core.incubation.virtual.impl.vfs.MemoryArchiveImpl;
 import org.jboss.embedded.core.incubation.virtual.spi.vfs.VirtualVfsArchive;
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VFS;
@@ -83,8 +83,8 @@
       log.info("testEquals");
 
       // Make some test archives
-      final VirtualVfsArchive archive1 = new VirtualVfsArchiveImpl("archive1");
-      final VirtualVfsArchive archive2 = new VirtualVfsArchiveImpl("archive2");
+      final VirtualVfsArchive archive1 = new MemoryArchiveImpl("archive1");
+      final VirtualVfsArchive archive2 = new MemoryArchiveImpl("archive2");
 
       // Make some test Deployables from the archives
       final Deployable deployable1 = new VfsVdfDeployableImpl(archive1);

Modified: projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/virtual/vfs/VirtualVfsArchiveTestCase.java
===================================================================
--- projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/virtual/vfs/VirtualVfsArchiveTestCase.java	2009-08-05 01:13:02 UTC (rev 91991)
+++ projects/embedded/trunk/core/src/test/java/org/jboss/embedded/core/incubation/virtual/vfs/VirtualVfsArchiveTestCase.java	2009-08-05 01:37:12 UTC (rev 91992)
@@ -24,7 +24,8 @@
 import java.net.URL;
 
 import org.jboss.embedded.core.incubation.virtual.api.VirtualArchive;
-import org.jboss.embedded.core.incubation.virtual.impl.vfs.VirtualVfsArchiveImpl;
+import org.jboss.embedded.core.incubation.virtual.impl.jdk.TempFileArchiveImpl;
+import org.jboss.embedded.core.incubation.virtual.impl.vfs.MemoryArchiveImpl;
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VFS;
 import org.junit.BeforeClass;
@@ -97,10 +98,10 @@
     * and assigned a new path within the archive
     */
    @Test
-   public void testAddResourceExplicitPathName() throws Exception
+   public void testAddResourceExplicitPathNameMemory() throws Exception
    {
       // Log
-      log.info("testAddResourceExplicitPathName");
+      log.info("testAddResourceExplicitPathNameMemory");
 
       // Get the base
       final URL base = this.getBase();
@@ -112,12 +113,37 @@
       final String newPath = PATH_WEB_INF + SEPARATOR + FILENAME_WEB_XML;
 
       // Make a virtual archive
-      final VirtualArchive archive = new VirtualVfsArchiveImpl("something.war").addResource(location, newPath);
+      final VirtualArchive archive = new MemoryArchiveImpl("something.war").addResource(location, newPath);
       log.info(archive.toString(true));
 
       //TODO Actually test something when we have better hooks to examine archive contents
    }
 
+   /**
+    * TODO
+    */
+   @Test
+   public void testAddResourceExplicitPathNameTemp() throws Exception
+   {
+      // Log
+      log.info("testAddResourceExplicitPathNameTemp");
+
+      // Get the base
+      final URL base = this.getBase();
+
+      // Get the path to the test XML file
+      final URL location = new URL(base, PATH_SOMETHING_XML);
+
+      // Define the new path
+      final String newPath = PATH_WEB_INF + SEPARATOR + FILENAME_WEB_XML;
+
+      // Make a virtual archive
+      final VirtualArchive archive = new TempFileArchiveImpl("something.war").addResource(location, newPath);
+      log.info(archive.toString(true));
+
+      //TODO Actually test something when we have better hooks to examine archive contents
+   }
+
    //-------------------------------------------------------------------------------------||
    // Internal Helper Methods ------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||




More information about the jboss-cvs-commits mailing list