LifecycleListenerRulepublic class LifecycleListenerRule extends org.apache.tomcat.util.digester.Rule Rule that creates a new LifecycleListener instance,
and associates it with the top object on the stack (which must
implement LifecycleListener ). |
Fields Summary |
---|
private String | attributeNameThe attribute name of an attribute that can override the
implementation class name. | private String | listenerClassThe name of the LifecycleListener implementation class. |
Constructors Summary |
---|
public LifecycleListenerRule(String listenerClass, String attributeName)Construct a new instance of this Rule.
this.listenerClass = listenerClass;
this.attributeName = attributeName;
|
Methods Summary |
---|
public void | begin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes)Handle the beginning of an XML element.
// Instantiate a new LifecyleListener implementation object
String className = listenerClass;
if (attributeName != null) {
String value = attributes.getValue(attributeName);
if (value != null)
className = value;
}
Class clazz = Class.forName(className);
LifecycleListener listener =
(LifecycleListener) clazz.newInstance();
// Add this LifecycleListener to our associated component
Lifecycle lifecycle = (Lifecycle) digester.peek();
lifecycle.addLifecycleListener(listener);
|
|