[jboss-cvs] JBossAS SVN: r80717 - projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Nov 9 07:33:59 EST 2008


Author: alesj
Date: 2008-11-09 07:33:58 -0500 (Sun, 09 Nov 2008)
New Revision: 80717

Modified:
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java
Log:
First try cache, then try to find real file.

Modified: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java	2008-11-09 12:09:25 UTC (rev 80716)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java	2008-11-09 12:33:58 UTC (rev 80717)
@@ -13,6 +13,8 @@
 import org.jboss.seam.log.Logging;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.cache.VFSCache;
+import org.jboss.virtual.spi.cache.VFSCacheFactory;
 
 /**
  * JBoss VSF aware scanner.
@@ -48,6 +50,17 @@
       if (urlString.startsWith("vfs") == false)
          return null;
 
+      VFSCache cache = VFSCacheFactory.getInstance();
+      VirtualFile vf = cache.getFile(url);
+      int depth = parentDepth;
+      while (vf != null && depth > 0)
+      {
+         vf = vf.getParent();
+         depth--;
+      }
+      if (vf != null)
+         return vf;
+
       int p = urlString.indexOf(":");
       String file = urlString.substring(p + 1);
       URL vfsurl = null;
@@ -81,8 +94,7 @@
 
       log.trace("URL: " + vfsurl + ", relative: " + relative);
 
-      // use cache any way - we should be OK with getting the parent later on
-      VirtualFile top = VFS.getCachedFile(vfsurl);
+      VirtualFile top = VFS.getRoot(vfsurl);
       top = top.getChild(relative);
       while (parentDepth > 0)
       {




More information about the jboss-cvs-commits mailing list