Re: Catalina Startup Hook (actually, both camps should read this:-)

2001-08-07 Thread Jon Stevens

on 8/6/01 10:31 PM, Christopher Cain [EMAIL PROTECTED] wrote:

 But I have to say, from
 someone without a great deal of personal investment in either tree in
 particular, ALL of you people should be damn proud.

Wouldn't it be amazing if they had just worked together though?

All that great talent working on two different (yet the same!) things seems
like such a shame to me! :-)

-jon




Catalina Startup Hook

2001-08-06 Thread Christopher Cain

I need a quick jumpstart on how to hook my password prompter into the
Catalina startup process. I assume that I shouldn't implement it as a
Valve, as those have to do with the Request/Response chain. The
Connector level in server.xml appears to be the appropriate level in
the hierarchy, but it's not really a connecter per se, since its
lifecycle is complete before the startup process even finishes (i.e. it
doesn't need to sit in the service and pass requests off to the engine).

So is there a more generic module architecture in place that I should
implement? I just need a quick, high-level idea of what internal
component to use and how to implement that component in the server.xml
config.

TIA

Regards,

Christopher



Re: Catalina Startup Hook

2001-08-06 Thread Craig R. McClanahan



On Mon, 6 Aug 2001, Christopher Cain wrote:

 I need a quick jumpstart on how to hook my password prompter into the
 Catalina startup process. I assume that I shouldn't implement it as a
 Valve, as those have to do with the Request/Response chain. The
 Connector level in server.xml appears to be the appropriate level in
 the hierarchy, but it's not really a connecter per se, since its
 lifecycle is complete before the startup process even finishes (i.e. it
 doesn't need to sit in the service and pass requests off to the engine).
 

Valves are designed for request processing, not component startup and
shutdown.  See below for an alternative suggestion.

 So is there a more generic module architecture in place that I should
 implement? I just need a quick, high-level idea of what internal
 component to use and how to implement that component in the server.xml
 config.
 

The simplest approach to your particular issue would be to create a class
that implements the org.apache.catalina.LifecycleListener interface, and
then nest a Listener element inside the SSL-based Connector element
that creates an instance of that listener, associated with the
correspondeing connector.

Now, the lifecycleEvent() method will be fired when this Connector is
started up (and when it is shut down), so you can interject your dialog
with the user at that point.  Just look for an event of type
Lifecycle.START_EVENT.

Note that the Lifecycle element, like most elements in server.xml, can
dynamically map the XML attributes specified in the Listener element to
corresponding bean properties on your LifecycleListener class.  This is
tremendously useful for configuring the behavior of your listener.  The
only required attribute is className, which specifies the fully
qualified classname of your class itself.

It won't help for this particular use case, but lifecycle listeners can
also be nested inside Engine, Host, and Context elements, depending
on what kind of startup and shutdown events you care about.

 TIA
 
 Regards,
 
 Christopher
 
Craig





Re: Catalina Startup Hook (actually, both camps should read this :-)

2001-08-06 Thread Christopher Cain

Quoting Craig R. McClanahan [EMAIL PROTECTED]:
 
 Valves are designed for request processing, not component startup and
 shutdown.  See below for an alternative suggestion.

Yep, that's the general conslusion I came to in looking over the codebase. 
Cool, at least I know I can still RTFS and get it right (on occasion) :-)

 The simplest approach to your particular issue would be to create a
 class that implements the org.apache.catalina.LifecycleListener interface,
 and then nest a Listener element inside the SSL-based Connector
 element that creates an instance of that listener, associated with the
 correspondeing connector.
 
 Now, the lifecycleEvent() method will be fired when this Connector is
 started up (and when it is shut down), so you can interject your
 dialog with the user at that point.  Just look for an event of type
 Lifecycle.START_EVENT.

Exactly what I needed to know. Thanks!

 Note that the Lifecycle element, like most elements in server.xml,
 can dynamically map the XML attributes specified in the Listener element
 to corresponding bean properties on your LifecycleListener class.  This
 is tremendously useful for configuring the behavior of your listener. 
 The only required attribute is className, which specifies the fully
 qualified classname of your class itself.
 
 It won't help for this particular use case, but lifecycle listeners
 can also be nested inside Engine, Host, and Context elements,
 depending on what kind of startup and shutdown events you care about.

WARNING: KODAK MOMENT TO FOLLOW ...

Man ... after more than a year, I am FINALLY starting to understand why the 
whole 3.x vs 4.0 war was so fiercely waged. In the process of implementing this 
little module of mine for both trees, I have to say that they are BOTH, really, 
damn clever solutions. I mean, I'm sure the resident experts in each camp each 
have their little nitpicks with the other codebase. But I have to say, from 
someone without a great deal of personal investment in either tree in 
particular, ALL of you people should be damn proud. Costin (et. al) with his 
hooks and interceptors ... Craig (et. al) with his valves and listeners ... you 
guys and your respective posses have BOTH designed an incredible product. The 
more I dig into both trees, the more impressed I am with both. As far as I'm 
concerned, personally, arguing over which is the superior design would be alot 
like arguing over whether to take the Porche or the Jag out for a spin. People 
might have their slight personal preferences, but at the end of the day, your 
driving a DAMN fine machine either way.

Anyway, I'm not trying to stir up anything at all, and I DEFINITELY don't want 
to drag the 3 vs 4 thing back out of the closet. (PLASE, if there are any 
list newbies reading, do NOT reply to this with some kind of feature comparison 
or other opinion on which is better ... you'll get me in all sorts of trouble 
in here :-) I just wanted to say what I didn't have the knowledge or experience 
to say at the time: the greatest testament to the entire Tomcat project is the 
fact that we were fortunate enough to be in the akward position of deciding 
between these two codebases. Because I GUARANTEE you, any strictly-proprietary 
software vendor on the planet would absolutely SALIVATE if given the chance to 
have originally based a closed, commercial product on either one of these two 
designs. You could kick the crap out the competition with either of them (the 
other codebase excluded, of course ;-) ... they're that good.

Anyway, that's just how I feel, and I look forward to continuing work in both 
(easy for me to say, I like to develop plugins =)

Regards,

Christopher