FileDocCategorySizeDatePackage
CopyParentClassLoaderRule.javaAPI DocApache Tomcat 6.0.142545Fri Jul 20 04:20:36 BST 2007org.apache.catalina.startup

CopyParentClassLoaderRule

public class CopyParentClassLoaderRule extends org.apache.tomcat.util.digester.Rule

Rule that copies the parentClassLoader property from the next-to-top item on the stack (which must be a Container) to the top item on the stack (which must also be a Container).

author
Craig R. McClanahan
version
$Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
Constructors Summary
public CopyParentClassLoaderRule()
Construct a new instance of this Rule.

    
Methods Summary
public voidbegin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes)
Handle the beginning of an XML element.

param
attributes The attributes of this element
exception
Exception if a processing error occurs


        if (digester.getLogger().isDebugEnabled())
            digester.getLogger().debug("Copying parent class loader");
        Container child = (Container) digester.peek(0);
        Object parent = digester.peek(1);
        Method method =
            parent.getClass().getMethod("getParentClassLoader", new Class[0]);
        ClassLoader classLoader =
            (ClassLoader) method.invoke(parent, new Object[0]);
        child.setParentClassLoader(classLoader);