You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rs...@apache.org on 2002/06/30 02:50:42 UTC

cvs commit: jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery SPIContext.java ClassLoaderUtils.java ClassFinder.java ServiceFinder.java

rsitze      2002/06/29 17:50:42

  Modified:    discovery/src/java/org/apache/commons/service/discovery
                        SPIContext.java ClassLoaderUtils.java
                        ClassFinder.java ServiceFinder.java
  Log:
  Improved logic for finding properties file.  Look for by literal name
  (presumably in the form 'file.property') using all class loaders.
  Failing that, if name was relative (no leading '/') then prepent
  package name of the SPI class (/spi/class/package/file.property)
  and retry class loaders.
  
  Other minor cleanup & refactoring
  
  Revision  Changes    Path
  1.3       +13 -0     jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/SPIContext.java
  
  Index: SPIContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/SPIContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SPIContext.java	28 Jun 2002 21:28:12 -0000	1.2
  +++ SPIContext.java	30 Jun 2002 00:50:42 -0000	1.3
  @@ -93,6 +93,11 @@
           findSystemClassLoader();
   
       /**
  +     * List of class loaders
  +     */
  +    private final ClassLoader[] loaders;
  +
  +    /**
        * The service programming interface: intended to be
        * an interface or abstract class, but not limited
        * to those two.
  @@ -101,6 +106,10 @@
   
       public SPIContext(Class spi) {
           this.spi = spi;
  +        this.loaders = ClassLoaderUtils.compactUniq(
  +            new ClassLoader[] { threadContextClassLoader,
  +                           spi.getClassLoader(),
  +                           systemClassLoader });
       }
       
       public ClassLoader getThreadContextClassLoader() {
  @@ -109,6 +118,10 @@
       
       public ClassLoader getSystemClassLoader() {
           return systemClassLoader;
  +    }
  +    
  +    public ClassLoader[] getClassLoaders() {
  +        return loaders;
       }
       
       public Class getSPI() {
  
  
  
  1.2       +180 -83   jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/ClassLoaderUtils.java
  
  Index: ClassLoaderUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/ClassLoaderUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClassLoaderUtils.java	28 Jun 2002 21:28:12 -0000	1.1
  +++ ClassLoaderUtils.java	30 Jun 2002 00:50:42 -0000	1.2
  @@ -83,15 +83,15 @@
       private static final boolean debug = false;
       
       /**
  -     * Load the class serviceImplName, no safety checking
  +     * Load the class <code>serviceImplName</code>, no safety checking
        * 
        * @param serviceImplName The name of the class to load.
        */
  -    private static Class rawLoad(String serviceImplName, ClassLoader loader)
  +    private static Class rawLoadClass(String serviceImplName, ClassLoader loader)
           throws ServiceException
       {
           Class clazz = null;
  -
  +        
           try {
               // first the thread class loader
               clazz = loader.loadClass(serviceImplName);
  @@ -103,111 +103,216 @@
       }
       
       /**
  -     * Load the class serviceImplName.
  +     * Load the class <code>serviceImplName</code>.
  +     * Try each classloader in succession,
  +     * until first succeeds, or all fail.
        * 
        * @param serviceImplName The name of the class to load.
        */
  -    public static Class load(String serviceImplName, ClassLoader loader)
  +    public static Class loadClass(String serviceImplName,
  +                                  ClassLoader[] loaders,
  +                                  int length)
           throws ServiceException
       {
  -        if (debug)
  -            System.out.println("Loading '" + serviceImplName + "'");
  +        Class clazz = null;
  +        
  +        if (serviceImplName != null  &&  serviceImplName.length() > 0) {
  +            if (debug)
  +                System.out.println("Loading class '" + serviceImplName + "'");
   
  -        return (loader != null  &&
  -                serviceImplName != null  &&
  -                serviceImplName.length() > 0
  -                )
  -                ? rawLoad(serviceImplName, loader)
  -                : null;
  +            for (int i = 0; i < length && clazz == null; i++)
  +            {
  +                if (loaders[i] != null)
  +                    clazz = rawLoadClass(serviceImplName, loaders[i]);
  +            }
  +        }
  +        
  +        return clazz;
       }
  -    
  -    
  +
       /**
  -     * Load the class serviceImplName.
  +     * Load the class <code>serviceImplName</code>.
        * Try each classloader in succession,
        * until first succeeds, or all fail.
        * 
        * @param serviceImplName The name of the class to load.
        */
  -    public static Class loadUniq(String serviceImplName, ClassLoader[] uniqLoaders, int length)
  +    public static Class loadClass(String serviceImplName, ClassLoader[] loaders)
  +        throws ServiceException
  +    {
  +        return loadClass(serviceImplName, loaders, loaders.length);
  +    }
  +    
  +    /**
  +     * Load the class <code>serviceImplName</code> using the
  +     * class loaders associated with the SPI's context.
  +     * 
  +     * @param serviceImplName The name of the class to load.
  +     */
  +    public static Class loadClass(String serviceImplName, SPIContext spiContext)
           throws ServiceException
       {
  -        if (debug)
  -            System.out.println("Loading '" + serviceImplName + "'");
  +        return loadClass(serviceImplName, spiContext.getClassLoaders());
  +    }
   
  -        Class clazz = null;
  +
  +    /**
  +     * Load the resource <code>resourceName</code>.
  +     * Try each classloader in succession,
  +     * until first succeeds, or all fail.
  +     * 
  +     * @param resourceName The name of the resource to load.
  +     */
  +    public static InputStream getResourceAsStream(String resourceName,
  +                                                  ClassLoader[] loaders,
  +                                                  int length)
  +        throws ServiceException
  +    {
  +        InputStream stream = null;
           
  -        if (serviceImplName != null  &&  serviceImplName.length() > 0) {
  -            for (int i = 0; i < length && clazz == null; i++)
  +        if (resourceName != null  &&  resourceName.length() > 0) {
  +            if (debug)
  +                System.out.println("Loading resource '" + resourceName + "'");
  +
  +            for (int i = 0; i < length && stream == null; i++)
               {
  -                clazz = (uniqLoaders[i] != null)
  -                        ? rawLoad(serviceImplName, uniqLoaders[i])
  -                        : null;
  +                if (loaders[i] != null)
  +                    stream = loaders[i].getResourceAsStream(resourceName);
               }
           }
           
  -        return clazz;
  +        return stream;
       }
   
       /**
  -     * Load the class serviceImplName.
  +     * Load the resource <code>resourceName</code>.
        * Try each classloader in succession,
        * until first succeeds, or all fail.
        * 
  -     * @param serviceImplName The name of the class to load.
  +     * @param resourceName The name of the resource to load.
        */
  -    public static Class loadUniq(String serviceImplName, ClassLoader[] uniqLoaders)
  +    public static InputStream getResourceAsStream(String resourceName, ClassLoader[] loaders)
           throws ServiceException
       {
  -        return loadUniq(serviceImplName, uniqLoaders, uniqLoaders.length);
  +        return getResourceAsStream(resourceName, loaders, loaders.length);
       }
       
       /**
  -     * Load the class serviceImplName.
  +     * Load the resource resourceName using the
  +     * class loaders associated with the SPI's context.
  +     * 
  +     * @param resourceName The name of the resource to load.
  +     */
  +    public static InputStream getResourceAsStream(String resourceName, SPIContext spiContext)
  +        throws ServiceException
  +    {
  +        return getResourceAsStream(resourceName, spiContext.getClassLoaders());
  +    }
  +
  +    /**
  +     * Load the resource <code>resourceName</code>.
        * Try each classloader in succession,
        * until first succeeds, or all fail.
  +     * If all fail and <code>resouceName</code> is not absolute
  +     * (doesn't start with '/' character), then retry with
  +     * <code>packageName/resourceName</code> after changing all
  +     * '.' to '/'.
        * 
  -     * @param serviceImplName The name of the class to load.
  +     * @param resourceName The name of the resource to load.
        */
  -    public static Class load(String serviceImplName, ClassLoader[] loaders)
  +    public static InputStream getResourceAsStream(String packageName,
  +                                                  String resourceName,
  +                                                  ClassLoader[] loaders,
  +                                                  int length)
           throws ServiceException
       {
  -        ClassLoader[] uniqLoaders = new ClassLoader[loaders.length];
  -        int length = uniq(loaders, uniqLoaders);
  +        InputStream stream = getResourceAsStream(resourceName, loaders, length);
           
  -        return loadUniq(serviceImplName, uniqLoaders, length);
  +        /**
  +         * If we didn't find the resource, and if the resourceName
  +         * isn't an 'absolute' path name, then qualify with
  +         * package name of the spi.
  +         */
  +        return (stream == null)
  +               ? getResourceAsStream(qualifyName(packageName, resourceName),
  +                                     loaders, length)
  +               : stream;
       }
   
       /**
  -     * Load the class serviceImplName.
  +     * Load the resource <code>resourceName</code>.
  +     * Try each classloader in succession,
  +     * until first succeeds, or all fail.
  +     * If all fail and <code>resouceName</code> is not absolute
  +     * (doesn't start with '/' character), then retry with
  +     * <code>packageName/resourceName</code> after changing all
  +     * '.' to '/'.
        * 
  -     * @param serviceImplName The name of the class to load.
  +     * @param resourceName The name of the resource to load.
        */
  -    public static Class load(String serviceImplName,
  -                             ClassLoader loaderA,
  -                             ClassLoader loaderB)
  +    public static InputStream getResourceAsStream(String packageName,
  +                                                  String resourceName,
  +                                                  ClassLoader[] loaders)
           throws ServiceException
       {
  -        return load(serviceImplName,
  -                    new ClassLoader[] { loaderA, loaderB });
  +        return getResourceAsStream(packageName, resourceName, loaders, loaders.length);
       }
  -
  +    
       /**
  -     * Load the class serviceImplName.
  -     * First try to load the class with the SPI context's
  -     * thread context class loader, and failing that try
  -     * the class loader that loaded the SPI.
  +     * Load the resource resourceName using the
  +     * class loaders associated with the SPI's context.
  +     * If all fail and <code>resouceName</code> is not absolute
  +     * (doesn't start with '/' character), then retry with
  +     * <code>packageName/resourceName</code> after changing all
  +     * '.' to '/'.
        * 
  -     * @param serviceImplName The name of the class to load.
  +     * @param resourceName The name of the resource to load.
        */
  -    public static Class load(String serviceImplName, SPIContext spiContext)
  +    public static InputStream getResourceAsStream(String packageName,
  +                                                  String resourceName,
  +                                                  SPIContext spiContext)
           throws ServiceException
       {
  -        return load(serviceImplName,
  -                    spiContext.getThreadContextClassLoader(),
  -                    spiContext.getSPI().getClassLoader());
  +        return getResourceAsStream(packageName, resourceName, spiContext.getClassLoaders());
       }
  +
       
  +    /**
  +     * Would <code>thisClassLoader</code> use <code>classLoader</code>?
  +     * Return <code>true</code> if <code>classLoader</code> is the same
  +     * as </code>thisClassLoader</code> or if <code>classLoader</code>
  +     * is an ancestor of </code>thisClassLoader</code>.
  +     */
  +    public static final boolean wouldUseClassLoader(ClassLoader thisClassLoader,
  +                                                    ClassLoader classLoader) {
  +        if (classLoader == null)
  +            return true;
  +            
  +        while (thisClassLoader != null) {
  +            if (thisClassLoader == classLoader) {
  +                return true;
  +            }
  +            thisClassLoader = thisClassLoader.getParent();
  +        }
  +        return false;
  +    }
  +
  +    /**
  +     * Return <code>true</code> if
  +     * <code>wouldUseClassLoader(list[idx], classLoader)<code>
  +     * is <code>true<code> for all <code>idx</code>
  +     * such that <code>0 <= idx < length</code>.
  +     */
  +    public static final boolean wouldUseClassLoader(ClassLoader[] list,
  +                                                    int length,
  +                                                    ClassLoader classLoader) {
  +        for (int idx = 0; idx < length; idx++) {
  +            if (wouldUseClassLoader(list[idx], classLoader))
  +                return true;
  +        }
  +        return false;
  +    }
  +
       /***
        * Remove duplicate Objects (as opposed to equivalent) from
        * array.  Also checks previous class loader parents..
  @@ -222,42 +327,34 @@
           for (int lookForward = 0; lookForward < array.length; lookForward++) {
               ClassLoader fore = array[lookForward];
               
  -            if (fore != null) {
  -                boolean seen = false;
  -                
  -                for (int lookBack = 0; !seen && lookBack < len; lookBack++) {
  -                    ClassLoader back = uneek[lookBack];
  -                    
  -                    /**
  -                     * Look to see if the current ClassLoader (fore)
  -                     * is already in the list.  Also review parent
  -                     * class loaders of those already in the list.
  -                     */
  -                    while (!seen  &&  back != null) {
  -                        if (back == fore) {
  -                            seen = true;
  -                        }
  -                        back = back.getParent();
  -                    }
  -                }
  -                
  -                if (!seen) {
  -                    uneek[len++] = fore;
  -                }
  +            if (fore != null  &&  !wouldUseClassLoader(uneek, len, fore)) {
  +                uneek[len++] = fore;
               }
           }
           return len;
       }
   
  +    public static final ClassLoader[] copy(ClassLoader[] src, int first, int lastPlus) {
  +        int length = lastPlus - first;
  +        ClassLoader[] dest = new ClassLoader[length];
  +        System.arraycopy(src, first, dest, 0, length);
  +        return dest;
  +    }
  +
       public static final ClassLoader[] compactUniq(ClassLoader[] array) {        
           ClassLoader[] uniqLoaders = new ClassLoader[array.length];
  -        
  -        int length = ClassLoaderUtils.uniq(array, uniqLoaders);
  -        
  -        ClassLoader[] loaders = new ClassLoader[length];
  -        
  -        System.arraycopy(uniqLoaders, 0, loaders, 0, length);
  -        
  -        return loaders;
  +        int length = uniq(array, uniqLoaders);
  +        return copy(uniqLoaders, 0, length);
  +    }
  +    
  +    /**
  +     * If <code>name</code> represents an absolute path name, then return null.
  +     * Otherwise, prepend packageName to name, convert all '.' to '/', and
  +     * return results.
  +     */
  +    private static final String qualifyName(String packageName, String name) {
  +        return (name.charAt(0)=='/')
  +               ? null
  +               : packageName.replace('.','/') + "/" + name;
       }
   }
  
  
  
  1.3       +63 -30    jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/ClassFinder.java
  
  Index: ClassFinder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/ClassFinder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassFinder.java	28 Jun 2002 21:28:12 -0000	1.2
  +++ ClassFinder.java	30 Jun 2002 00:50:42 -0000	1.3
  @@ -90,33 +90,37 @@
        * looking for an implementation of.
        */
       private final SPIContext spiContext;
  -    private final Class      finderClass;
  +    private final Class      rootFinderClass;
       
       private final ClassLoader[] localLoaders;
       private final ClassLoader[] allLoaders;
   
  -    public ClassFinder(SPIContext spiContext, Class finderClass) {
  +    public ClassFinder(SPIContext spiContext, Class rootFinderClass) {
           this.spiContext = spiContext;
  -        this.finderClass = finderClass;
  -        this.localLoaders = getLocalLoaders(spiContext, finderClass);
  -        this.allLoaders = getAllLoaders(spiContext, finderClass);
  +        this.rootFinderClass = rootFinderClass;
  +        this.localLoaders = getLocalLoaders(spiContext, rootFinderClass);
  +        this.allLoaders = getAllLoaders(spiContext, rootFinderClass);
   
           //System.out.println("Finding '" + spiContext.getSPI().getName() + "'");
       }
       
  -    public ClassFinder(Class spi, Class finderClass) {
  +    public ClassFinder(Class spi, Class rootFinderClass) {
           this.spiContext = new SPIContext(spi);
  -        this.finderClass = finderClass;
  -        this.localLoaders = getLocalLoaders(spiContext, finderClass);
  -        this.allLoaders = getAllLoaders(spiContext, finderClass);
  +        this.rootFinderClass = rootFinderClass;
  +        this.localLoaders = getLocalLoaders(spiContext, rootFinderClass);
  +        this.allLoaders = getAllLoaders(spiContext, rootFinderClass);
   
           //System.out.println("Finding '" + spi.getName() + "'");
       }
       
       /**
  -     * Return a new instance of the specified <code>serviceImplName</code>
  -     * implementation class, loaded by the context class loader.
  -     * If that fails, try the spi's class loader.
  +     * Return the specified <code>serviceImplName</code> implementation
  +     * class.  If <code>localOnly</code> is <code>true</code>, try the
  +     * class loaders local to the caller: root finder class's (default
  +     * ServiceFinder) and system.  If <code>localOnly</code> is
  +     * <code>false</code>, try each of the following class loaders:
  +     * thread context, caller's, spi's, root finder class's (default
  +     * ServiceFinder), and system.
        *
        * @param serviceImplName Fully qualified name of the implementation class
        * @param localOnly Use only local class loader
  @@ -126,10 +130,10 @@
        *                             or if the class created is not an instance
        *                             of <code>spi</code>
        */
  -    public Class find(String serviceImplName, boolean localOnly)
  +    public Class findClass(String serviceImplName, boolean localOnly)
           throws ServiceException
       {
  -        Class clazz = ClassLoaderUtils.loadUniq(serviceImplName,
  +        Class clazz = ClassLoaderUtils.loadClass(serviceImplName,
                              localOnly ? localLoaders : allLoaders);
               
           if (clazz != null  &&  !spiContext.getSPI().isAssignableFrom(clazz)) {
  @@ -141,27 +145,50 @@
       }
       
       /**
  +     * Return the specified <code>resourceName</code> as an
  +     * <code>InputStream</code>.  If <code>localOnly</code> is
  +     * <code>true</code>, try the class loaders local to the caller:
  +     * root finder class's (default ServiceFinder) and system.
  +     * If <code>localOnly</code> is <code>false</code>, try each of
  +     * the following class loaders: thread context, caller's, spi's,
  +     * root finder class's (default ServiceFinder), and system.
  +     *
  +     * @param resourceName name of the resource
  +     * @param localOnly Use only local class loader
  +     *                  (do not try thread context class loader).
  +     *
  +     * @exception ServiceException if a suitable resource cannot be created.
  +     */
  +    public InputStream findResourceAsStream(String resourceName, boolean localOnly)
  +        throws ServiceException
  +    {
  +        return ClassLoaderUtils.getResourceAsStream(spiContext.getSPI().getPackage().getName(),
  +                                                    resourceName,
  +                                                    localOnly ? localLoaders : allLoaders);
  +    }
  +    
  +    /**
        * Load the class whose name is given by the value of a System Property.
        * 
        * @param attribute the name of the system property whose value is
        *        the name of the class to load.
        */
  -    public Class systemFind(String attribute) {
  +    public Class systemFindClass(String attribute) {
           String value;
           try {
               value = System.getProperty(attribute);
           } catch (SecurityException e) {
               value = null;
           }
  -        return find(value, false);
  +        return findClass(value, false);
       }
   
       /**
        * Load the class whose name is given by the value of a System Property,
        * whose name is the fully qualified name of the SPI class.
        */
  -    public Class systemFind() {
  -        return systemFind(spiContext.getSPI().getName());
  +    public Class systemFindClass() {
  +        return systemFindClass(spiContext.getSPI().getName());
       }
   
       /**
  @@ -171,8 +198,8 @@
        * @param attribute the name of the property whose value is
        *        the name of the class to load.
        */
  -    public Class find(Properties properties, String attribute) {
  -        return find(properties.getProperty(attribute), false);
  +    public Class findClass(Properties properties, String attribute) {
  +        return findClass(properties.getProperty(attribute), false);
       }
   
       /**
  @@ -181,8 +208,8 @@
        * 
        * @param properties the properties set.
        */
  -    public Class find(Properties properties) {
  -        return find(properties, spiContext.getSPI().getName());
  +    public Class findClass(Properties properties) {
  +        return findClass(properties, spiContext.getSPI().getName());
       }
   
       /**
  @@ -192,8 +219,8 @@
        * placing it in the META-INF/services directory of the webapp
        * (or in CLASSPATH or equivalent).
        */
  -    public Class jdk13Find() {
  -        return find(getJDKImplClassName(), false);
  +    public Class jdk13FindClass() {
  +        return findClass(getJDKImplClassName(), false);
       }
   
       /**
  @@ -249,25 +276,31 @@
        * and getting to it in a J2EE environment is likely to be beyond
        * hopeless....
        */
  -    private static final ClassLoader getCallerClassLoader(Class finderClass) {
  +    private static final ClassLoader getCallerClassLoader(Class rootFinderClass) {
           return null;
       }
   
  +    /**
  +     * List of 'local' classes and class loaders.
  +     * By using ClassLoaderHolder to holder Class and ClassLoader objects,
  +     * we preserve the difference in behaviour between the two for loading
  +     * resources..
  +     */
       private static final ClassLoader[] getLocalLoaders(SPIContext spiContext,
  -                                                       Class finderClass) {
  +                                                       Class rootFinderClass) {
           return ClassLoaderUtils.compactUniq(new ClassLoader[] {    
  -                                finderClass.getClassLoader(),
  +                                rootFinderClass.getClassLoader(),
                                   spiContext.getSystemClassLoader()
                             });
       }
       
       private static final ClassLoader[] getAllLoaders(SPIContext spiContext,
  -                                                     Class finderClass) {
  +                                                     Class rootFinderClass) {
           return ClassLoaderUtils.compactUniq(new ClassLoader[] {    
                                   spiContext.getThreadContextClassLoader(),
  -                                getCallerClassLoader(finderClass),
  +                                getCallerClassLoader(rootFinderClass),
                                   spiContext.getSPI().getClassLoader(),
  -                                finderClass.getClassLoader(),
  +                                rootFinderClass.getClassLoader(),
                                   spiContext.getSystemClassLoader()
                               });
       }
  
  
  
  1.3       +23 -23    jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/ServiceFinder.java
  
  Index: ServiceFinder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/discovery/src/java/org/apache/commons/service/discovery/ServiceFinder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServiceFinder.java	28 Jun 2002 21:28:12 -0000	1.2
  +++ ServiceFinder.java	30 Jun 2002 00:50:42 -0000	1.3
  @@ -130,7 +130,7 @@
        * <li>System Class Loader</li>
        * </ul>
        * 
  -     * @param finderClass  The root finder class, which may not
  +     * @param rootFinderClass  The root finder class, which may not
        *        be 'ServiceFinder' if a wrapper class is used.
        * 
        * @param spiContext The SPI Context identifies the SPI and the
  @@ -154,7 +154,7 @@
        *            cannot be instantiated,
        *            or is not an instance of <code>spi</code>.
        */
  -    public static Object find(Class finderClass,
  +    public static Object find(Class rootFinderClass,
                                 SPIContext spiContext,
                                 Properties properties,
                                 String defaultImplName)
  @@ -162,7 +162,7 @@
       {
           // thread context can change on each call,
           // so establish context for this one call.
  -        ClassFinder classFinder = new ClassFinder(spiContext, finderClass);
  +        ClassFinder classFinder = new ClassFinder(spiContext, rootFinderClass);
   
           /**
            * Return previously registered service object (not class)
  @@ -180,21 +180,21 @@
           
           if (service == null) {
               // First, try the system property
  -            Class clazz = classFinder.systemFind();
  +            Class clazz = classFinder.systemFindClass();
       
               if (clazz == null) {
                   // Second, try the properties parameter
                   if (properties != null)
  -                    clazz = classFinder.find(properties);
  +                    clazz = classFinder.findClass(properties);
               
                   if (clazz == null) {
                       // Third, try to find a service by using the JDK1.3 jar
                       // discovery mechanism.
  -                    clazz = classFinder.jdk13Find();
  +                    clazz = classFinder.jdk13FindClass();
                   
                       if (clazz == null) {
                           // Fourth, try the fallback implementation class
  -                        clazz = classFinder.find(defaultImplName, true);
  +                        clazz = classFinder.findClass(defaultImplName, true);
                           
                           if (clazz == null) {
                               throw new ServiceException
  @@ -238,13 +238,13 @@
        * Equivalent to
        * <code>find(new SPIContext(spi), properties, defaultImplName)</code>.
        */
  -    public static Object find(Class finderClass,
  +    public static Object find(Class rootFinderClass,
                                 Class spi,
                                 Properties properties,
                                 String defaultImplName)
           throws ServiceException
       {
  -        return find(finderClass, new SPIContext(spi), properties, defaultImplName);
  +        return find(rootFinderClass, new SPIContext(spi), properties, defaultImplName);
       }
   
       /**
  @@ -263,7 +263,7 @@
        * Load properties file, and call
        * <code>find(spiContext, properties, defaultImplName)</code>.
        */    
  -    public static Object find(Class finderClass,
  +    public static Object find(Class rootFinderClass,
                                 SPIContext spiContext,
                                 String propertiesFileName,
                                 String defaultImplName)
  @@ -289,7 +289,7 @@
               }
           }
           
  -        return find(finderClass, spiContext, properties, defaultImplName);
  +        return find(rootFinderClass, spiContext, properties, defaultImplName);
       }
   
       /**
  @@ -306,15 +306,15 @@
       
       /**
        * Equivalent to
  -     * <code>find(finderClass, new SPIContext(spi), propertiesFileName, defaultImplName)</code>.
  +     * <code>find(rootFinderClass, new SPIContext(spi), propertiesFileName, defaultImplName)</code>.
        */    
  -    public static Object find(Class finderClass,
  +    public static Object find(Class rootFinderClass,
                                 Class spi,
                                 String propertiesFileName,
                                 String defaultImplName)
           throws ServiceException
       {
  -        return find(finderClass, new SPIContext(spi), propertiesFileName, defaultImplName);
  +        return find(rootFinderClass, new SPIContext(spi), propertiesFileName, defaultImplName);
       }
       
       /**
  @@ -331,12 +331,12 @@
   
       /**
        * Find implementation of SPI.
  -     * Equivalent to find(finderClass, spi, (Properties)null, defaultImplName);
  +     * Equivalent to find(rootFinderClass, spi, (Properties)null, defaultImplName);
        */
  -    public static Object find(Class finderClass, Class spi, String defaultImplName)
  +    public static Object find(Class rootFinderClass, Class spi, String defaultImplName)
           throws ServiceException
       {
  -        return find(finderClass, spi, (Properties)null, defaultImplName);
  +        return find(rootFinderClass, spi, (Properties)null, defaultImplName);
       }
   
       /**
  @@ -351,12 +351,12 @@
   
       /**
        * Find implementation of SPI.
  -     * Equivalent to find(finderClass, spi, properties, null);
  +     * Equivalent to find(rootFinderClass, spi, properties, null);
        */
  -    public static Object find(Class finderClass, Class spi, Properties properties)
  +    public static Object find(Class rootFinderClass, Class spi, Properties properties)
           throws ServiceException
       {
  -        return find(finderClass, spi, properties, null);
  +        return find(rootFinderClass, spi, properties, null);
       }
   
       /**
  @@ -371,12 +371,12 @@
   
       /**
        * Find implementation of SPI.
  -     * Equivalent to find(finderClass, spi, (Properties)null, null);
  +     * Equivalent to find(rootFinderClass, spi, (Properties)null, null);
        */
  -    public static Object find(Class finderClass, Class spi)
  +    public static Object find(Class rootFinderClass, Class spi)
           throws ServiceException
       {
  -        return find(finderClass, spi, (Properties)null, null);
  +        return find(rootFinderClass, spi, (Properties)null, null);
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>