Java Reference
In-Depth Information
Figure 11.1
A controller application
maintains the state of
phone and fax cards.
class. Because your environment can have more than one phone card, each
Phone-
Card
MBean will have a unique card id. In this case, you will use an integer to
represent the slot number for the phone card. This example will use two
Phone-
Card
MBeans.
For fax cards, you will define the
FaxCard
class. You can have only one fax card
present in a deployment, and it will be represented by a
FaxCard
MBean. With
only one fax card to manage, this MBean does not need any special identifiers.
Both the phone and fax card MBeans will have a single exposed method
called
disable()
. This method prevents the card from sending or receiving calls
or faxes.
Managing a routing table
Keep in mind that upon disabling either type of card, you'll need to notify the
controller application that it should no longer attempt to route calls to or from
the disabled card. To do so, you will expose a routing table MBean for disabling
the route. The
RoutingTable
MBean will expose two important operations. The
first operation allows the removal of the routing information for one of the
phone cards; it will accept an integer representing the phone card slot. The sec-
ond operation removes a fax card route from use.
11.2.2
The phone system management example
We have defined the system: it consists of some hardware devices and a compo-
nent of a software application. For the relation example you'll create, assume
that this
JMX
environment already exists. There are two
PhoneCard
MBeans and