[Jboss-cvs] JBossAS SVN: r56374 - branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 28 20:47:42 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-28 20:47:40 -0400 (Mon, 28 Aug 2006)
New Revision: 56374

Modified:
   branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LoaderRepositoryDomain.java
Log:
Port of legacy LoaderRepository to a ClassLoadingDomain base

Modified: branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LoaderRepositoryDomain.java
===================================================================
--- branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LoaderRepositoryDomain.java	2006-08-29 00:43:09 UTC (rev 56373)
+++ branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LoaderRepositoryDomain.java	2006-08-29 00:47:40 UTC (rev 56374)
@@ -22,31 +22,32 @@
 package org.jboss.mx.loading;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+
+import org.jboss.classloading.spi.ClassLoadingDomain;
+import org.jboss.classloading.spi.DomainClassLoader;
 import org.jboss.logging.Logger;
 import org.jboss.mx.server.ServerConstants;
 import org.jboss.util.loading.Translator;
 
-import javax.management.loading.ClassLoaderRepository;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Vector;
 
 /**
- * Abstract base class of all loader repository implementations
+ * Port of legacy LoaderRepository to a ClassLoadingDomain base.
  * 
- * @see org.jboss.mx.loading.BasicLoaderRepository
- *
  * @author  <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
+ * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
-public abstract class LoaderRepository
-   implements ServerConstants, ClassLoaderRepository
+public abstract class LoaderRepositoryDomain
+   implements ServerConstants, ClassLoadingDomain
 {
 
    // Attributes ----------------------------------------------------
    protected static Vector loaders = new Vector();
-   protected static LoaderRepository instance = null;
+   protected static LoaderRepositoryDomain instance = null;
    protected Translator translator = null;
 
    /** The loaded classes cache, HashMap<String, Class>.
@@ -61,7 +62,7 @@
    private static HashMap nativeClassBySignature;
 
    // Static --------------------------------------------------------
-   private static final Logger log = Logger.getLogger(LoaderRepository.class);
+   private static final Logger log = Logger.getLogger(LoaderRepositoryDomain.class);
 
    /**
     * Construct the native class map
@@ -121,15 +122,15 @@
     * @param lr the loader repository
     * @return -1, 0, 1 depending upon the order
     */
-   public int compare(LoaderRepository lr)
+   public int compare(LoaderRepositoryDomain lr)
    {
       if (lr == this)
          return 0;
       else
-         return -lr.reverseCompare(this);
+         return 1;
    }
    
-   // BEGIN ClassLoaderRepository **************************************************************************************
+   // BEGIN ClassLoadingDomain **************************************************************************************
 
    /**
     * Loads a class from the repository. This method attempts to load the class
@@ -140,45 +141,38 @@
     * @exception ClassNotFoundException when there is no such class
     */
    public abstract Class loadClass(String className) throws ClassNotFoundException;
-
    /**
-    * Loads a class from the repository, excluding the given
-    * classloader.
-    *
-    * @param loader the classloader to exclude
-    * @param className the class to load
-    * @return the found class
-    * @exception ClassNotFoundException when there is no such class
+    * Load a class from this domain
+    * 
+    * @param name the class to load
+    * @param resolve whether to resolve the class
+    * @param classLoader the requesting classloader
+    * @return the class
+    * @throws ClassNotFoundException when the class is not found
     */
-   public abstract Class loadClassWithout(ClassLoader loader, String className) throws ClassNotFoundException;
-
+   public abstract Class loadClass(String name, boolean resolve, DomainClassLoader classLoader) throws ClassNotFoundException;
+   
    /**
-    * Loads a class from the repository, using the classloaders that were
-    * registered before the given classloader.
-    *
-    * @param   stop      consult all the classloaders registered before this one
-    *                    in an attempt to load a class
-    * @param   className name of the class to load
-    *
-    * @return  loaded class instance
-    *
-    * @throws ClassNotFoundException if none of the consulted classloaders were
-    *         able to load the requested class
+    * Get a resource
+    * 
+    * @param name the resource name
+    * @param classLoader the requesting classloader
+    * @return the resource or null if not found
     */
-   public abstract Class loadClassBefore(ClassLoader stop, String className) throws ClassNotFoundException;
+   public abstract URL loadResource(String name, DomainClassLoader classLoader);
 
-   // END ClassLoaderRepository ****************************************************************************************
+   // END ClassLoadingDomain ****************************************************************************************
 
-   /** Create RepositoryClassLoader and optionally add it to the repository
+   /** Create DomainClassLoader and optionally add it to the repository
     * @param url the URL to use for class loading
     * @param addToRepository a flag indicating if the CL should be added to
     *    the repository
     * @return the UCL instance
     * @throws Exception
     */
-   public abstract RepositoryClassLoader newClassLoader(final URL url, boolean addToRepository)
+   public abstract DomainClassLoader newClassLoader(final URL url, boolean addToRepository)
       throws Exception;
-   /** Create RepositoryClassLoader and optionally add it to the repository
+   /** Create DomainClassLoader and optionally add it to the repository
     * @param url the URL to use for class loading
     * @param origURL an orignal URL to use as the URL for the CL CodeSource.
     * This is useful when the url is a local copy that is difficult to use for
@@ -188,20 +182,10 @@
     * @return the CL instance
     * @throws Exception
     */
-   public abstract RepositoryClassLoader newClassLoader(final URL url, final URL origURL,
+   public abstract DomainClassLoader newClassLoader(final URL url, final URL origURL,
       boolean addToRepository)
       throws Exception;
 
-   /** Load the given class from the repository
-    * @param name
-    * @param resolve
-    * @param cl
-    * @return
-    * @throws ClassNotFoundException
-    */
-   public abstract Class loadClass(String name, boolean resolve, ClassLoader cl)
-      throws ClassNotFoundException;
-
    /** Find a resource URL for the given name
     *
     * @param name the resource name
@@ -250,7 +234,7 @@
     * @param lr the loader repository
     * @return -1, 0, 1 depending upon the order
     */
-   protected int reverseCompare(LoaderRepository lr)
+   protected int reverseCompare(LoaderRepositoryDomain lr)
    {
       return 0;
    }




More information about the jboss-cvs-commits mailing list