cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/servlet ParanoidClassLoader.java
Date Wed, 23 May 2001 16:29:14 GMT
bloritsch    01/05/23 09:29:14

  Modified:    src/org/apache/cocoon/servlet ParanoidClassLoader.java
  Log:
  Add ability to add new files (like RepositoryClassLoader)
  
  Revision  Changes    Path
  1.2       +24 -1     xml-cocoon2/src/org/apache/cocoon/servlet/ParanoidClassLoader.java
  
  Index: ParanoidClassLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/ParanoidClassLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParanoidClassLoader.java	2001/05/23 14:05:01	1.1
  +++ ParanoidClassLoader.java	2001/05/23 16:29:08	1.2
  @@ -7,6 +7,10 @@
    *****************************************************************************/
   package org.apache.cocoon.servlet;
   
  +import java.io.IOException;
  +import java.io.File;
  +
  +import java.net.MalformedURLException;
   import java.net.URL;
   import java.net.URLClassLoader;
   import java.net.URLStreamHandlerFactory;
  @@ -16,7 +20,7 @@
    * classes.  It checks this classloader before it checks its parent.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/05/23 14:05:01 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/05/23 16:29:08 $
    */
   
   public class ParanoidClassLoader extends URLClassLoader {
  @@ -86,6 +90,9 @@
        * note that this is the exact opposite of the
        * <code>ClassLoader</code> spec.  We use it to work around
        * inconsistent class loaders from third party vendors.
  +     *
  +     * @param name of class
  +     * @throws ClassNotFoundException
        */
       public final Class loadClass(final String name) throws ClassNotFoundException {
           Class resource = null;
  @@ -104,11 +111,27 @@
       }
   
       /**
  +     * Adds a new directory of class files.
  +     *
  +     * @param file for jar or directory
  +     * @throws IOException
  +     */
  +    public final void addDirectory(File file) throws IOException {
  +        try {
  +            this.addURL(file.getCanonicalFile().toURL());
  +        } catch (MalformedURLException mue) {
  +            throw new IOException("Could not add repository");
  +        }
  +    }
  +
  +    /**
        * Gets a resource from this <code>ClassLoader</class>.  If the
        * resource does not exist in this one, we check the parent.
        * Please note that this is the exact opposite of the
        * <code>ClassLoader</code> spec.  We use it to work around
        * inconsistent class loaders from third party vendors.
  +     *
  +     * @param name of resource
        */
       public final URL getResource(final String name) {
           URL resource = super.getResource(name);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message