Getting Started with the Java Dynamic Management Kit 4.0

Creating New MBeans/Adapting Existing Resources

As discussed earlier in "Key Concepts", MBeans conform to the JMX specification, which formalizes the representation of the MBean's management interface. Management interfaces are represented as attributes and operations which you can invoke. You must create new MBeans which adhere to the design patterns for exposing these attributes, specified by JMX. The design patterns for developing MBeans are specific to the MBean model, and are defined to ease the interaction between objects and the MBean server. You may also select MBeans from those included in the toolkit and customize them, using a Java Development Environment in order to generate MBeans for the services you require.

Attributes define the appearance or behavior of an MBean or are attributes of the managed resource that the MBean represents. For example, an attribute named ipackets in an MBean representing an Ethernet driver could be defined to represent the number of incoming packets. Attributes can have arbitrary types, including built-in Java types, and class or interface types such as java.awt.Color.

Attributes are always accessed via operation calls on the object that owns them. For readable attributes, there is a getter operation to read the attribute value. For writable attributes, there is a setter operation to allow the attribute value to be updated.

By default, the following design pattern is used for identifying attributes:

public attributeType getattributeName();
public void setattributeName(attributeType value);

If a class definition contains a matching pair of getattributeName() and setattributeName() operations these operations define a read-write attribute. If a class definition contains only one of these operations the operation defines either a read-only or write-only attribute called attributeName.