com.sun.jdmk
Class MetaDataImpl

java.lang.Object
  extended bycom.sun.jdmk.DynamicMetaDataImpl
      extended bycom.sun.jdmk.MetaDataImpl
All Implemented Interfaces:
MetaData

public class MetaDataImpl
extends DynamicMetaDataImpl

The MetaData class provides local access to the metadata service in an agent.

Since:
Java DMK 5.0

Field Summary
 
Fields inherited from class com.sun.jdmk.DynamicMetaDataImpl
instantiator
 
Method Summary
static Class findClassForPrim(String primName)
          Get the class of the constructed type corresponding to the given primitive type
static Constructor findConstructor(Class theClass, Class[] parameterTypes)
          Finds a specific constructor of a class Returns the requested constructor or null if not found
static Method findGetter(Class classObj, String attribute)
          Finds the getter of a specific attribute in an object.
static Method findMethod(Class classObj, String name)
          Finds a specific method of an object without knowing the parameter types.
static Method findMethod(Class classObj, String name, Class[] parameterTypes)
          Finds a specific method of an object.
static Method findMethod(Class classObj, String name, int paramCount)
          Finds a specific method of an object given the number of parameters.
static Class findPrimForClass(Object value)
          Get the class of the primitive type corresponding to the given constructed object.
static Method findSetter(Class classObj, String attribute)
          Finds the setter of a specific attribute without knowing its type.
static Method findSetter(Class classObj, String attribute, Class type)
          Finds the setter of a specific attribute in an object.
 Object getAttribute(Object instance, String attribute)
          Gets the value of a specific attribute of an MBean.
protected  Object getAttribute(Object instance, String attribute, Class mbeanClass)
          Invoke getAttribute through reflection on a standard MBean instance.
 AttributeList getAttributes(Object instance, String[] attributes)
          Enables the values of several attributes of an MBean.
 String getMBeanClassName(Object moi)
          This method returns the class name of an MBean.
 MBeanInfo getMBeanInfo(Object moi)
          This method discovers the attributes and operations that an MBean exposes for management.
 MBeanInfo getMBeanInfoFromClass(Class beanClass)
          This method discovers the attributes and operations that an MBean exposes for management.
 Class getMBeanInterfaceFromClass(Class c)
          This methods returns the MBean interface of an MBean
 Object invoke(Object instance, String operationName, Object[] params, String[] signature)
          Invokes an operation on an MBean.
 boolean isInstanceOf(Object instance, String className)
          Determine whether the given MBean is an instance of a given class/interface.
 Object setAttribute(Object instance, Attribute attribute)
          Sets the value of a specific attribute of an MBean.
protected  Object setAttribute(Object instance, Attribute attribute, Class mbeanClass)
          Invoke setAttribute through reflection on a standard MBean instance.
 AttributeList setAttributes(Object instance, AttributeList attributes)
          Sets the values of several attributes of an MBean.
 void testCompliance(Class c)
          This methods tests if the MBean is JMX compliant
 
Methods inherited from class com.sun.jdmk.DynamicMetaDataImpl
postDeregisterInvoker, postRegisterInvoker, preDeregisterInvoker, preRegisterInvoker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

testCompliance

public void testCompliance(Class c)
                    throws NotCompliantMBeanException
This methods tests if the MBean is JMX compliant

Specified by:
testCompliance in interface MetaData
Overrides:
testCompliance in class DynamicMetaDataImpl
Throws:
NotCompliantMBeanException

getMBeanInterfaceFromClass

public Class getMBeanInterfaceFromClass(Class c)
This methods returns the MBean interface of an MBean


getMBeanInfoFromClass

public MBeanInfo getMBeanInfoFromClass(Class beanClass)
                                throws IntrospectionException,
                                       NotCompliantMBeanException
This method discovers the attributes and operations that an MBean exposes for management.

Parameters:
beanClass - The class to be analyzed.
Returns:
An instance of MBeanInfo allowing to retrieve all methods and operations of this class.
Throws:
IntrospectionException - if an exception occurs during introspection.
NotCompliantMBeanException - if the MBean class is not MBean compliant.

findMethod

public static Method findMethod(Class classObj,
                                String name,
                                Class[] parameterTypes)
Finds a specific method of an object. Returns the method or null if not found


findMethod

public static Method findMethod(Class classObj,
                                String name)
Finds a specific method of an object without knowing the parameter types. Returns the method or null if not found


findMethod

public static Method findMethod(Class classObj,
                                String name,
                                int paramCount)
Finds a specific method of an object given the number of parameters. Returns the method or null if not found


findGetter

public static Method findGetter(Class classObj,
                                String attribute)
