[jboss-cvs] JBossAS SVN: r72307 - projects/vfs/trunk/src/main/java/org/jboss/virtual.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 16 13:32:07 EDT 2008


Author: alesj
Date: 2008-04-16 13:32:07 -0400 (Wed, 16 Apr 2008)
New Revision: 72307

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
Log:
Adding move method to VFSUtils.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java	2008-04-16 17:29:24 UTC (rev 72306)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java	2008-04-16 17:32:07 UTC (rev 72307)
@@ -478,7 +478,7 @@
    }
 
    /**
-    * Unpack the artifact under original param.
+    * Unpack the artifact under file param.
     *
     * @param file the file to unpack
     * @return unpacked file
@@ -501,11 +501,28 @@
          return file;
       }
 
+      return move(file);
+   }
+
+   /**
+    * Move the artifact under file param.
+    *
+    * @param file the file to move
+    * @return moved file
+    * @throws IOException for any io error
+    * @throws URISyntaxException for any uri error
+    */
+   public static VirtualFile move(VirtualFile file) throws IOException, URISyntaxException
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+
       File unpacked = new File(getTempDirectory(), GUID.asString());
       if (unpacked.mkdir() == false)
          throw new IllegalArgumentException("Cannot create directory: " + unpacked);
       unpacked.deleteOnExit();
 
+      VirtualFileHandler handler = file.getHandler();
       unpack(handler, unpacked, false);
       FileSystemContext fileSystemContext = new FileSystemContext(unpacked);
       VirtualFileHandler newHandler = fileSystemContext.getRoot();




More information about the jboss-cvs-commits mailing list