- java.lang.Object
-
- javax.management.MBeanInfo
-
- All Implemented Interfaces:
Serializable,Cloneable,DescriptorRead
- Direct Known Subclasses:
ModelMBeanInfoSupport,OpenMBeanInfoSupport
public class MBeanInfo extends Object implements Cloneable, Serializable, DescriptorRead
Describes the management interface exposed by an MBean; that is, the set of attributes and operations which are available for management operations. Instances of this class are immutable. Subclasses may be mutable but this is not recommended.
Usually the
MBeanInfofor any given MBean does not change over the lifetime of that MBean. Dynamic MBeans can change theirMBeanInfoand in that case it is recommended that they emit aNotificationwith a type of"jmx.mbean.info.changed"and a userData that is the newMBeanInfo. This is not required, but provides a conventional way for clients of the MBean to discover the change. See also the immutableInfo and infoTimeout fields in theMBeanInfoDescriptor.The contents of the
MBeanInfofor a Dynamic MBean are determined by itsgetMBeanInfo()method. This includes Open MBeans and Model MBeans, which are kinds of Dynamic MBeans.The contents of the
MBeanInfofor a Standard MBean are determined by the MBean server as follows:getClassName()returns the Java class name of the MBean object;getConstructors()returns the list of all public constructors in that object;getAttributes()returns the list of all attributes whose existence is deduced from the presence in the MBean interface of agetName,isName, orsetNamemethod that conforms to the conventions for Standard MBeans;getOperations()returns the list of all methods in the MBean interface that do not represent attributes;getNotifications()returns an empty array if the MBean does not implement theNotificationBroadcasterinterface, otherwise the result of callingNotificationBroadcaster.getNotificationInfo()on it;getDescriptor()returns a descriptor containing the contents of any descriptor annotations in the MBean interface (see@DescriptorKey).
The description returned by
getDescription()and the descriptions of the contained attributes and operations are not specified.The remaining details of the
MBeanInfofor a Standard MBean are not specified. This includes the description of any contained constructors, and notifications; the names of parameters to constructors and operations; and the descriptions of constructor parameters.- Since:
- 1.5
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MBeanInfo(String className, String description, MBeanAttributeInfo[] attributes, MBeanConstructorInfo[] constructors, MBeanOperationInfo[] operations, MBeanNotificationInfo[] notifications)Constructs anMBeanInfo.MBeanInfo(String className, String description, MBeanAttributeInfo[] attributes, MBeanConstructorInfo[] constructors, MBeanOperationInfo[] operations, MBeanNotificationInfo[] notifications, Descriptor descriptor)Constructs anMBeanInfo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Returns a shallow clone of this instance.booleanequals(Object o)Compare this MBeanInfo to another.MBeanAttributeInfo[]getAttributes()Returns the list of attributes exposed for management.StringgetClassName()Returns the name of the Java class of the MBean described by thisMBeanInfo.MBeanConstructorInfo[]getConstructors()Returns the list of the public constructors of the MBean.StringgetDescription()Returns a human readable description of the MBean.DescriptorgetDescriptor()Get the descriptor of this MBeanInfo.MBeanNotificationInfo[]getNotifications()Returns the list of the notifications emitted by the MBean.MBeanOperationInfo[]getOperations()Returns the list of operations of the MBean.
-
-
-
Constructor Detail
-
MBeanInfo
public MBeanInfo(String className, String description, MBeanAttributeInfo[] attributes, MBeanConstructorInfo[] constructors, MBeanOperationInfo[] operations, MBeanNotificationInfo[] notifications) throws IllegalArgumentException
Constructs anMBeanInfo.- Parameters:
className- The name of the Java class of the MBean described by thisMBeanInfo. This value may be any syntactically legal Java class name. It does not have to be a Java class known to the MBean server or to the MBean's ClassLoader. If it is a Java class known to the MBean's ClassLoader, it is recommended but not required that the class's public methods include those that would appear in a Standard MBean implementing the attributes and operations in this MBeanInfo.description- A human readable description of the MBean (optional).attributes- The list of exposed attributes of the MBean. This may be null with the same effect as a zero-length array.constructors- The list of public constructors of the MBean. This may be null with the same effect as a zero-length array.operations- The list of operations of the MBean. This may be null with the same effect as a zero-length array.notifications- The list of notifications emitted. This may be null with the same effect as a zero-length array.- Throws:
IllegalArgumentException
-
MBeanInfo
public MBeanInfo(String className, String description, MBeanAttributeInfo[] attributes, MBeanConstructorInfo[] constructors, MBeanOperationInfo[] operations, MBeanNotificationInfo[] notifications, Descriptor descriptor) throws IllegalArgumentException
Constructs anMBeanInfo.- Parameters:
className- The name of the Java class of the MBean described by thisMBeanInfo. This value may be any syntactically legal Java class name. It does not have to be a Java class known to the MBean server or to the MBean's ClassLoader. If it is a Java class known to the MBean's ClassLoader, it is recommended but not required that the class's public methods include those that would appear in a Standard MBean implementing the attributes and operations in this MBeanInfo.description- A human readable description of the MBean (optional).attributes- The list of exposed attributes of the MBean. This may be null with the same effect as a zero-length array.constructors- The list of public constructors of the MBean. This may be null with the same effect as a zero-length array.operations- The list of operations of the MBean. This may be null with the same effect as a zero-length array.notifications- The list of notifications emitted. This may be null with the same effect as a zero-length array.descriptor- The descriptor for the MBean. This may be null which is equivalent to an empty descriptor.- Throws:
IllegalArgumentException- Since:
- 1.6
-
-
Method Detail
-
clone
public Object clone()
Returns a shallow clone of this instance. The clone is obtained by simply calling
super.clone(), thus calling the default native shallow cloning mechanism implemented byObject.clone(). No deeper cloning of any internal field is made.Since this class is immutable, the clone method is chiefly of interest to subclasses.
-
getClassName
public String getClassName()
Returns the name of the Java class of the MBean described by thisMBeanInfo.- Returns:
- the class name.
-
getDescription
public String getDescription()
Returns a human readable description of the MBean.- Returns:
- the description.
-
getAttributes
public MBeanAttributeInfo[] getAttributes()
Returns the list of attributes exposed for management. Each attribute is described by anMBeanAttributeInfoobject. The returned array is a shallow copy of the internal array, which means that it is a copy of the internal array of references to theMBeanAttributeInfoobjects but that each referencedMBeanAttributeInfoobject is not copied.- Returns:
- An array of
MBeanAttributeInfoobjects.
-
getOperations
public MBeanOperationInfo[] getOperations()
Returns the list of operations of the MBean. Each operation is described by anMBeanOperationInfoobject. The returned array is a shallow copy of the internal array, which means that it is a copy of the internal array of references to theMBeanOperationInfoobjects but that each referencedMBeanOperationInfoobject is not copied.- Returns:
- An array of
MBeanOperationInfoobjects.
-
getConstructors
public MBeanConstructorInfo[] getConstructors()
Returns the list of the public constructors of the MBean. Each constructor is described by an
MBeanConstructorInfoobject.The returned array is a shallow copy of the internal array, which means that it is a copy of the internal array of references to the
MBeanConstructorInfoobjects but that each referencedMBeanConstructorInfoobject is not copied.The returned list is not necessarily exhaustive. That is, the MBean may have a public constructor that is not in the list. In this case, the MBean server can construct another instance of this MBean's class using that constructor, even though it is not listed here.
- Returns:
- An array of
MBeanConstructorInfoobjects.
-
getNotifications
public MBeanNotificationInfo[] getNotifications()
Returns the list of the notifications emitted by the MBean. Each notification is described by anMBeanNotificationInfoobject. The returned array is a shallow copy of the internal array, which means that it is a copy of the internal array of references to theMBeanNotificationInfoobjects but that each referencedMBeanNotificationInfoobject is not copied.- Returns:
- An array of
MBeanNotificationInfoobjects.
-
getDescriptor
public Descriptor getDescriptor()
Get the descriptor of this MBeanInfo. Changing the returned value will have no affect on the original descriptor.- Specified by:
getDescriptorin interfaceDescriptorRead- Returns:
- a descriptor that is either immutable or a copy of the original.
- Since:
- 1.6
-
equals
public boolean equals(Object o)
Compare this MBeanInfo to another. Two MBeanInfo objects are equal if and only if they return equal values for
getClassName(), forgetDescription(), and forgetDescriptor(), and the arrays returned by the two objects forgetAttributes(),getOperations(),getConstructors(), andgetNotifications()are pairwise equal. Here "equal" meansObject.equals(Object), not identity.If two MBeanInfo objects return the same values in one of their arrays but in a different order then they are not equal.
- Overrides:
equalsin classObject- Parameters:
o- the object to compare to.- Returns:
- true if and only if
ois an MBeanInfo that is equal to this one according to the rules above. - See Also:
Object.hashCode()
-
-