org.progeeks.jmx
Class MBeanUtils

java.lang.Object
  extended by org.progeeks.jmx.MBeanUtils

public class MBeanUtils
extends java.lang.Object

Utility methods for JMX MBeans.

Version:
$Revision: 1.8 $
Author:
Paul Speed

Field Summary
static java.lang.String META_CLASS_NAME
          The constant string used as the key in ObjectNames that contain a meta-class reference as a property.
 
Constructor Summary
MBeanUtils()
           
 
Method Summary
static MetaClass createMBeanMetaClass(MetaClassRegistry classRegistry, javax.management.ObjectName objectName, javax.management.MBeanInfo beanInfo)
          Creates a MetaClass from the specified ObjectName and MBeanInfo object.
static MetaClass createMBeanMetaClass(javax.management.ObjectName objectName, javax.management.MBeanInfo beanInfo)
          Creates a MetaClass from the specified ObjectName and MBeanInfo object.
static MetaObject createMBeanMetaObject(MetaClassRegistry classRegistry, javax.management.ObjectName objectName, MBeanMetaKit metaKit)
          Convenience method for creating a MetaObject wrapper for the specified ObjectName.
static MetaObject createMBeanMetaObject(javax.management.ObjectName objectName, MBeanMetaKit metaKit)
          Convenience method for creating a MetaObject wrapper for the specified ObjectName.
static MetaObject createMetaClassTemplate(javax.management.MBeanInfo beanInfo, boolean resolveTypes)
          Creates a MetaClass template MetaObject for the specified MBeanInfo.
static MetaObject createMetaClassTemplate(javax.management.MBeanInfo beanInfo, boolean resolveTypes, MetaClassRegistry classRegistry)
          Creates a MetaClass template MetaObject for the specified MBeanInfo.
static javax.management.ObjectName createObjectName(java.lang.String domain, MetaClass mClass, java.util.Map properties)
          Constructs an ObjectName instance for the specified domain and MetaClass.
static javax.management.ObjectName createObjectName(java.lang.String domain, MetaObject mObject)
          Constructs an ObjectName instance for the specified domain and MetaObject.
static javax.management.ObjectName createObjectName(java.lang.String domain, MetaObject mObject, java.util.Map properties)
          Constructs an ObjectName instance for the specified domain and MetaObject.
static java.util.List getMBeanPropertyInfos(javax.management.MBeanInfo beanInfo, boolean resolveTypes)
          Creates a list of PropertyInfo objects representing the attributes defined in the specified MBeanInfo.
static java.util.List getMBeanPropertyInfos(MetaClassRegistry classRegistry, javax.management.MBeanInfo beanInfo, boolean resolveTypes)
          Creates a list of PropertyInfo objects representing the attributes defined in the specified MBeanInfo.
static java.lang.String getMetaClassName(javax.management.ObjectName objectName)
          Returns a default generated class name for the specified ObjectName.
protected static PropertyType getPropertyType(java.lang.Class type, MetaClassRegistry classRegistry, boolean resolveTypes)
          Returns an appropriate PropertyType for the specified Java class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_CLASS_NAME

public static final java.lang.String META_CLASS_NAME
The constant string used as the key in ObjectNames that contain a meta-class reference as a property.

See Also:
Constant Field Values
Constructor Detail

MBeanUtils

public MBeanUtils()
Method Detail

createObjectName

public static javax.management.ObjectName createObjectName(java.lang.String domain,
                                                           MetaObject mObject)
                                                    throws javax.management.MalformedObjectNameException
Constructs an ObjectName instance for the specified domain and MetaObject. This uses only the identity properties of the meta-object for the ObjectName properties.

Throws:
javax.management.MalformedObjectNameException

createObjectName

public static javax.management.ObjectName createObjectName(java.lang.String domain,
                                                           MetaObject mObject,
                                                           java.util.Map properties)
                                                    throws javax.management.MalformedObjectNameException
Constructs an ObjectName instance for the specified domain and MetaObject. If a properties object is specified then those values are included in addition to any identity properties supplied by the meta-object.

Throws:
javax.management.MalformedObjectNameException

createObjectName

public static javax.management.ObjectName createObjectName(java.lang.String domain,
                                                           MetaClass mClass,
                                                           java.util.Map properties)
                                                    throws javax.management.MalformedObjectNameException
