tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup ContextConfig.java
Date Sun, 01 Oct 2000 03:07:05 GMT
craigmcc    00/09/30 20:07:05

  Modified:    catalina/src/share/org/apache/catalina/loader
                        StandardLoader.java
               catalina/src/share/org/apache/catalina/startup
                        ContextConfig.java
  Log:
  Enforce the checking for required optional packages, as expressed in the
  manifest entries of JAR files in the WEB-INF/lib directory for each web
  application.
  
  Revision  Changes    Path
  1.8       +4 -11     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java
  
  Index: StandardLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardLoader.java	2000/09/30 19:15:46	1.7
  +++ StandardLoader.java	2000/10/01 03:07:03	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
1.7 2000/09/30 19:15:46 craigmcc Exp $
  - * $Revision: 1.7 $
  - * $Date: 2000/09/30 19:15:46 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
1.8 2000/10/01 03:07:03 craigmcc Exp $
  + * $Revision: 1.8 $
  + * $Date: 2000/10/01 03:07:03 $
    *
    * ====================================================================
    *
  @@ -99,7 +99,7 @@
    * is not present, the system class loader will be used instead.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.7 $ $Date: 2000/09/30 19:15:46 $
  + * @version $Revision: 1.8 $ $Date: 2000/10/01 03:07:03 $
    */
   
   public final class StandardLoader
  @@ -539,15 +539,9 @@
   
   	// Construct a class loader based on our current repositories list
   	try {
  -            /*
  -	    Class clazz = Class.forName(loaderClass);
  -	    classLoader = (Reloader) clazz.newInstance();
  -	    */
   	    if (parentClassLoader == null)
  -                //	        classLoader = new FileClassLoader();
   	        classLoader = new StandardClassLoader();
   	    else
  -                //	        classLoader = new FileClassLoader(parentClassLoader);
   	        classLoader = new StandardClassLoader(parentClassLoader);
   	    for (int i = 0; i < repositories.length; i++)
   		classLoader.addRepository(repositories[i]);
  @@ -574,7 +568,6 @@
   		throw new LifecycleException(e);
   	    }
   	}
  -	    
   
       }
   
  
  
  
  1.17      +36 -15    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ContextConfig.java	2000/09/23 22:41:13	1.16
  +++ ContextConfig.java	2000/10/01 03:07:05	1.17
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.16 2000/09/23 22:41:13 craigmcc Exp $
  - * $Revision: 1.16 $
  - * $Date: 2000/09/23 22:41:13 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.17 2000/10/01 03:07:05 craigmcc Exp $
  + * $Revision: 1.17 $
  + * $Date: 2000/10/01 03:07:05 $
    *
    * ====================================================================
    *
  @@ -93,6 +93,8 @@
   import org.apache.catalina.deploy.ErrorPage;
   import org.apache.catalina.deploy.LoginConfig;
   import org.apache.catalina.deploy.SecurityConstraint;
  +import org.apache.catalina.loader.Extension;
  +import org.apache.catalina.loader.StandardClassLoader;
   import org.apache.catalina.loader.StandardLoader;
   import org.apache.catalina.resources.FileResources;
   import org.apache.catalina.session.StandardManager;
  @@ -108,7 +110,7 @@
    * of that Context, and the associated defined servlets.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.16 $ $Date: 2000/09/23 22:41:13 $
  + * @version $Revision: 1.17 $ $Date: 2000/10/01 03:07:05 $
    */
   
   public final class ContextConfig
  @@ -742,17 +744,6 @@
           } catch (MalformedURLException e) {
   	    ;
   	}
  -        /**
  -	if ((classesURL != null) && "file".equals(classesURL.getProtocol())) {
  -	    File classesFile = new File(classesURL.getFile());
  -	    if (classesFile.exists() && classesFile.canRead() &&
  -	        classesFile.isDirectory()) {
  -		if (debug > 0)
  -		    log(" Adding '" + classesFile.getAbsolutePath() + "'");
  -		loader.addRepository(classesFile.getAbsolutePath());
  -	    }
  -	}
  -        **/
           if (classesURL != null)
               loader.addRepository(classesURL.toString() + "/");
   
  @@ -780,6 +771,36 @@
   		}
   	    }
   	}
  +
  +        // Validate the required and available optional packages
  +        ClassLoader classLoader = loader.getClassLoader();
  +        if (classLoader instanceof StandardClassLoader) {
  +
  +            Extension available[] =
  +                ((StandardClassLoader) classLoader).findAvailable();
  +            Extension required[] =
  +                ((StandardClassLoader) classLoader).findRequired();
  +            if (debug >= 1)
  +                log("Optional Packages:  available=" +
  +                    available.length + ", required=" +
  +                    required.length);
  +
  +            for (int i = 0; i < required.length; i++) {
  +                if (debug >= 1)
  +                    log("Checking for required package " + required[i]);
  +                boolean found = false;
  +                for (int j = 0; j < available.length; j++) {
  +                    if (available[j].isCompatibleWith(required[i])) {
  +                        found = true;
  +                        break;
  +                    }
  +                }
  +                if (!found)
  +                    throw new IllegalStateException
  +                        ("start:  Missing extension " + required[i]);
  +            }
  +
  +        }
   
       }
   
  
  
  

Mime
View raw message