javax.management.modelmbean
Class ModelMBeanInfoSupport

java.lang.Object
  |
  +--javax.management.MBeanInfo
        |
        +--javax.management.modelmbean.ModelMBeanInfoSupport

public class ModelMBeanInfoSupport

extends MBeanInfo

implements ModelMBeanInfo, java.io.Serializable

This class represents the meta data for ModelMBeans. Descriptors have been added on the meta data objects.

Java resources wishing to be manageable instatiate the ModelMBean using the MBeanServer's createMBean method. The resource then sets the ModelMBeanInfo and Descriptors for the ModelMBean instance. The attributes and operations exposed via the ModelMBeanInfo for the ModelMBean are accessible from Mbeans, connectors/adapters like other MBeans. Through the Descriptors, values and methods in the managed application can be defined and mapped to attributes and operations of the ModelMBean. This mapping can be defined during development in a file or dynamically and programmatically at runtime.

Every ModelMBean which is instantiated in the MBeanServer becomes manageable: its attributes and operations become remotely accessible through the connectors/adaptors connected to that MBeanServer. A Java object cannot be registered in the MBeanServer unless it is a JMX compliant MBean. By instantiating a ModelMBean, resources are guaranteed that the MBean is valid. MBeanException and RuntimeOperationsException must be thrown on every public method. This allows for wrappering exceptions from distributed communications (RMI, EJB, etc.)

Version:

1.15

Author:

Max Parlione, Massimo Tarquini, Marco De Gregorio

See Also:

Serialized Form

 

Constructor Summary

ModelMBeanInfoSupport(ModelMBeanInfo mbi)
    constructs a ModelMBeanInfoSupport which is a duplicate of the one passed in.
ModelMBeanInfoSupport(java.lang.String className, java.lang.String description, ModelMBeanAttributeInfo[] attributes, ModelMBeanConstructorInfo[] constructors, ModelMBeanOperationInfo[] operations, ModelMBeanNotificationInfo[] notifications)
    Creates a ModelMBeanInfoSupport with the provided information, but the descriptor is a default.
ModelMBeanInfoSupport(java.lang.String className, java.lang.String description, ModelMBeanAttributeInfo[] attributes, ModelMBeanConstructorInfo[] constructors, ModelMBeanOperationInfo[] operations, ModelMBeanNotificationInfo[] notifications, Descriptor mbeandescriptor)
    Creates a ModelMBeanInfoSupport with the provided information, but the descriptor is a default.
 

 

Method Summary

 java.lang.Object clone()
    returns a new ModelMBeanInfoSupport object that is a copy of this ModelMBeanInfoSupport.
 ModelMBeanAttributeInfo getAttribute(java.lang.String inName)
    Returns a ModelMBeanAttributeInfo requested by name.
 MBeanAttributeInfo[] getAttributes()
    Returns the list of attributes exposed for management as ModelMBeanAttributeInfo objects.
 ModelMBeanConstructorInfo getConstructor(java.lang.String inName)
    Returns a ModelMBeanConstructorInfo requested by name.
 MBeanConstructorInfo[] getConstructors()
    Returns the list of constructors exposed for management as ModelMBeanConstructorInfo objects.
 Descriptor getDescriptor(java.lang.String inDescriptorName)
    Returns a Descriptor requested by name
 Descriptor getDescriptor(java.lang.String inDescriptorName, java.lang.String inDescriptorType)
    Returns a Descriptor requested by name and descriptorType.
 Descriptor[] getDescriptors(java.lang.String inDescriptorType)
    Returns a DescriptorList.
 Descriptor getMBeanDescriptor()
    Returns the ModelMBean's descriptor which contains mbean wide policies.
 ModelMBeanNotificationInfo getNotification(java.lang.String inName)
    Returns a ModelMBeanNotificationInfo requested by name.
 MBeanNotificationInfo[] getNotifications()
    Returns the list of notifications exposed for management as ModelMBeanNotificationInfo objects.
 ModelMBeanOperationInfo getOperation(java.lang.String inName)
    Returns a ModelMBeanOperationInfo requested by name.
 MBeanOperationInfo[] getOperations()
    Returns the list of operations exposed for management as ModelMBeanOperationInfo objects.
 void setDescriptor(Descriptor inDescriptor, java.lang.String inDescriptorType)
    Adds or replaces a descriptor in the ModelMBeanInfoSupport.
 void setDescriptors(Descriptor[] inDescriptors)
    Adds or replaces descriptors in all the ModelMBeanInfoSupport for the ModelMBean.
 void setMBeanDescriptor(Descriptor inMBeanDescriptor)
    Sets the ModelMBean's descriptor.
 