Constructs an ObjectName instance for the specified domain and MetaClass. If a properties object is specified then those values are included along with the meta-class name.

Throws:
javax.management.MalformedObjectNameException

getMetaClassName

public static java.lang.String getMetaClassName(javax.management.ObjectName objectName)
Returns a default generated class name for the specified ObjectName. This generation uses the same strategy as the simple createMBeanMetaClass methods.


createMBeanMetaClass

public static MetaClass createMBeanMetaClass(javax.management.ObjectName objectName,
                                             javax.management.MBeanInfo beanInfo)
Creates a MetaClass from the specified ObjectName and MBeanInfo object. This is the simplest and most straight-forward way to create a MetaClass for an MBean but it offers little flexibility in how the meta-class is constructed. Basically, the class name will be the object name so that it is unique and the class properties will be a direct interpretation of the MBeanInfo attributes.


createMBeanMetaClass

public static MetaClass createMBeanMetaClass(MetaClassRegistry classRegistry,
                                             javax.management.ObjectName objectName,
                                             javax.management.MBeanInfo beanInfo)
Creates a MetaClass from the specified ObjectName and MBeanInfo object. This is the simplest and most straight-forward way to create a MetaClass for an MBean but it offers little flexibility in how the meta-class is constructed. Basically, the class name will be the object name so that it is unique and the class properties will be a direct interpretation of the MBeanInfo attributes.


createMBeanMetaObject

public static MetaObject createMBeanMetaObject(javax.management.ObjectName objectName,
                                               MBeanMetaKit metaKit)
Convenience method for creating a MetaObject wrapper for the specified ObjectName. If the meta-class for the specified ObjectName doesn't already exist then this method will create one using the createMBeanMetaClass() method.


createMBeanMetaObject

public static MetaObject createMBeanMetaObject(MetaClassRegistry classRegistry,
                                               javax.management.ObjectName objectName,
                                               MBeanMetaKit metaKit)
Convenience method for creating a MetaObject wrapper for the specified ObjectName. If the meta-class for the specified ObjectName doesn't already exist then this method will create one using the createMBeanMetaClass() method.


getMBeanPropertyInfos

public static java.util.List getMBeanPropertyInfos(javax.management.MBeanInfo beanInfo,
                                                   boolean resolveTypes)
                                            throws LocalClassNotFoundException
Creates a list of PropertyInfo objects representing the attributes defined in the specified MBeanInfo. The context class registry will be used for any meta-class resolution.

Throws:
LocalClassNotFoundException - if the type of an attribute cannot be resolved in the local context class loader.

getPropertyType

protected static PropertyType getPropertyType(java.lang.Class type,
                                              MetaClassRegistry classRegistry,
                                              boolean resolveTypes)
Returns an appropriate PropertyType for the specified Java class.


getMBeanPropertyInfos

public static java.util.List getMBeanPropertyInfos(MetaClassRegistry classRegistry,
                                                   javax.management.MBeanInfo beanInfo,
                                                   boolean resolveTypes)
                                            throws LocalClassNotFoundException
Creates a list of PropertyInfo objects representing the attributes defined in the specified MBeanInfo.

Throws:
LocalClassNotFoundException - if the type of an attribute cannot be resolved in the local context class loader.

createMetaClassTemplate

public static MetaObject createMetaClassTemplate(javax.management.MBeanInfo beanInfo,
                                                 boolean resolveTypes)
Creates a MetaClass template MetaObject for the specified MBeanInfo. This MetaObject will contain all of the properties necessary to create a real meta-class later. These can almost never be used without modification though since a single MBean server can potentially define several different MBeanInfos that use the same class name.


createMetaClassTemplate

public static MetaObject createMetaClassTemplate(javax.management.MBeanInfo beanInfo,
                                                 boolean resolveTypes,
                                                 MetaClassRegistry classRegistry)
Creates a MetaClass template MetaObject for the specified MBeanInfo. This MetaObject will contain all of the properties necessary to create a real meta-class later. These can almost never be used without modification though since a single MBean server can potentially define several different MBeanInfos that use the same class name.



Copyright © 2002-2003 Paul Speed. All Rights Reserved.