You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/03/01 00:58:59 UTC

svn commit: r381840 - in /geronimo/branches/1.1: configs/jetty-deployer/src/plan/ configs/tomcat-deployer/src/plan/ modules/jetty/src/java/org/apache/geronimo/jetty/ modules/jetty/src/test/org/apache/geronimo/jetty/ modules/kernel/src/java/org/apache/g...

Author: djencks
Date: Tue Feb 28 15:58:57 2006
New Revision: 381840

URL: http://svn.apache.org/viewcvs?rev=381840&view=rev
Log:
Remove JettyClassLoader, TomcatClassLoader.  Fix the MultiparentCL to hide/non-override resources.  Also a baby step towards better gbean names.

Removed:
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyClassLoader.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatClassLoader.java
Modified:
    geronimo/branches/1.1/configs/jetty-deployer/src/plan/plan.xml
    geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
    geronimo/branches/1.1/modules/jetty/src/test/org/apache/geronimo/jetty/ClassLoaderTest.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
    geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
    geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java

Modified: geronimo/branches/1.1/configs/jetty-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/jetty-deployer/src/plan/plan.xml?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/jetty-deployer/src/plan/plan.xml (original)
+++ geronimo/branches/1.1/configs/jetty-deployer/src/plan/plan.xml Tue Feb 28 15:58:57 2006
@@ -55,6 +55,14 @@
                         <type>car</type>
                     </dependency>
                 </dependencies>
+                <non-overridable-classes>
+                    <filter>java.</filter>
+                    <filter>javax.</filter>
+                    <filter>org.apache.geronimo.</filter>
+                    <filter>org.mortbay.</filter>
+                    <filter>org.xml.</filter>
+                    <filter>org.w3c.</filter>
+                </non-overridable-classes>
             </environment>
         </xml-attribute>
     </gbean>

Modified: geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml (original)
+++ geronimo/branches/1.1/configs/tomcat-deployer/src/plan/plan.xml Tue Feb 28 15:58:57 2006
@@ -43,6 +43,17 @@
                         <type>car</type>
                     </dependency>
                 </dependencies>
+                <non-overridable-classes>
+                    <filter>java.</filter>
+                    <filter>javax.</filter>
+                    <filter>org.apache.geronimo.</filter>
+                    <filter>org.apache.jasper.</filter>
+                    <filter>org.apache.naming.</filter>
+                    <filter>org.apache.catalina.</filter>
+                    <filter>org.apache.tomcat.</filter>
+                    <filter>org.xml.</filter>
+                    <filter>org.w3c.</filter>
+                </non-overridable-classes>
             </environment>
         </xml-attribute>
     </gbean>

Modified: geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java (original)
+++ geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java Tue Feb 28 15:58:57 2006
@@ -222,25 +222,8 @@
 
         setConfigurationClassNames(new String[]{});
 
-//        URI root = null;
-        //TODO is there a simpler way to do this?
-//        if (configurationBaseUrl.getProtocol().equalsIgnoreCase("file")) {
-//            root = new URI("file", configurationBaseUrl.getPath(), null);
-//        } else {
-//            root = URI.create(configurationBaseUrl.toString());
-//        }
-
         webAppRoot = new URL(configurationBaseUrl, uri.toString()).toString();
-//        URL webAppRootURL = webAppRoot.toURL();
-
-//        URL[] urls = new URL[webClassPath.length];
-//        for (int i = 0; i < webClassPath.length; i++) {
-//            URI classPathEntry = webClassPath[i];
-//            classPathEntry = root.resolve(classPathEntry);
-//            urls[i] = classPathEntry.toURL();
-//        }
         this.webClassLoader = classLoader;
-        //new JettyClassLoader(urls, webAppRootURL, classLoader, contextPriorityClassLoader);
         setClassLoader(this.webClassLoader);
 
         setVirtualHosts(virtualHosts);

Modified: geronimo/branches/1.1/modules/jetty/src/test/org/apache/geronimo/jetty/ClassLoaderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty/src/test/org/apache/geronimo/jetty/ClassLoaderTest.java?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty/src/test/org/apache/geronimo/jetty/ClassLoaderTest.java (original)
+++ geronimo/branches/1.1/modules/jetty/src/test/org/apache/geronimo/jetty/ClassLoaderTest.java Tue Feb 28 15:58:57 2006
@@ -19,9 +19,12 @@
 
 import java.net.URL;
 import java.net.MalformedURLException;
+import java.net.URLClassLoader;
 import java.io.File;
 
 import junit.framework.TestCase;
