You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jeff Genender <jg...@apache.org> on 2007/06/28 22:48:55 UTC

Lifecycle Listeners added

I just added Lifecycle Listeners to the Tomcat integration.  This allows
people to be able to integrate their own LifecycleListeners to Geronimo
when using Tomcat.  You can add listeners to not only the
Engine/Host/Context, but also to the TomcatContainer itself.

The TomcatContainer GBean now has an attribute called
"LifecycleListenerChain" that you can add Lifecycle Listener GBeans
(chained together of course) similar to the Valve Chain.  Thsi attribute
also is available in the Engine and Host.  Here is an example of what
would go into the context.xml to add a couple of Listeners to the
TomcatContainer:

[SNIP]
<module name="org.apache.geronimo.configs/tomcat6/2.0-SNAPSHOT/car">


<gbean name="TomcatWebContainer">
    <attribute name="catalinaHome">var/catalina</attribute>
    <reference name="LifecycleListenerChain">
        <pattern>
            <groupId>org.apache.geronimo.configs</groupId>
            <artifactId>tomcat6</artifactId>
            <version>2.0-SNAPSHOT</version>
            <type>car</type>
            <name>AprLifecycleListener</name>
        </pattern>
    </reference>
</gbean>

<!-- THE FIRST LISTENER - AprLifecycleListener -->
<gbean gbeanInfo="org.apache.geronimo.tomcat.LifecycleListenerGBean"
name="org.apache.geronimo.configs/tomcat6/2.0-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.0-SNAPSHOT/car,j2eeType=LifecycleListenerGBean,name=AprLifecycleListener">
    <attribute
name="className">org.apache.catalina.core.AprLifecycleListener</attribute>
    <reference name="NextListener">
        <pattern>
            <groupId>org.apache.geronimo.configs</groupId>
            <artifactId>tomcat6</artifactId>
            <version>2.0-SNAPSHOT</version>
            <type>car</type>
            <name>ServerLifecycleListener</name>
        </pattern>
    </reference>
</gbean>

<!-- THE SECOND LISTENER - ServerLifecycleListener -->
<gbean gbeanInfo="org.apache.geronimo.tomcat.LifecycleListenerGBean"
name="org.apache.geronimo.configs/tomcat6/2.0-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.0-SNAPSHOT/car,j2eeType=LifecycleListenerGBean,name=ServerLifecycleListener">
    <attribute
name="className">org.apache.catalina.mbeans.ServerLifecycleListener</attribute>
</gbean>

[/SNIP]


For a Lifecycle Listener in a context, your geronimo-web.xml should
contain a <listener-chain> tag that references the first
LifecycleListenerGBean.  Again, it works very similarly to the valve chains.

Jeff

Re: Lifecycle Listeners added

Posted by Paul McMahan <pa...@gmail.com>.
sweet!  thanks Jeff.


Best wishes,
Paul


On Jun 28, 2007, at 4:48 PM, Jeff Genender wrote:

> I just added Lifecycle Listeners to the Tomcat integration.  This  
> allows
> people to be able to integrate their own LifecycleListeners to  
> Geronimo
> when using Tomcat.  You can add listeners to not only the
> Engine/Host/Context, but also to the TomcatContainer itself.