Java Reference
In-Depth Information
methods and attributes exposed by the CopierPrinterMBean interface will be con-
sidered part of the management interface.
4.3.4
Extending the management interface
As you know, Java interfaces can extend other Java interfaces. This scenario pre-
sents the case when an MBean interface extends another MBean interface. The
resulting management interface exposed is the combined methods of both inter-
faces. Figure 4.4 illustrates this concept with the Printer MBean.
Just as in the previous scenario, the Printer MBean can implement only a
single MBean interface. However, the PrinterMBean interface can extend other
MBean interfaces, adding more management capability. In this scenario, the
Printer class is a PrinterMBean , not a DeviceMBean . This MBean's management
interface includes the methods and attributes exposed by both the DeviceMBean
and PrinterMBean interfaces, because a JMX agent will consider them part of the
single MBean interface, PrinterMBean , implemented by the Printer class.
4.3.5
Combination of extending and overriding
By combining the last few scenarios, you can create the case shown in figure 4.5.
Looking at the figure, you can see that the CopierPrinter class inherits its
management interface and implements its own MBean interface. In addition, the
CopierPrinterMBean interface extends the PrinterMBean interface. The resulting
management interface in this case is the same as the previous scenario. The man-
agement interface is always taken from the most closely related MBean interface.
This means that if an MBean interface is implemented directly, it takes prece-
dence over an inherited one. However, because CopierPrinterMBean extends
Figure 4.4
Creating an MBean interface by
extending an existing MBean
interface. The Printer MBean
management interface is
composed of the methods from
both the DeviceMBean and
PrinterMBean interfaces.
Search WWH ::




Custom Search