![]() |
|||
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
| ||
Chapter 4Open MBeansOpen MBeans are dynamic MBeans, with specific constraints on their data types, that allow management applications and their human administrators to understand and use new managed objects as they are discovered at runtime. Open MBeans provide a flexible means of instrumenting resources which need to be open to a wide range of applications compliant with the Java Management Extensions (JMX) specification. To provide its own description to management applications, an open MBean must be a dynamic MBean, with the same behavior and functionality as a dynamic MBean. Thus it implements the DynamicMBean interface and no corresponding open MBean interface is required. The open functionality of open MBeans is obtained by providing descriptively rich metadata and by using exclusively certain predefined data types in the management interface. Because open MBeans build their data types from a predefined set of Java classes, a management application can manage an agent that uses open MBeans, without having to load Java classes specific to that agent. Furthermore, a JMX connector or adaptor only needs to be able to transport classes from the predefined set, not arbitrary Java classes. This means, for example, that a connector could use eXtensible Markup Language (XML) as its transport by defining an XML schema that covers the MBean server operations and the predefined open MBean data types. It also means that a management application could run in a language other than Java. The code samples in this chapter are taken from the files in the OpenMBean and OpenMBean2 example directories located in examplesDir/current (see "Directories and Classpath" in the Preface). This chapter covers the following topics:
4.1 Open MBean Data TypesOpen MBeans refer exclusively to a limited, predefined set of data types, which can be combined into compound types. 4.1.1 Supported Data TypesAll open MBean attributes, method return values, and method arguments must be limited to the set of open MBean data types listed in this section. This set is defined as: the wrapper objects that correspond to the Java primitive types (such as Integer, Long, Boolean), String, CompositeData, TabularData, and ObjectName. In addition, any array of the open MBean data types may be used in open MBeans. A special class, javax.management.openmbean.ArrayType is used to represent the definition of single or multi-dimensional arrays in open MBeans. The following list specifies all data types that are allowed as scalars or as any-dimensional arrays in open MBeans:
In addition the java.lang.Void type may be used, but only as the return type of an operation. 4.1.2 Type Descriptor ClassesOpen types are descriptor classes that describe the open MBean data types. To be able to manipulate the open MBean data types, management applications must be able to identify them. While primitive types are given by their wrapper class names, and arrays can be represented in a standard way, the complex data types need more structure than a flat string to represent their contents. Therefore open MBeans rely on description classes for all the open MBean data types, including special structures for describing complex data. The abstract OpenType class is the superclass for the following specialized open type classes:
The CompositeType, TabularType, and ArrayType classes are recursive, that is, they can contain instances of other open types. 4.2 Open Data InstancesAll of the wrapper classes for the primitive types are defined and implemented in all Java virtual machines, as is java.lang.String. The ObjectName class is provided by the implementation of the JMX specification. You can use the CompositeData and TabularData interfaces to define aggregates of the open MBean data types and provide a mechanism for expressing complex data objects in a consistent manner. All open data instances corresponding to the open MBean types defined in 4.1.1 Supported Data Types, except CompositeData and TabularData instances, are available through the classes of the Java 2 Platform, Standard Edition (J2SE) or JMX specification. | ||
| ||
![]() |