Methods inherited from class javax.management.MBeanInfo
getClassName, getDescription
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

 

Constructor Detail

ModelMBeanInfoSupport

public ModelMBeanInfoSupport(ModelMBeanInfo mbi)

constructs a ModelMBeanInfoSupport which is a duplicate of the one passed in.

 

Parameters:

ModelMBeanInfo - mbi - the ModelMBeanInfo instance from which the ModelMBeanInfo being created is initialized.

ModelMBeanInfoSupport

public ModelMBeanInfoSupport(java.lang.String className,
                             java.lang.String description,
                             ModelMBeanAttributeInfo[] attributes,
                             ModelMBeanConstructorInfo[] constructors,
                             ModelMBeanOperationInfo[] operations,
                             ModelMBeanNotificationInfo[] notifications)

Creates a ModelMBeanInfoSupport with the provided information, but the descriptor is a default. The default descriptor is: name=mbeanName, descriptorType=mbean, displayName=this.getClassName(), persistPolicy=never,log=F,export=F,visiblity=1

 

Parameters:

className - classname of ModelMBeanInfo

description - human readable description of the ModelMBean

ModelMBeanAttributeInfo[] - attributes - array of ModelMBeanAttributeInfo objects which have descriptors

ModelMBeanConstructorInfo[] - constructors - array of ModelMBeanConstructorInfo objects which have descriptor

ModelMBeanOperationInfo[] - operations - array of ModelMBeanOperationInfo objects which have descriptor

ModelMBeanNotificationInfo[] - notifications - array of ModelMBeanNotificationInfo objects which have descriptor

ModelMBeanInfoSupport

public ModelMBeanInfoSupport(java.lang.String className,
                             java.lang.String description,
                             ModelMBeanAttributeInfo[] attributes,
                             ModelMBeanConstructorInfo[] constructors,
                             ModelMBeanOperationInfo[] operations,
                             ModelMBeanNotificationInfo[] notifications,
                             Descriptor mbeandescriptor)

Creates a ModelMBeanInfoSupport with the provided information, but the descriptor is a default.

 

Parameters:

className - classname of ModelMBeanInfo

description - human readable description of the ModelMBean

ModelMBeanAttributeInfo[] - attributes array of ModelMBeanAttributeInfo objects which have descriptors

ModelMBeanConstructorInfo[] - constructors array of ModelMBeanConstructorInfo objects which have descriptor

ModelMBeanOperationInfo[] - operations array of ModelMBeanOperationInfo objects which have descriptor

ModelMBeanNotificationInfo[] - notifications array of ModelMBeanNotificationInfo objects which have descriptor

MBeanDescriptor - descriptor to be used as the MBeanDescriptor containing mbean wide policy. if the descriptor is invalid or null, a default descriptor will be constructed. The default descriptor is: name=mbeanName,descriptorType=mbean, displayName=this.getClassName(), persistPolicy=never,log=F, export=F,visiblity=1. If the descriptor does not contain all these fields, they will be added with these default values.

 

Method Detail

clone

public java.lang.Object clone()

returns a new ModelMBeanInfoSupport object that is a copy of this ModelMBeanInfoSupport.

Specified by:

clone in interface ModelMBeanInfo

Overrides:

clone in class MBeanInfo

getDescriptors

public Descriptor[] getDescriptors(java.lang.String inDescriptorType)
                            throws MBeanException,
                                   RuntimeOperationsException

Returns a DescriptorList. It contains all Descriptors for the ModelMBean including the attributeDescriptors, operationDescriptors, and notificationDescriptors.

Specified by:

getDescriptors in interface ModelMBeanInfo

 

Parameters:

DescriptorType - descriptor type. The type of the descriptor.

 

Returns:

Descriptor array containing all descriptors for the ModelMBean

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception

setDescriptors

public void setDescriptors(Descriptor[] inDescriptors)
                    throws MBeanException,
                           RuntimeOperationsException

