[jboss-cvs] JBossAS SVN: r99950 - projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 26 12:12:26 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-01-26 12:12:25 -0500 (Tue, 26 Jan 2010)
New Revision: 99950

Added:
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VirtualFileInfo.java
Modified:
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
Log:
Remove fragment support in VFSClassLoaderPolicy
Promote VirtualFileInfo to top level 

Modified: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2010-01-26 16:51:18 UTC (rev 99949)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2010-01-26 17:12:25 UTC (rev 99950)
@@ -35,7 +35,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.jar.Manifest;
 
 import org.jboss.classloader.plugins.ClassLoaderUtils;
@@ -80,9 +79,6 @@
    /** The roots */
    private VirtualFile[] roots;
    
-   /** The fragment roots */
-   private List<VirtualFile> fragments;
-   
    /** The excluded roots */
    private VirtualFile[] excludedRoots;
 
@@ -114,7 +110,7 @@
    private Map<String, Manifest> manifestCache = new ConcurrentHashMap<String, Manifest>();
    
    /** Cache of virtual file information by path */
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings({ "unchecked", "rawtypes" })
    private Map<String, VirtualFileInfo> vfsCache = Collections.synchronizedMap(new SoftValueHashMap());
    
    /** JBCL-64, JBVFS-77: CodeSource should use real url **/
@@ -269,51 +265,6 @@
       return name;
    }
 
-   /**
-    * Attach a new fragment root to the policy.
-    * @param fragRoot The fragment root file
-    */
-   public void attachFragment(VirtualFile fragRoot)
-   {
-      if (fragRoot == null)
-         throw new IllegalArgumentException("Null fragment file");
-      
-      if (fragments == null)
-         fragments = new CopyOnWriteArrayList<VirtualFile>();
-      
-      fragments.add(fragRoot);
-   }
-   
-   /**
-    * Detach a fragment root from the policy.
-    * @param fragRoot The fragment root file
-    * @return true if the fragment could be detached
-    */
-   public boolean detachFragment(VirtualFile fragRoot)
-   {
-      if (fragRoot == null)
-         throw new IllegalArgumentException("Null fragment file");
-      
-      if (fragments == null)
-         return false;
-      
-      return fragments.remove(fragRoot);
-   }
-   
-   /**
-    * Get the array of attached fragment root files.
-    * @return The array of attached fragment root files or null.
-    */
-   public VirtualFile[] getFragmentRoots()
-   {
-      if (fragments == null)
-         return null;
-      
-      VirtualFile[] retarr = new VirtualFile[fragments.size()];
-      fragments.toArray(retarr);
-      return retarr;
-   }
-
    @Override
    public List<? extends DelegateLoader> getDelegates()
    {
@@ -643,26 +594,6 @@
          }
       }
       
-      if (fragments != null)
-      {
-         for (VirtualFile root : fragments)
-         {
-            try
-            {
-               VirtualFile file = root.getChild(path);
-               if (file != null)
-               {
-                  result = new VirtualFileInfo(file, root);
-                  vfsCache.put(path, result);
-                  return result;
-               }
-            }
-            catch (Exception ignored)
-            {
-            }
-         }
-      }
-      
       return null;
    }
    
@@ -763,41 +694,4 @@
       }
       return false;
    }
-
-   /**
-    * VirtualFileInfo.    */
-   private static class VirtualFileInfo
-   {
-      /** The file */
-      private VirtualFile file;
-      
-      /** The root */
-      private VirtualFile root;
-      
-      public VirtualFileInfo(VirtualFile file, VirtualFile root)
-      {
-         this.file = file;
-         this.root = root;
-      }
-
-      /**
-       * Get the file.
-       * 
-       * @return the file.
-       */
-      public VirtualFile getFile()
-      {
-         return file;
-      }
-
-      /**
-       * Get the root.
-       * 
-       * @return the root.
-       */
-      public VirtualFile getRoot()
-      {
-         return root;
-      }
-   }
 }

Added: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VirtualFileInfo.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VirtualFileInfo.java	                        (rev 0)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VirtualFileInfo.java	2010-01-26 17:12:25 UTC (rev 99950)
@@ -0,0 +1,45 @@
+package org.jboss.classloading.spi.vfs.policy;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A cache entry in the policy that combines the entry with its associated root.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a> 
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class VirtualFileInfo
+{
+   /** The file */
+   private VirtualFile file;
+
+   /** The root */
+   private VirtualFile root;
+
+   public VirtualFileInfo(VirtualFile file, VirtualFile root)
+   {
+      this.file = file;
+      this.root = root;
+   }
+
+   /**
+    * Get the file.
+    * 
+    * @return the file.
+    */
+   public VirtualFile getFile()
+   {
+      return file;
+   }
+
+   /**
+    * Get the root.
+    * 
+    * @return the root.
+    */
+   public VirtualFile getRoot()
+   {
+      return root;
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list