|
From: Bordet, S. <Sim...@co...> - 2002-01-18 14:15:31
|
Hi Jerome,
> >1) there is a managed attribute "dummy", but no setDummy and=20
> getDummy in the MBean interface. Beware also of the fact that=20
> I can call the data member "m_dummy", does this impact the=20
> MBean interface (I don't want getm_dummy() ;) ? And also,=20
> beware of the fact that a "dummy" attribute *must* generate a=20
> getdummy() and setdummy(), not getDummy() and setDummy(). Can=20
> I specify if it's read-only ?
> >
> Ok. There are plenty of questions out there :-)
> First, as there is a diffence between a java field and a JMX=20
> attribute,=20
> where should we put the description?
> I think it should not be on the field itself because I am not sure it=20
> will be easy to check for the presence of the getter/setter methods.
> But then, should we put it on the getter or setter method? both=20
> (redundant information and possible mistakes -- don't like that)?
> Or we could put in the class javadoc and indicate something=20
> like that:=20
> "@openjmx:attribute name=3D"Dummy" description=3D"A dummy attribute". =
It=20
> would be up to the developer to implement the getDummy and setDummy=20
> methods. If the variable itself is m_dummy, then we don't care: the=20
> developer has to code the right stuff in the getter/setter methods.
>=20
> Regarding access-mode, i suggest we add another attribute on the=20
> "openjmx:attribute" tag such "access" or "access-mode" and=20
> the possible=20
> values would be "ro", "wo" or "both".
Ok, I thought some more on it, what about this ?
/**
* @openjmx:managed-attribute description=3D"The status of this MBean"
*/
public int getStatus() {return 0;}
/**
* @openjmx:managed-attribute
*/
public void setStatus(int status) {}
I specify always on getter the description information; I just put the =
tag on the setter so that it will appear in the MBean interface. I will =
do a small change to the code so that getters are always processed =
before setters, so setters can have no description; if the attribute is =
write-only, then the setter will have the description.
About access I don't care anymore.
> >3) setStatus is an attribute, not an operation.
> >
> As explained in 1) it would be up to the developer to specify=20
> that. If=20
> the "openjmx:attribute" tag is missing, the output will be wrong.
>=20
> > Is there a way to enforce check of this kind of mistakes ?=20
> If a method is described as operation, but it's an attribute,=20
> can i know this when I'm generating the code with XDoclet ?
> >
> This is linked to question 1). I will look for a way to check those=20
> things but I am not sure it will be so easy.
Should not be that difficult; you can copy/paste the method =
Utils.isAttributeGetter/Setter to know if a method is an attribute =
accessor; if you find the managed-operation tag on the method, emit a =
warning or an error. The opposite for operations.
> >If you have time, can you write a document on this beautiful=20
> feauture, when will be ready ?
> >If you don't have time just tell, we must absolutely write=20
> something about for users.
> >
> I guess I could, but english is not my native language, and I am not=20
> sure to be the best person for writing documentation: my=20
> english style=20
> is quite poor. I can however write a draft that someone could=20
> "re-style" i guess :-)
Too modest :)
Write it, I guess will be perfect.
Simon
|