Adds or replaces descriptors in all the ModelMBeanInfoSupport for the ModelMBean.

Specified by:

setDescriptors in interface ModelMBeanInfo

 

Parameters:

DescriptorList - The descriptors to be set in the ModelMBean. All descriptors must have name and descriptorType fields and be valid. If the descriptor list is empty, no sets will occur. If it is null, an exception will be thrown. Null elements of the list will be ignored.

 

Throws:

RuntimeOperationsException - - Wraps exceptions for illegal or null arguments

getDescriptor

public Descriptor getDescriptor(java.lang.String inDescriptorName)
                         throws MBeanException,
                                RuntimeOperationsException

Returns a Descriptor requested by name

 

Parameters:

String - descriptorName The name of the descriptor.

 

Returns:

Descriptor containing the descriptor for the ModelMBean with the same name and descriptorType.

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception

getDescriptor

public Descriptor getDescriptor(java.lang.String inDescriptorName,
                                java.lang.String inDescriptorType)
                         throws MBeanException,
                                RuntimeOperationsException

Returns a Descriptor requested by name and descriptorType.

Specified by:

getDescriptor in interface ModelMBeanInfo

 

Parameters:

String - descriptorName The name of the descriptor.

String - descriptorType The type of the descriptor being requested. If this is null a RuntimeOperationsException will be thrown. Type must match that in the 'descriptorType' field on the Descriptor. It must be "mbean", "attribute", "operation", or "notification".

 

Returns:

Descriptor containing the descriptor for the ModelMBean with the same name and descriptorType.

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception

setDescriptor

public void setDescriptor(Descriptor inDescriptor,
                          java.lang.String inDescriptorType)
                   throws MBeanException,
                          RuntimeOperationsException

Adds or replaces a descriptor in the ModelMBeanInfoSupport.

Specified by:

setDescriptor in interface ModelMBeanInfo

 

Parameters:

inDescriptor - The descriptor to be set in the ModelMBean. If the descriptor to be set is null, no sets will be done. All descriptors must have name and descriptorType fields.

String - descriptorType The type of the descriptor being requested. If this is null then the value of the 'descriptorType' field in the inDescriptor will be used. Type must match that in the 'descriptorType' field on the Descriptor. It must be "mbean", "attribute", "operation", or "notification".

 

Throws:

RuntimeOperationsException - Wraps exceptions for illegal or null arguments

getAttribute

public ModelMBeanAttributeInfo getAttribute(java.lang.String inName)
                                     throws MBeanException,
                                            RuntimeOperationsException

Returns a ModelMBeanAttributeInfo requested by name.

Specified by:

getAttribute in interface ModelMBeanInfo

 

Parameters:

String - inName The name of the ModelMBeanAttributeInfo to get.

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception for invalid attribute name or ModelMBeanAttributeInfo to be returned.

getOperation

public ModelMBeanOperationInfo getOperation(java.lang.String inName)
                                     throws MBeanException,
                                            RuntimeOperationsException

Returns a ModelMBeanOperationInfo requested by name.

Specified by:

getOperation in interface ModelMBeanInfo

 

Parameters:

String - inName The name of the ModelMBeanOperationInfo to get.

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception for invalid attribute name or ModelMBeanAttributeInfo to be returned.

getConstructor

public ModelMBeanConstructorInfo getConstructor(java.lang.String inName)
                                         throws MBeanException,
                                                RuntimeOperationsException

Returns a ModelMBeanConstructorInfo requested by name. Specified by: getConstructor in interface ModelMBeanInfo

 

Parameters:

String - inName The name of the ModelMBeanConstructorInfo to get.

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception

getNotification

public ModelMBeanNotificationInfo getNotification(java.lang.String inName)
                                           throws MBeanException,
                                                  RuntimeOperationsException

Returns a ModelMBeanNotificationInfo requested by name.

Specified by:

getNotification in interface ModelMBeanInfo

 

Parameters:

String - inName The name of the ModelMBeanNotificationInfo to get.

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception

getAttributes

public MBeanAttributeInfo[] getAttributes()

Returns the list of attributes exposed for management as ModelMBeanAttributeInfo objects. This method signature must specify MBeanAttributeInfo to be compliant with the the DynamicMBean interface.

Specified by:

getAttributes in interface ModelMBeanInfo

