tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup Bootstrap.java ClassLoaderFactory.java
Date Mon, 02 Dec 2002 10:38:12 GMT
remm        2002/12/02 02:38:11

  Modified:    catalina/src/share/org/apache/catalina/startup
                        Bootstrap.java ClassLoaderFactory.java
  Log:
  - Add the possibility to specify remote codebases.
  
  Revision  Changes    Path
  1.8       +15 -5     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
  
  Index: Bootstrap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Bootstrap.java	26 Oct 2002 12:29:56 -0000	1.7
  +++ Bootstrap.java	2 Dec 2002 10:38:11 -0000	1.8
  @@ -97,6 +97,7 @@
   
   
       protected static final String CATALINA_TOKEN = "${catalina.home}";
  +    protected static final String HTTP_TOKEN = "http://";
   
   
       // ------------------------------------------------------- Static Variables
  @@ -153,10 +154,17 @@
   
           ArrayList unpackedList = new ArrayList();
           ArrayList packedList = new ArrayList();
  +        ArrayList urlList = new ArrayList();
   
           StringTokenizer tokenizer = new StringTokenizer(value, ",");
           while (tokenizer.hasMoreElements()) {
               String repository = tokenizer.nextToken();
  +            // Check for a remote repository
  +            if (repository.startsWith(HTTP_TOKEN)) {
  +                urlList.add(new URL(repository));
  +                continue;
  +            }
  +            // Local repository
               boolean packed = false;
               if (repository.startsWith(CATALINA_TOKEN)) {
                   repository = getCatalinaHome() 
  @@ -176,8 +184,10 @@
   
           File[] unpacked = (File[]) unpackedList.toArray(new File[0]);
           File[] packed = (File[]) packedList.toArray(new File[0]);
  +        URL[] urls = (URL[]) urlList.toArray(new URL[0]);
   
  -        return ClassLoaderFactory.createClassLoader(unpacked, packed, parent);
  +        return ClassLoaderFactory.createClassLoader
  +            (unpacked, packed, urls, parent);
   
       }
   
  
  
  
  1.3       +39 -4     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ClassLoaderFactory.java
  
  Index: ClassLoaderFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ClassLoaderFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassLoaderFactory.java	24 Oct 2002 13:53:22 -0000	1.2
  +++ ClassLoaderFactory.java	2 Dec 2002 10:38:11 -0000	1.3
  @@ -152,6 +152,34 @@
                                                   File packed[],
                                                   ClassLoader parent)
           throws Exception {
  +        return createClassLoader(unpacked, packed, null, parent);
  +    }
  +
  +
  +    /**
  +     * Create and return a new class loader, based on the configuration
  +     * defaults and the specified directory paths:
  +     *
  +     * @param unpacked Array of pathnames to unpacked directories that should
  +     *  be added to the repositories of the class loader, or <code>null</code>

  +     * for no unpacked directories to be considered
  +     * @param packed Array of pathnames to directories containing JAR files
  +     *  that should be added to the repositories of the class loader, 
  +     * or <code>null</code> for no directories of JAR files to be considered
  +     * @param urls Array of URLs to remote repositories, designing either JAR 
  +     *  resources or uncompressed directories that should be added to 
  +     *  the repositories of the class loader, or <code>null</code> for no 
  +     *  directories of JAR files to be considered
  +     * @param parent Parent class loader for the new class loader, or
  +     *  <code>null</code> for the system class loader.
  +     *
  +     * @exception Exception if an error occurs constructing the class loader
  +     */
  +    public static ClassLoader createClassLoader(File unpacked[],
  +                                                File packed[],
  +                                                URL urls[],
  +                                                ClassLoader parent)
  +        throws Exception {
   
           if (debug >= 1)
               log("Creating new class loader");
  @@ -193,6 +221,13 @@
                                         file.getCanonicalPath());
                       list.add(url.toString());
                   }
  +            }
  +        }
  +
  +        // Add remote URLs
  +        if (urls != null) {
  +            for (int i = 0; i < urls.length; i++) {
  +                list.add(urls[i].toString());
               }
           }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message