-
1. Re: Differences about invoke and getAttribute() ?
squirest Apr 25, 2002 5:51 AM (in response to vad)Hmmm...
I wrote a long explanation of this ages ago and now I can't find it...
The difference is that just because you have an attribute called MyAttr you cannot assume that there is a getter method called getMyAttr. Nor can you even assume that there is a getter/setter method at all (because of ModelMBeans by the way).
You should only call invoke() for operations listed in the MBeanInfo.
HTH
Trevor -
2. Re: Differences about invoke and getAttribute() ?
vad Apr 25, 2002 7:13 AM (in response to vad)Thanks for your quick answer.
> The difference is that just because you have an
> attribute called MyAttr you cannot assume that there
> is a getter method called getMyAttr. Nor can you
> even assume that there is a getter/setter method at
> all (because of ModelMBeans by the way)
OK, but if I know they exist?...
> You should only call invoke() for operations listed
> in the MBeanInfo.
My MBean are just basic ones, do you mean I should write (or maybe generate via some xdoclet stuff?) MBeanInfo classes for each of them?
Vad -
3. Re: Differences about invoke and getAttribute() ?
squirest Apr 25, 2002 7:49 AM (in response to vad)> OK, but if I know they exist?...
You know the methods exist but you're relying on the StandardMBean naming conventions (right?) to convert your XXXMBean interface into MBeanInfo.
You should consider that (as of the current spec) the MBeanServer can only act according to an MBean's MBeanInfo.
> My MBean are just basic ones, do you mean I should
> write (or maybe generate via some xdoclet stuff?)
> MBeanInfo classes for each of them?
Yes, if you want more control over what attributes and operations you want to expose then yes, you either write a DynamicMBean or you wrap your managed resource with a ModelMBean (XMBean using xdoclet as you say).
Trev