Java Reference
In-Depth Information
Table 7.4
Operation-level descriptor attributes
(continued)
Descriptor attribute
Possible values
Description
Class containing the method
Class where the method is defined
class
getter
,
setter
,
opera-
tion
,
constructor
Role of this operation
role
Object
value
Object on which to execute this
operation
targetObject
ObjectReference
,
EJBHan-
dle
,
IOR
,
RMIReference
Type of
Object
held in the
target-
Object
attribute
targetType
User-defined
Name used for display purposes
displayName
Return value of the method
Cached return value for this operation
lastReturnedValue
Same as attribute level
How long the return value is valid
currencyTimeLimit
long
value
Timestamp of the last returned value
lastReturnedTimeStamp
1
to
4
Same as MBean level
visibility
XML format
Same as MBean level
presentationString
Let's examine the new descriptor attributes that help describe the exposed oper-
ation:
class
,
role
,
targetObject
, and
targetType
. The first two are simple
enough:
class
contains the class name that defines this method, and
role
indi-
cates the purpose of the method (setter, getter, operation, or constructor). The
targetObject
and
targetType
attributes are used to specify an object other than
the Model MBean's managed resource in which to invoke the operation. This
optional mechanism is useful if you want to delegate processing to other objects,
or if you have such a distributed resource that you want to spread out operations
among different application components. Currently, the Sun
RI
only supports
the
ObjectReference
targetType
.
Operations for attributes
When exposing an attribute in a Model MBean, you optionally specify the meth-
ods used as its getter and setter in the managed resource. Because methods
invoked from a Model MBean can have configurable behavior, Model MBeans
expect these getter and setter methods to be added to their
ModeMBeanInfo
objects with operation metadata. Therefore, when adding an attribute, you may
also be adding two additional operations. You will see this in the example at the
end of the chapter.