Overrides:

getAttributes in class MBeanInfo

 

Returns:

MBeanAttributeInfo object array.

getOperations

public MBeanOperationInfo[] getOperations()

Returns the list of operations exposed for management as ModelMBeanOperationInfo objects. This method signature must specify MBeanOperationInfo to be compliant with the the DynamicMBean interface. Specified by: getOperations in interface ModelMBeanInfo Overrides: getOperations in class MBeanInfo

Specified by:

getOperations in interface ModelMBeanInfo

Overrides:

getOperations in class MBeanInfo

 

Returns:

MBeanOperationInfo object array.

getConstructors

public MBeanConstructorInfo[] getConstructors()

Returns the list of constructors exposed for management as ModelMBeanConstructorInfo objects. This method signature must specify MBeanConstructorInfo to be compliant with the the DynamicMBean interface. Specified by: getConstructors in interface ModelMBeanInfo Overrides: getConstructors in class MBeanInfo

Specified by:

getConstructors in interface ModelMBeanInfo

Overrides:

getConstructors in class MBeanInfo

 

Returns:

MBeanConstructorInfo object array.

getNotifications

public MBeanNotificationInfo[] getNotifications()

Returns the list of notifications exposed for management as ModelMBeanNotificationInfo objects. This method signature must specify MBeanNotificationInfo to be compliant with the the DynamicMBean interface.

Specified by:

getNotifications in interface ModelMBeanInfo

Overrides:

getNotifications in class MBeanInfo

 

Returns:

MBeanNotificationInfo object array.

getMBeanDescriptor

public Descriptor getMBeanDescriptor()
                              throws MBeanException,
                                     RuntimeOperationsException

Returns the ModelMBean's descriptor which contains mbean wide policies. This descriptor contains metadata about the MBean and default policies for persistence and caching.
 The fields in the descriptor are defined, but not limited to, the 
 following: 
 name           : mbean name  
 descriptorType : must be "mbean"   
 displayName    : name of attribute to be used in displays 
 persistPolicy  : OnUpdate|OnTimer|NoMoreOftenThan|Always|Never  
 persistLocation : The fully qualified directory name where the MBean should
 be persisted (if appropriate)
 persistFile    : File name into which the MBean should be persisted
 persistPeriod  : seconds - frequency of persist cycle for OnTime and 
                  NoMoreOftenThan PersistPolicy 
 persistLocation : directory name in which to store mbeans that support the 
                   PersistentMBean interface
 currencyTimeLimit : how long value is valid, <0 never, =0 always, >0 
                     seconds  
 log            : where t: log all notifications f: log no notifications
 logfile        : fully qualified filename to log events to
 visibility     : 1-4 where 1: always visible 4: rarely visible
 export         : name to be used to export/expose this MBean so that it is 
                  findable by other JMX Agents.   
 presentationString : xml formatted string to allow presentation of data to
                      be associated with the MBean. 
 
The default descriptor is: name=mbeanName,descriptorType=mbean, displayName=this.getClassName(), persistPolicy=never,log=F,export=F, visiblity=1 If the descriptor does not contain all these fields, they will be added with these default values. Specified by: getMBeanDescriptor in interface ModelMBeanInfo

Specified by:

getMBeanDescriptor in interface ModelMBeanInfo

 

Throws:

MBeanException - - Wraps another exception

RuntimeOperationsException - - Wraps another exception

setMBeanDescriptor

public void setMBeanDescriptor(Descriptor inMBeanDescriptor)
                        throws MBeanException,
                               RuntimeOperationsException

Sets the ModelMBean's descriptor. This descriptor contains default, mbean wide metadata about the MBean and default policies for persistence and caching. This operation does a complete replacement of the descriptor, no merging is done. If the descriptor to set to is invalid then the existing or default descriptor will be preserved. The default descriptor is: name=mbeanName,descriptorType=mbean, displayName=this.getClassName(), persistPolicy=never,log=F,export=F,visiblity=1 If the descriptor does not contain all these fields, they will be added with these default values. See getMBeanDescriptor method javadoc for description of valid field names.

Specified by:

setMBeanDescriptor in interface ModelMBeanInfo

 

Throws:

MBeanException - Wraps another exception

RuntimeOperationsException - Wraps another exception for bad descriptor