avalon-phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: JMX Attributes
Date Tue, 27 Aug 2002 13:14:15 GMT
Hi,

I had a look at this. It looks to be a feature of the template. Essentially 
all methods that have the phoenix:mx-attribute attribute cause another 
attribute to be defined.

Unfortunately it would be bloody hard to fix it at the template level with 
their templating language.  Luckily we can extend it with jsp-like tags. To 
do this what we would need to do is create a tag handler.

The tag handler would iterate over all the methods and collect all the ones 
with the particular attributes. Each method would be processed individually 
unless it had a "pair" (like a getter has a settter). Only one of these 
methods would be processed and a static variable to be set in handler that 
could be accessed via a "isReadWrite" tag or something. So the template would 
like 

<XDtMx:forAllAttributes> <!-- different -->
      <attribute
        name="<XDtMethod:propertyName/>"
        <XDtMethod:ifHasMethodTag tagName="phoenix:mx-description" >
        description="<XDtMethod:methodTagValue
                                       tagName="phoenix:mx-description" />"
        </XDtMethod:ifHasMethodTag>
        <XDtMethod:ifDoesntHaveMethodTag tagName="phoenix:mx-description" >
        description="<XDtMethod:methodComment no-comment-signs="true" />"
        </XDtMethod:ifDoesntHaveMethodTag>
        <XDtMx:ifReadable>isReadable="true"</XDtMx:ifReadable>
        <XDtMx:ifWriteable>isWriteable="true"</XDtMx:ifWriteable>          
        type="<XDtMethod:methodType/>"
      />
</XDtMx:forAllAttributes>

Anyways - there is an example TagHandler written in 

jakarta-avalon-excalibur/containerkit/src/java/org/apache/avalon/excalibur/containerkit/tools/xdoclet/AvalonTagHandler.java

which should help to get a start on it.

Huw - do you want to look into it or do you have a better idea on how we can 
fix it?


On Tue, 27 Aug 2002 08:43, Paul Hammant wrote:
> Peter, Huw,
>
> It seems that if there are two @phoenix:mx-attribute tags for the same
> attribute (as might be normal for a getter and setter), them MX4J lists
> the item twice.  I have had to work one of the two ambiguously as
> follows.  Thoughts?
>
> -ph
>
>   package org.apache.avalon.apps.demos.helloworldserver;
>   /**
>    * Specifies methods to export via Management interface.
>    *
>    * @phoenix:mx-topic name="Greeting"
>    *
>    * @author  Huw Roberts <huw@mmlive.com>
>    * @version 1.0
>    */
>   public interface HelloWorldServerMBean {
>       /**
>        * The greeting that is returned to each HTTP request
>        *
>        * @phoenix:mx-attribute
>        */
>       public void setGreeting( final String greeting );
>
>       /**
>        * Gets the greeting that is returned to each HTTP request
>        *
>        */
>       String getGreeting();
>   }

-- 
Cheers,

Peter Donald
------------------------------------------------------------
 militant agnostic: i don't know, and you don't know either.
------------------------------------------------------------ 


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


Mime
View raw message