Finds the getter of a specific attribute in an object. Returns the method for accessing the attributes, null otherwise


findSetter

public static Method findSetter(Class classObj,
                                String attribute,
                                Class type)
Finds the setter of a specific attribute in an object. Returns the method for accessing the attribute, null otherwise


findSetter

public static Method findSetter(Class classObj,
                                String attribute)
Finds the setter of a specific attribute without knowing its type. Returns the method for accessing the attribute, null otherwise


findConstructor

public static Constructor findConstructor(Class theClass,
                                          Class[] parameterTypes)
Finds a specific constructor of a class Returns the requested constructor or null if not found


findClassForPrim

public static Class findClassForPrim(String primName)
Get the class of the constructed type corresponding to the given primitive type


findPrimForClass

public static Class findPrimForClass(Object value)
Get the class of the primitive type corresponding to the given constructed object.


getMBeanClassName

public String getMBeanClassName(Object moi)
                         throws IntrospectionException,
                                NotCompliantMBeanException
Description copied from interface: MetaData
This method returns the class name of an MBean.

Specified by:
getMBeanClassName in interface MetaData
Overrides:
getMBeanClassName in class DynamicMetaDataImpl
Throws:
IntrospectionException
NotCompliantMBeanException

getMBeanInfo

public MBeanInfo getMBeanInfo(Object moi)
                       throws IntrospectionException
Description copied from interface: MetaData
This method discovers the attributes and operations that an MBean exposes for management.

Specified by:
getMBeanInfo in interface MetaData
Overrides:
getMBeanInfo in class DynamicMetaDataImpl
Throws:
IntrospectionException

getAttribute

public Object getAttribute(Object instance,
                           String attribute)
                    throws MBeanException,
                           AttributeNotFoundException,
                           ReflectionException
Description copied from interface: MetaData
Gets the value of a specific attribute of an MBean.

Specified by:
getAttribute in interface MetaData
Overrides:
getAttribute in class DynamicMetaDataImpl
Throws:
MBeanException
AttributeNotFoundException
ReflectionException

getAttributes

public AttributeList getAttributes(Object instance,
                                   String[] attributes)
                            throws ReflectionException
Description copied from interface: MetaData
Enables the values of several attributes of an MBean.

Specified by:
getAttributes in interface MetaData
Overrides:
getAttributes in class DynamicMetaDataImpl
Throws:
ReflectionException

setAttributes

public AttributeList setAttributes(Object instance,
                                   AttributeList attributes)
                            throws ReflectionException
Description copied from interface: MetaData
Sets the values of several attributes of an MBean.

Specified by:
setAttributes in interface MetaData
Overrides:
setAttributes in class DynamicMetaDataImpl
Throws:
ReflectionException

setAttribute

public Object setAttribute(Object instance,
                           Attribute attribute)
                    throws AttributeNotFoundException,
                           InvalidAttributeValueException,
                           MBeanException,
                           ReflectionException
Description copied from interface: MetaData
Sets the value of a specific attribute of an MBean.

Specified by:
setAttribute in interface MetaData
Overrides:
setAttribute in class DynamicMetaDataImpl
Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException

invoke

public Object invoke(Object instance,
                     String operationName,
                     Object[] params,
                     String[] signature)
              throws MBeanException,
                     ReflectionException
Description copied from interface: MetaData
Invokes an operation on an MBean.

Specified by:
invoke in interface MetaData
Overrides:
invoke in class DynamicMetaDataImpl
Throws:
MBeanException
ReflectionException

isInstanceOf

public boolean isInstanceOf(Object instance,
                            String className)
                     throws ReflectionException
Description copied from interface: MetaData
Determine whether the given MBean is an instance of a given class/interface.

Specified by:
isInstanceOf in interface MetaData
Overrides:
isInstanceOf in class DynamicMetaDataImpl
Throws:
ReflectionException

getAttribute

protected Object getAttribute(Object instance,
                              String attribute,
                              Class mbeanClass)
                       throws MBeanException,
                              AttributeNotFoundException,
                              ReflectionException
Invoke getAttribute through reflection on a standard MBean instance.

Throws:
MBeanException
AttributeNotFoundException
ReflectionException

setAttribute

protected Object setAttribute(Object instance,
                              Attribute attribute,
                              Class mbeanClass)
                       throws AttributeNotFoundException,
                              InvalidAttributeValueException,
                              MBeanException,
                              ReflectionException
Invoke setAttribute through reflection on a standard MBean instance.

Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException

FCS Release
jdmk-5_1-b34.1 2005.02.10_16:46:09_MET

Copyright 1998-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.