+import org.apache.geronimo.kernel.config.MultiParentClassLoader;
+import org.apache.geronimo.kernel.repository.Artifact;
 
 /**
  * Tests loading various classes (as classes and URL resources) with different
@@ -31,8 +34,11 @@
  * @version $Rev$ $Date$
  */
 public class ClassLoaderTest extends TestCase {
-    JettyClassLoader cl;
+    Artifact configId = new Artifact("foo", "bar", "1", "car");
+    ClassLoader cl;
     URL[] urls;
+    private static final String[] HIDDEN = {"org.apache.geronimo", "org.mortbay", "org.xml", "org.w3c"};
+    private static final String[] NON_OVERRIDABLE = {"java.", "javax."};
 
     public void setUp() throws MalformedURLException {
         URL url = new File("src/test-resources/deployables/cltest/").toURL();
@@ -48,7 +54,7 @@
      * parent ClassLoader.  This should work.
      */
     public void testFalseNonexistantJavaxClass() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), false);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), false, HIDDEN, NON_OVERRIDABLE);
         try {
             cl.loadClass("javax.foo.Foo");
         } catch(ClassNotFoundException e) {
@@ -61,7 +67,7 @@
      * parent ClassLoader.  This should work.
      */
     public void testTrueNonexistantJavaxClass() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), true);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), true, HIDDEN, NON_OVERRIDABLE);
         try {
             cl.loadClass("javax.foo.Foo");
         } catch(ClassNotFoundException e) {
@@ -75,7 +81,7 @@
      * This should always load the parent's copy.
      */
     public void testFalseExistantJavaxClass() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), false);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), false, HIDDEN, NON_OVERRIDABLE);
         try {
             Class cls = cl.loadClass("javax.servlet.Servlet");
             assertTrue("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",cls.getDeclaredMethods().length > 0);
@@ -90,7 +96,7 @@
      * This should always load the parent's copy.
      */
     public void testTrueExistantJavaxClass() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), true);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), true, HIDDEN, NON_OVERRIDABLE);
         try {
             Class cls = cl.loadClass("javax.servlet.Servlet");
             assertTrue("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",cls.getDeclaredMethods().length > 0);
@@ -107,7 +113,7 @@
      * copy when the contextPriorityClassLoader is set to true.
      */
     public void testFalseExistantNonJavaxClass() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), false);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), false, HIDDEN, NON_OVERRIDABLE);
         try {
             Class cls = cl.loadClass("mx4j.MBeanDescription");
             assertTrue("Should not have overriden parent CL definition of class mx4j.MBeanDescription", cls.getDeclaredMethods().length > 0);
@@ -124,7 +130,7 @@
      * the contextPriorityClassLoader is set to true (as here).
      */
     public void testTrueExistantNonJavaxClass() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), true);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), true, HIDDEN, NON_OVERRIDABLE);
         try {
             Class cls = cl.loadClass("mx4j.MBeanDescription");
             assertTrue("Should be able to override a class that is not in java.*, javax.*, etc.", cls.getDeclaredMethods().length == 0);
@@ -138,7 +144,7 @@
      * parent ClassLoader.  This should work.
      */
     public void testFalseNonexistantJavaxResource() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), false);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), false, HIDDEN, NON_OVERRIDABLE);
         URL url = cl.getResource("javax/foo/Foo.class");
         if(url == null) {
             fail("Should be able to load a javax.* class that is not defined by my parent CL");
@@ -151,7 +157,7 @@
      * parent ClassLoader.  This should work.
      */
     public void testTrueNonexistantJavaxResource() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), true);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), true, HIDDEN, NON_OVERRIDABLE);
         URL url = cl.getResource("javax/foo/Foo.class");
         if(url == null) {
             fail("Should be able to load a javax.* class that is not defined by my parent CL");
@@ -165,7 +171,7 @@
      * This should always load the parent's copy.
      */
     public void testFalseExistantJavaxResource() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), false);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), false, HIDDEN, NON_OVERRIDABLE);
         URL url = cl.getResource("javax/servlet/Servlet.class");
         if(url == null) {
             fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
@@ -179,7 +185,7 @@
      * This should always load the parent's copy.
      */
     public void testTrueExistantJavaxResource() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), true);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), true, HIDDEN, NON_OVERRIDABLE);
         URL url = cl.getResource("javax/servlet/Servlet.class");
         if(url == null) {
             fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
@@ -195,7 +201,7 @@
      * copy when the contextPriorityClassLoader is set to true.
      */
     public void testFalseExistantNonJavaxResource() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), false);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), false, HIDDEN, NON_OVERRIDABLE);
         URL url = cl.getResource("mx4j/MBeanDescription.class");
         if(url == null) {
             fail("Problem with test; expecting to have mx4j.* on the ClassPath");
@@ -211,7 +217,7 @@
      * the contextPriorityClassLoader is set to true (as here).
      */
     public void testTrueExistantNonJavaxResource() {
-        cl = new JettyClassLoader(urls, null, getClass().getClassLoader(), true);
+        cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), true, new String[] {}, NON_OVERRIDABLE);
         URL url = cl.getResource("mx4j/MBeanDescription.class");
         if(url == null) {
             fail("Problem with test; expecting to have mx4j.* on the ClassPath");

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java Tue Feb 28 15:58:57 2006
@@ -26,12 +26,16 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Hashtable;
 import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 
 /**
  * @version $Rev$ $Date$
  */
 public class GBeanData implements Externalizable {
+    private Map nameMap;
+    private Set omit;
     private ObjectName name;
     private GBeanInfo gbeanInfo;
     private final Map attributes;
@@ -39,6 +43,8 @@
     private final Set dependencies;
 
     public GBeanData() {
+        nameMap = new HashMap();
+        omit = new HashSet();
         attributes = new HashMap();
         references = new HashMap();
         dependencies = new HashSet();
@@ -55,7 +61,18 @@
         this.gbeanInfo = gbeanInfo;
     }
 
+    public GBeanData(Map nameMap, Set omitMap, GBeanInfo gbeanInfo) {
+        this();
+        this.nameMap.putAll(nameMap);
+        if (omitMap != null) {
+            this.omit.addAll(omitMap);
+        }
+        this.gbeanInfo = gbeanInfo;
+    }
+
     public GBeanData(GBeanData gbeanData) {
+        nameMap = new HashMap(gbeanData.nameMap);
+        omit = new HashSet(gbeanData.omit);
         name = gbeanData.name;
         gbeanInfo = gbeanData.gbeanInfo;
         attributes = new HashMap(gbeanData.attributes);
@@ -71,6 +88,24 @@
         this.name = name;
     }
 
+    public void initializeName(ObjectName base) throws MalformedObjectNameException {
+        String domain = base.getDomain();
+        Hashtable keys = base.getKeyPropertyList();
+        keys.keySet().removeAll(omit);
+        keys.putAll(nameMap);
+        name = new ObjectName(domain, keys);
+    }
+
+    public void setNameMap(Map nameMap) {
+        this.nameMap.clear();
+        this.nameMap.putAll(nameMap);
+    }
+
+    public void setOmit(Set omit) {
+        this.omit.clear();
+        this.omit.addAll(omit);
+    }
+
     public GBeanInfo getGBeanInfo() {
         return gbeanInfo;
     }
@@ -124,8 +159,11 @@
         out.writeObject(gbeanInfo);
 
         // write the object name
+        //TODO possibly remove this
         out.writeObject(name);
 
+        out.writeObject(nameMap);
+        out.writeObject(omit);
         // write the attributes
         out.writeInt(attributes.size());
         for (Iterator iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
@@ -169,10 +207,15 @@
 
         // read the object name
         try {
+            //TODO possibly remove this
             name = (ObjectName) in.readObject();
+            nameMap = (Map) in.readObject();
+            omit = (Set) in.readObject();
         } catch (IOException e) {
             throw (IOException) new IOException("Unable to deserialize ObjectName for GBeanData of type " + gbeanInfo.getClassName()).initCause(e);
         }
+
+
 
         try {
             // read the attributes

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java Tue Feb 28 15:58:57 2006
@@ -42,6 +42,7 @@
  * with a operation that checks each parent in order.  This getParent method of this class will always return null,
  * which may be interpreted by the calling code to mean that this class loader is a direct child of the system class
  * loader.
+ *
  * @version $Rev$ $Date$
  */
 public class MultiParentClassLoader extends URLClassLoader {
@@ -50,10 +51,13 @@
     private final boolean inverseClassLoading;
     private final String[] hiddenClasses;
     private final String[] nonOverridableClasses;
+    private final String[] hiddenResources;
+    private final String[] nonOverridableResources;
 
     /**
      * Creates a named class loader with no parents.
-     * @param id the id of this class loader
+     *
+     * @param id   the id of this class loader
      * @param urls the urls from which this class loader will classes and resources
      */
     public MultiParentClassLoader(Artifact id, URL[] urls) {
@@ -63,27 +67,30 @@
         inverseClassLoading = false;
         hiddenClasses = new String[0];
         nonOverridableClasses = new String[0];
+        hiddenResources = new String[0];
+        nonOverridableResources = new String[0];
     }
 
 
     /**
      * Creates a named class loader as a child of the specified parent.
-     * @param id the id of this class loader
-     * @param urls the urls from which this class loader will classes and resources
+     *
+     * @param id     the id of this class loader
+     * @param urls   the urls from which this class loader will classes and resources
      * @param parent the parent of this class loader
      */
     public MultiParentClassLoader(Artifact id, URL[] urls, ClassLoader parent) {
-        this(id, urls, new ClassLoader[] {parent});
+        this(id, urls, new ClassLoader[]{parent});
     }
 
     public MultiParentClassLoader(Artifact id, URL[] urls, ClassLoader parent, boolean inverseClassLoading, String[] hiddenClasses, String[] nonOverridableClasses) {
-        this(id, urls, new ClassLoader[] {parent}, inverseClassLoading, hiddenClasses, nonOverridableClasses);
+        this(id, urls, new ClassLoader[]{parent}, inverseClassLoading, hiddenClasses, nonOverridableClasses);
     }
 
     public MultiParentClassLoader(Environment environment, URL[] urls, ClassLoader parent) {
         this(environment.getConfigId(),
                 urls,
-                new ClassLoader[] {parent},
+                new ClassLoader[]{parent},
                 environment.isInverseClassLoading(),
                 environment.getHiddenClasses(),
                 environment.getNonOverrideableClasses());
@@ -101,19 +108,21 @@
     /**
      * Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory
      * for accessing the urls..
-     * @param id the id of this class loader
-     * @param urls the urls from which this class loader will classes and resources
-     * @param parent the parent of this class loader
+     *
+     * @param id      the id of this class loader
+     * @param urls    the urls from which this class loader will classes and resources
+     * @param parent  the parent of this class loader
      * @param factory the URLStreamHandlerFactory used to access the urls
      */
     public MultiParentClassLoader(Artifact id, URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) {
-        this(id, urls, new ClassLoader[] {parent}, factory);
+        this(id, urls, new ClassLoader[]{parent}, factory);
     }
 
     /**
      * Creates a named class loader as a child of the specified parents.
-     * @param id the id of this class loader
-     * @param urls the urls from which this class loader will classes and resources
+     *
+     * @param id      the id of this class loader
+     * @param urls    the urls from which this class loader will classes and resources
      * @param parents the parents of this class loader
      */
     public MultiParentClassLoader(Artifact id, URL[] urls, ClassLoader[] parents) {
@@ -123,15 +132,12 @@
         inverseClassLoading = false;
         hiddenClasses = new String[0];
         nonOverridableClasses = new String[0];
+        hiddenResources = new String[0];
+        nonOverridableResources = new String[0];
     }
 
     public MultiParentClassLoader(Artifact id, URL[] urls, ClassLoader[] parents, boolean inverseClassLoading, Collection hiddenClasses, Collection nonOverridableClasses) {
-        super(urls, new FilteringParentCL((String[]) hiddenClasses.toArray(new String[hiddenClasses.size()])));
-        this.id = id;
-        this.parents = copyParents(parents);
-        this.inverseClassLoading = inverseClassLoading;
-        this.hiddenClasses = (String[]) hiddenClasses.toArray(new String[hiddenClasses.size()]);
-        this.nonOverridableClasses = (String[]) nonOverridableClasses.toArray(new String[nonOverridableClasses.size()]);
+        this(id, urls, parents, inverseClassLoading, (String[]) hiddenClasses.toArray(new String[hiddenClasses.size()]), (String[]) nonOverridableClasses.toArray(new String[nonOverridableClasses.size()]));
     }
 
     public MultiParentClassLoader(Artifact id, URL[] urls, ClassLoader[] parents, boolean inverseClassLoading, String[] hiddenClasses, String[] nonOverridableClasses) {
@@ -141,13 +147,25 @@
         this.inverseClassLoading = inverseClassLoading;
         this.hiddenClasses = hiddenClasses;
         this.nonOverridableClasses = nonOverridableClasses;
+        hiddenResources = toResources(hiddenClasses);
+        nonOverridableResources = toResources(nonOverridableClasses);
+    }
+
+    private String[] toResources(String[] classes) {
+        String[] resources = new String[classes.length];
+        for (int i = 0; i < classes.length; i++) {
+            String className = classes[i];
+            resources[i] = className.replace('.', '/');
+        }
+        return resources;
     }
 
     /**
      * Creates a named class loader as a child of the specified parents and using the specified URLStreamHandlerFactory
      * for accessing the urls..
-     * @param id the id of this class loader
-     * @param urls the urls from which this class loader will classes and resources
+     *
+     * @param id      the id of this class loader
+     * @param urls    the urls from which this class loader will classes and resources
      * @param parents the parents of this class loader
      * @param factory the URLStreamHandlerFactory used to access the urls
      */
@@ -158,6 +176,8 @@
         inverseClassLoading = false;
         hiddenClasses = new String[0];
         nonOverridableClasses = new String[0];
+        hiddenResources = new String[0];
+        nonOverridableResources = new String[0];
     }
 
     private static ClassLoader[] copyParents(ClassLoader[] parents) {
@@ -174,6 +194,7 @@
 
     /**
      * Gets the id of this class loader.
+     *
      * @return the id of this class loader
      */
     public Artifact getId() {
@@ -182,6 +203,7 @@
 
     /**
      * Gets the parents of this class loader.
+     *
      * @return the parents of this class loader
      */
     public ClassLoader[] getParents() {
@@ -249,18 +271,35 @@
         URL url = null;
 
         if (inverseClassLoading) {
-            url = super.getResource(name);
-            if (null != url) {
-                return url;
+            boolean checkMe = true;
+            for (int i = 0; i < nonOverridableResources.length && checkMe; i++) {
+                if (name.startsWith(nonOverridableResources[i])) {
+                    checkMe = false;
+                }
+            }
+
+            if (checkMe) {
+                url = findResource(name);
+                if (null != url) {
+                    return url;
+                }
             }
         }
 
-        for (int i = 0; i < parents.length && url == null; i++) {
-            ClassLoader parent = parents[i];
-            url = parent.getResource(name);
+        boolean checkParents = true;
+        for (int i = 0; i < hiddenResources.length && checkParents; i++) {
+            if (name.startsWith(hiddenResources[i])) {
+                checkParents = false;
+            }
+        }
+        if (checkParents) {
+            for (int i = 0; i < parents.length && url == null; i++) {
+                ClassLoader parent = parents[i];
+                url = parent.getResource(name);
+            }
         }
 
-        if (url == null && !inverseClassLoading) {
+        if (url == null) {
             // parents didn't have the resource; attempt to load it from my urls
             return super.getResource(name);
         } else {
@@ -324,10 +363,12 @@
 
             throw new ClassNotFoundException(name);
         }
+        //TODO does this need a getResource method too?
     }
 
     private static final Object lock = new Object();
     private static boolean clearSoftCacheFailed = false;
+
     private static void clearSoftCache(Class clazz, String fieldName) {
         Map cache = null;
         try {

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java Tue Feb 28 15:58:57 2006
@@ -18,30 +18,29 @@
 package org.apache.geronimo.deployment.service;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
 import org.apache.geronimo.deployment.xbeans.ClassFilterType;
+import org.apache.geronimo.deployment.xbeans.DependenciesType;
 import org.apache.geronimo.deployment.xbeans.EnvironmentDocument;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
-import org.apache.geronimo.deployment.xbeans.PropertyType;
 import org.apache.geronimo.deployment.xbeans.ImportType;
 import org.apache.geronimo.deployment.xbeans.PropertiesType;
-import org.apache.geronimo.deployment.xbeans.DependenciesType;
+import org.apache.geronimo.deployment.xbeans.PropertyType;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
 
 /**
  * @version $Rev:$ $Date:$
@@ -97,8 +96,8 @@
             }
             environment.setInverseClassLoading(environmentType.isSetInverseClassloading());
             environment.setSuppressDefaultEnvironment(environmentType.isSetSuppressDefaultEnvironment());
-            environment.setHiddenClasses(toFilters(environmentType.getHiddenClassesArray()));
-            environment.setNonOverrideableClasses(toFilters(environmentType.getNonOverridableClassesArray()));
+            environment.setHiddenClasses(toFilters(environmentType.getHiddenClasses()));
+            environment.setNonOverrideableClasses(toFilters(environmentType.getNonOverridableClasses()));
         }
 
         return environment;
@@ -158,21 +157,16 @@
         if (environment.isSuppressDefaultEnvironment()) {
             environmentType.addNewSuppressDefaultEnvironment();
         }
-        environmentType.setHiddenClassesArray(toFilterType(environment.getHiddenClasses()));
-        environmentType.setNonOverridableClassesArray(toFilterType(environment.getNonOverrideableClasses()));
+        environmentType.setHiddenClasses(toFilterType(environment.getHiddenClasses()));
+        environmentType.setNonOverridableClasses(toFilterType(environment.getNonOverrideableClasses()));
         return environmentType;
     }
 
-    private static ClassFilterType[] toFilterType(Set filters) {
-        ClassFilterType[] classFilters = new ClassFilterType[filters.size()];
-        int i = 0;
-        for (Iterator iterator = filters.iterator(); iterator.hasNext();) {
-            String filter = (String) iterator.next();
-            ClassFilterType classFilter  = ClassFilterType.Factory.newInstance();
-            classFilter.setFilter(filter);
-            classFilters[i++] = classFilter;
-        }
-        return classFilters;
+    private static ClassFilterType toFilterType(Set filters) {
+        String[] classFilters = (String[]) filters.toArray(new String[filters.size()]);
+        ClassFilterType classFilter  = ClassFilterType.Factory.newInstance();
+        classFilter.setFilterArray(classFilters);
+        return classFilter;
     }
 
     private static void toArtifactTypes(Collection artifacts, ImportType.Enum importType, List dependencies) {
@@ -203,12 +197,14 @@
         return artifactType;
     }
 
-    private static Set toFilters(ClassFilterType[] filterArray) {
+    private static Set toFilters(ClassFilterType filterType) {
         Set filters = new HashSet();
-        for (int i = 0; i < filterArray.length; i++) {
-            ClassFilterType classFilterType = filterArray[i];
-            String filter = classFilterType.getFilter().trim();
-            filters.add(filter);
+        if (filterType != null) {
+            String[] filterArray = filterType.getFilterArray();
+            for (int i = 0; i < filterArray.length; i++) {
+                String filter = filterArray[i].trim();
+                filters.add(filter);
+            }
         }
         return filters;
     }

Modified: geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd (original)
+++ geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd Tue Feb 28 15:58:57 2006
@@ -76,7 +76,7 @@
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
-            <xs:element name="hidden-classes" type="sys:classFilterType" minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="hidden-classes" type="sys:classFilterType" minOccurs="0">
                 <xs:annotation>
                     <xs:documentation>
                         A list of classes which will never be loaded from parent ClassLoaders of this
@@ -91,7 +91,7 @@
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
-            <xs:element name="non-overridable-classes" type="sys:classFilterType" minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="non-overridable-classes" type="sys:classFilterType" minOccurs="0">
                 <xs:annotation>
                     <xs:documentation>
                         A list of classes which will only be loaded from parent ClassLodaers of this
@@ -163,7 +163,7 @@
 
     <xs:complexType name="classFilterType">
         <xs:sequence>
-            <xs:element name="filter" type="xs:string"/>
+            <xs:element name="filter" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
 

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java Tue Feb 28 15:58:57 2006
@@ -22,6 +22,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
+
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
@@ -42,14 +43,12 @@
 import org.apache.geronimo.webservices.WebServiceContainer;
 
 
-
 /**
  * Apache Tomcat GBean
  *
+ * @version $Rev$ $Date$
  * @see http://wiki.apache.org/geronimo/Tomcat
  * @see http://nagoya.apache.org/jira/browse/GERONIMO-215
- *
- * @version $Rev$ $Date$
  */
 public class TomcatContainer implements SoapHandler, GBeanLifecycle, TomcatWebContainer {
 
@@ -72,7 +71,7 @@
 
     /**
      * Geronimo class loader
-     **/
+     */
     private ClassLoader classLoader;
 
     private final Map webServices = new HashMap();
@@ -93,17 +92,17 @@
 
         setCatalinaHome(serverInfo.resolvePath(catalinaHome));
 
-        if (classLoader == null){
+        if (classLoader == null) {
             throw new IllegalArgumentException("classLoader cannot be null.");
         }
 
-        if (engineGBean == null){
+        if (engineGBean == null) {
             throw new IllegalArgumentException("engineGBean cannot be null.");
         }
 
         this.classLoader = classLoader;
 
-        this.engine = (Engine)engineGBean.getInternalObject();
+        this.engine = (Engine) engineGBean.getInternalObject();
 
         this.objectName = objectName;
     }
@@ -133,7 +132,7 @@
 
     /**
      * Instantiate and start up Tomcat's Embedded class
-     *
+     * <p/>
      * See org.apache.catalina.startup.Embedded for details (TODO: provide the link to the javadoc)
      */
     public void doStart() throws Exception {
@@ -162,18 +161,15 @@
         //Add default contexts
         File rootContext = new File(System.getProperty("catalina.home") + "/ROOT");
 
-        TomcatClassLoader tcl = null;
-        if (rootContext.exists())
-            tcl = createRootClassLoader(rootContext, classLoader);
+        String docBase = "";
+        if (rootContext.exists()) {
+            docBase = "ROOT";
+        }
 
         Container[] hosts = engine.findChildren();
-        Context defaultContext = null;
-        for(int i = 0; i < hosts.length; i++){
-            if (rootContext.exists()){
-                defaultContext = embedded.createContext("","ROOT", tcl);
-            } else {
-                defaultContext = embedded.createContext("","", classLoader);
-            }
+        Context defaultContext;
+        for (int i = 0; i < hosts.length; i++) {
+            defaultContext = embedded.createContext("", docBase, classLoader);
             hosts[i].addChild(defaultContext);
         }
 
@@ -191,20 +187,19 @@
             embedded.stop();
             embedded = null;
         }
-        
+
     }
 
     /**
      * Creates and adds the context to the running host
-     *
+     * <p/>
      * It simply delegates the call to Tomcat's Embedded and Host classes
      *
      * @param ctx the context to be added
-     *
      * @see org.apache.catalina.startup.Embedded
      * @see org.apache.catalina.Host
      */
-    public void addContext(TomcatContext ctx) throws Exception{
+    public void addContext(TomcatContext ctx) throws Exception {
         Context anotherCtxObj = embedded.createContext(ctx.getContextPath(), ctx.getDocBase(), ctx.getClassLoader());
 
         // Set the context for the Tomcat implementation
@@ -212,7 +207,7 @@
 
         // Have the context to set its properties if its a GeronimoStandardContext
         if (anotherCtxObj instanceof GeronimoStandardContext)
-            ((GeronimoStandardContext)anotherCtxObj).setContextProperties(ctx);
+            ((GeronimoStandardContext) anotherCtxObj).setContextProperties(ctx);
 
         //Was a virtual server defined?
         String virtualServer = ctx.getVirtualServer();
@@ -220,8 +215,8 @@
             virtualServer = engine.getDefaultHost();
 
         Container host = engine.findChild(virtualServer);
-        if (host == null){
-            throw new IllegalArgumentException("Invalid virtual host '" + virtualServer +"'.  Do you have a matching Host entry in the plan?");
+        if (host == null) {
+            throw new IllegalArgumentException("Invalid virtual host '" + virtualServer + "'.  Do you have a matching Host entry in the plan?");
         }
 
         //Get the security-realm-name if there is one
@@ -231,32 +226,32 @@
             securityRealmName = secHolder.getSecurityRealm();
 
         //Did we declare a GBean at the context level?
-        if (ctx.getRealm() != null){
+        if (ctx.getRealm() != null) {
             Realm realm = ctx.getRealm();
 
             //Allow for the <security-realm-name> override from the
             //geronimo-web.xml file to be used if our Realm is a JAAS type
-            if (securityRealmName != null){
-                if (realm instanceof JAASRealm){
-                    ((JAASRealm)realm).setAppName(securityRealmName);
+            if (securityRealmName != null) {
+                if (realm instanceof JAASRealm) {
+                    ((JAASRealm) realm).setAppName(securityRealmName);
                 }
             }
             anotherCtxObj.setRealm(realm);
         } else {
             Realm realm = host.getRealm();
             //Check and see if we have a declared realm name and no match to a parent name
-            if (securityRealmName != null){
+            if (securityRealmName != null) {
                 String parentRealmName = null;
-                if (realm instanceof JAASRealm){
-                    parentRealmName = ((JAASRealm)realm).getAppName();
+                if (realm instanceof JAASRealm) {
+                    parentRealmName = ((JAASRealm) realm).getAppName();
                 }
 
                 //Do we have a match to a parent?
-                if(!securityRealmName.equals(parentRealmName)){
+                if (!securityRealmName.equals(parentRealmName)) {
                     //No...we need to create a default adapter
 
                     //Is the context requiring JACC?
-                    if (secHolder.isSecurity()){
+                    if (secHolder.isSecurity()) {
                         //JACC
                         realm = new TomcatGeronimoRealm();
                     } else {
@@ -269,9 +264,9 @@
                             "Creating a default " + realm.getClass().getName() +
                             " adapter for this context.");
 
-                    ((JAASRealm)realm).setUserClassNames("org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
-                    ((JAASRealm)realm).setRoleClassNames("org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");
-                    ((JAASRealm)realm).setAppName(securityRealmName);
+                    ((JAASRealm) realm).setUserClassNames("org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
+                    ((JAASRealm) realm).setRoleClassNames("org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");
+                    ((JAASRealm) realm).setAppName(securityRealmName);
 
                     anotherCtxObj.setRealm(realm);
                 } else {
@@ -289,14 +284,14 @@
     public void removeContext(TomcatContext ctx) {
         Context context = ctx.getContext();
 
-        if (context != null){
-            if (context instanceof GeronimoStandardContext){
-                GeronimoStandardContext stdctx = (GeronimoStandardContext)context;
-                
-                try{
+        if (context != null) {
+            if (context instanceof GeronimoStandardContext) {
+                GeronimoStandardContext stdctx = (GeronimoStandardContext) context;
+
+                try {
                     stdctx.stop();
                     stdctx.destroy();
-                } catch (Exception e){
+                } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
 
@@ -329,8 +324,8 @@
         }
 
         Container host = engine.findChild(virtualServer);
-        if (host == null){
-            throw new IllegalArgumentException("Invalid virtual host '" + virtualServer +"'.  Do you have a matchiing Host entry in the plan?");
+        if (host == null) {
+            throw new IllegalArgumentException("Invalid virtual host '" + virtualServer + "'.  Do you have a matchiing Host entry in the plan?");
         }
 
         host.addChild(webServiceContext);
@@ -339,53 +334,22 @@
 
     public void removeWebService(String contextPath) {
         TomcatEJBWebServiceContext context = (TomcatEJBWebServiceContext) webServices.get(contextPath);
-        try{
+        try {
             context.stop();
             context.destroy();
-        } catch (Exception e){
+        } catch (Exception e) {
             throw new RuntimeException(e);
         }
         context.getParent().removeChild(context);
         webServices.remove(contextPath);
     }
 
-    private TomcatClassLoader createRootClassLoader(File baseDir, ClassLoader cl) throws Exception{
-        ArrayList urls = new ArrayList();
-
-        File webInfDir = new File(baseDir, "WEB-INF");
-
-        // check for a classes dir
-        File classesDir = new File(webInfDir, "classes");
-        if (classesDir.isDirectory()) {
-            urls.add(classesDir.toURL());
-        }
-
-        // add all of the libs
-        File libDir = new File(webInfDir, "lib");
-        if (libDir.isDirectory()) {
-            File[] libs = libDir.listFiles(new FileFilter() {
-                public boolean accept(File file) {
-                    return file.isFile() && file.getName().endsWith(".jar");
-                }
-            });
-
-            if (libs != null) {
-                for (int i = 0; i < libs.length; i++) {
-                    File lib = libs[i];
-                    urls.add(lib.toURL());
-                }
-            }
-        }
-
-        return new TomcatClassLoader((URL[])urls.toArray(new URL[0]), null, cl, false);
-    }
-
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Web Container", TomcatContainer.class);
 
-        infoFactory.setConstructor(new String[] { "classLoader", "catalinaHome", "EngineGBean", "ServerInfo", "objectName"});
+        infoFactory.setConstructor(new String[]{"classLoader", "catalinaHome", "EngineGBean", "ServerInfo", "objectName"});
 
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
 
@@ -397,11 +361,11 @@
 
         infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
 
-        infoFactory.addOperation("addContext", new Class[] { TomcatContext.class });
-        infoFactory.addOperation("removeContext", new Class[] { TomcatContext.class });
+        infoFactory.addOperation("addContext", new Class[]{TomcatContext.class});
+        infoFactory.addOperation("removeContext", new Class[]{TomcatContext.class});
 
-        infoFactory.addOperation("addConnector", new Class[] { Connector.class });
-        infoFactory.addOperation("removeConnector", new Class[] { Connector.class });
+        infoFactory.addOperation("addConnector", new Class[]{Connector.class});
+        infoFactory.addOperation("removeConnector", new Class[]{Connector.class});
 
         infoFactory.addInterface(SoapHandler.class);
         infoFactory.addInterface(TomcatWebContainer.class);

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=381840&r1=381839&r2=381840&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java Tue Feb 28 15:58:57 2006
@@ -214,17 +214,7 @@
 
         this.webServices = webServices;
 
-//        URL webAppRootURL = webAppRoot.toURL();
-
-//        URL[] urls = new URL[webClassPath.length];
-//        for (int i = 0; i < webClassPath.length; i++) {
-//            URI classPathEntry = webClassPath[i];
-//            classPathEntry = root.resolve(classPathEntry);
-//            urls[i] = classPathEntry.toURL();
-//        }
-
         this.classLoader = classLoader;
-//        new TomcatClassLoader(urls, webAppRootURL, classLoader, contextPriorityClassLoader);
 
         this.kernel = kernel;
         ObjectName myObjectName = JMXUtil.getObjectName(objectName);