tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher K. St. John" <...@distributopia.com>
Subject Re: o.a.c.mbeans.*
Date Wed, 20 Feb 2002 22:51:40 GMT
"Craig R. McClanahan" wrote:
> 
> >  It looks like the current mbeans code is mostly boilerplate.
> 
> In what respect? 
>

 Well, taking StandardHostMBean as an example, many of the
methods take a String argument, convert it to an ObjectName,
get the underlying object using getAttribute(), and then call
the actual operation on the wrapped Catalina objects. That can
all be done using introspection and the info in
mbeans-descriptors.xml. I think the other methods could
be similarly automated.

 Note that I'm clear that the normal JMX mechanisms do not
provide this. RequiredModelMBean is a start, but there would
need to be extra code to do the mappings between Strings,
ObjectNames, and Objects. I'm suggesting that that code is
for the most part boilerplate, and there's enough information 
available through introspection and the modeler Registry to
implement a completely generic Catalina MBean that could be
used in place of many/most of the existing hand-coded Catalina
MBeans.


> Consider the following method on the o.a.c.UserDatabase interface:
> 
>     public Iterator getUsers();
> 

 You're right, automatically converting between the version of
getUsers() that returns an Iterator and the version that
returns a String[] would take an overly clever mechanism.
MemoryUserDatabase MBean would be hard to get rid of.

 But it looks like most of the objects that need to be managed
already use easy-to-recognize bean patterns for their interfaces.
I'm pretty sure StandardHostMBean, for example, could be entirely
eliminated.

 It matters in general because it adds an extra burden to
Catalina developers to have to write a new hand-coded MBean
every time they want to add a new kind of object. I suspect
most people won't bother, especially if it's an in-house sort
of thing. That still leaves the issue of adding entries to
mbeans-descriptors.xml, and possibly having to rewrite parts
of the admin webapp, but every little bit helps.

 I care because I'm trying looking at hacking up a debloated
(excuse me, "slimmed down" :-) configuration of Catalina for
use inside a tool I'm writing. Although there's a good chance
there wouldn't be room for JMX, I'd like to maintain as much
compatibility as possible with the standard Catalina tools.
That's easy if MBeans are automagically created for me...
 
-- 
Christopher St. John cks@distributopia.com
DistribuTopia http://www.distributopia.com

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message