FileDocCategorySizeDatePackage
CopyParentClassLoaderRule.javaAPI DocGlassfish v2 API3727Fri May 04 22:32:28 BST 2007org.apache.catalina.startup

CopyParentClassLoaderRule

public class CopyParentClassLoaderRule extends com.sun.org.apache.commons.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: 1.4 $ $Date: 2007/05/05 05:32:28 $

Fields Summary
Constructors Summary
public CopyParentClassLoaderRule(com.sun.org.apache.commons.digester.Digester digester)
Construct a new instance of this Rule.

param
digester Digester we are associated with


        super(digester);

    
Methods Summary
public voidbegin(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.getDebug() >= 1)
            digester.log("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);