You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/02/21 03:18:02 UTC

svn commit: r1072823 - in /incubator/lcf/trunk: CHANGES.txt framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCFResourceLoader.java

Author: kwright
Date: Mon Feb 21 02:18:02 2011
New Revision: 1072823

URL: http://svn.apache.org/viewvc?rev=1072823&view=rev
Log:
Fix for CONNECTORS-162.  Add infrastructure needed to build derived resource loaders from the default one.

Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCFResourceLoader.java

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1072823&r1=1072822&r2=1072823&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Mon Feb 21 02:18:02 2011
@@ -3,6 +3,11 @@ $Id$
 
 ==================  0.2-dev ==================
 
+CONNECTORS-162: Add infrastructure support for derived resource
+loading, so that individual connectors can use this model to prevent jar
+conflicts.
+(Karl Wright)
+
 CONNECTORS-160: Add local trust store and working https support
 for Solr connector.
 (Carina Lannig, Karl Wright)

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1072823&r1=1072822&r2=1072823&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java Mon Feb 21 02:18:02 2011
@@ -1094,6 +1094,14 @@ public class ManifoldCF
     }
   }
   
+  /** Create a new resource loader based on the default one.  This is used by
+  * connectors wishing to make their own resource loaders for isolation purposes.
+  */
+  public static ManifoldCFResourceLoader createResourceLoader()
+    throws ManifoldCFException
+  {
+    return new ManifoldCFResourceLoader(resourceLoader.getClassLoader());
+  }
   
   /** Locate a class in the configuration-determined class path.  This method
   * is designed for loading plugin classes, and their downstream dependents.

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCFResourceLoader.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCFResourceLoader.java?rev=1072823&r1=1072822&r2=1072823&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCFResourceLoader.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCFResourceLoader.java Mon Feb 21 02:18:02 2011
@@ -106,11 +106,10 @@ public class ManifoldCFResourceLoader
     addDirsToClassPath(new File[]{dir}, new FileFilter[]{filter});
   }
 
-  /** Get the specified class using the proper classloader.
-  *@param cname is the fully-qualified class name.
+  /** Get the class loader representing this resource loader.
   */
-  public synchronized Class findClass(String cname)
-    throws ClassNotFoundException,ManifoldCFException
+  public synchronized ClassLoader getClassLoader()
+    throws ManifoldCFException
   {
     if (classLoader == null)
     {
@@ -137,9 +136,17 @@ public class ManifoldCFResourceLoader
         classLoader = URLClassLoader.newInstance(elements, parent);
       }
     }
-    
+    return classLoader;
+  }
+
+  /** Get the specified class using the proper classloader.
+  *@param cname is the fully-qualified class name.
+  */
+  public Class findClass(String cname)
+    throws ClassNotFoundException,ManifoldCFException
+  {
     // If we ever get this far, we have a classloader at least...
-    return Class.forName(cname,true,classLoader);
+    return Class.forName(cname,true,getClassLoader());
   }
 
   /** Add fully-resolved directories (with filters) to the current class path.