FileDocCategorySizeDatePackage
MetaDataImpl.javaAPI DocJava SE 5 API9661Fri Aug 26 14:55:00 BST 2005com.sun.jmx.mbeanserver

MetaDataImpl

public class MetaDataImpl extends Object implements MetaData
The MetaData class provides local access to the metadata service in an agent.
since
1.5
since.unbundled
JMX RI 1.2

Fields Summary
private static final String
dbgTag
The name of this class to be used for tracing
private final DynamicMetaDataImpl
dynamic
MetaData for DynamicMBeans
private final StandardMetaDataImpl
standard
protected final MBeanInstantiator
instantiator
The MBeanInstantiator associated to the MetaData
Constructors Summary
public MetaDataImpl(MBeanInstantiator instantiator)
Creates a Metadata Service.

param
instantiator The MBeanInstantiator that will be used to take care of class loading issues. This parameter may not be null.
exception
IllegalArgumentException if the instantiator is null.

	if (instantiator == null) throw new 
	    IllegalArgumentException("instantiator must not be null.");
	this.instantiator = instantiator;
	this.dynamic  = new PrivateDynamicMeta();
	this.standard = new PrivateStandardMeta();
	// ------------------------------ 
	// ------------------------------ 
    
Methods Summary
private static voiddebug(java.lang.String clz, java.lang.String func, java.lang.String info)

        Trace.send(Trace.LEVEL_DEBUG, Trace.INFO_MBEANSERVER, clz, func, info);
    
private static voiddebug(java.lang.String func, java.lang.String info)

        debug(dbgTag, func, info);
    
private static voiddebugX(java.lang.String func, java.lang.Throwable e)

	if (isDebugOn()) {
	    final StringWriter s = new StringWriter();
	    e.printStackTrace(new PrintWriter(s));
	    final String stack = s.toString();
	    
	    debug(dbgTag,func,"Exception caught in "+ func+"(): "+e);
	    debug(dbgTag,func,stack);
	
	    // java.lang.System.err.println("**** Exception caught in "+
	    // 			     func+"(): "+e);
	    // java.lang.System.err.println(stack);
	}
    
protected java.lang.ClassfindClass(java.lang.String className, java.lang.ClassLoader loader)
Find a class using the specified ClassLoader.

	return instantiator.findClass(className, loader);
    
protected java.lang.Class[]findSignatureClasses(java.lang.String[] signature, java.lang.ClassLoader loader)
Find the classes from a signature using the specified ClassLoader.

	return ((signature == null)?null:
		instantiator.findSignatureClasses(signature,loader));
    
public final java.lang.ObjectgetAttribute(java.lang.Object instance, java.lang.String attribute)

	
	final  MetaData meta = getMetaData(instance);
	return meta.getAttribute(instance,attribute);
    
public final javax.management.AttributeListgetAttributes(java.lang.Object instance, java.lang.String[] attributes)


	final  MetaData meta = getMetaData(instance);
	return meta.getAttributes(instance, attributes);
    
public final java.lang.StringgetMBeanClassName(java.lang.Object moi)

	final  MetaData meta = getMetaData(moi);
	return meta.getMBeanClassName(moi);
    
public final javax.management.MBeanInfogetMBeanInfo(java.lang.Object moi)

	final  MetaData meta = getMetaData(moi);
	return meta.getMBeanInfo(moi);
    
public javax.management.MBeanInfogetMBeanInfoFromClass(java.lang.Class beanClass)
This method discovers the attributes and operations that an MBean exposes for management.

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

	return standard.getMBeanInfoFromClass(beanClass);
    
public java.lang.ClassgetMBeanInterfaceFromClass(java.lang.Class c)
This methods returns the MBean interface of an MBean

	return standard.getMBeanInterfaceFromClass(c);
    
protected MetaDatagetMetaData(java.lang.Class c)

	if (DynamicMBean.class.isAssignableFrom(c)) 
	    return dynamic;
	else
	    return standard;
    
protected MetaDatagetMetaData(java.lang.Object moi)

	if (moi instanceof DynamicMBean) 
	    return dynamic;
	else
	    return standard;
    
public final java.lang.Objectinvoke(java.lang.Object instance, java.lang.String operationName, java.lang.Object[] params, java.lang.String[] signature)


        if (operationName == null) {
	    final RuntimeException r = 
	      new IllegalArgumentException("Operation name cannot be null");
            throw new RuntimeOperationsException(r, 
              "Exception occured trying to invoke the operation on the MBean");
        } 
	final  MetaData meta = getMetaData(instance);
	return meta.invoke(instance,operationName,params,signature);
    
private static booleanisDebugOn()

        return Trace.isSelected(Trace.LEVEL_DEBUG, Trace.INFO_MBEANSERVER);
    
public booleanisInstanceOf(java.lang.Object instance, java.lang.String className)


	// XXX revisit here: ModelMBean ???
	final MetaData meta  = getMetaData(instance);
	return meta.isInstanceOf(instance,className);
    
private static booleanisTraceOn()

        return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_MBEANSERVER);
    
public voidpostDeregisterInvoker(java.lang.Object moi)

	if (!(moi instanceof MBeanRegistration)) return;
	final MetaData meta  = getMetaData(moi);
	meta.postDeregisterInvoker(moi);
    
public voidpostRegisterInvoker(java.lang.Object moi, boolean registrationDone)

	if (!(moi instanceof MBeanRegistration)) return;

	final MetaData meta  = getMetaData(moi);
	meta.postRegisterInvoker(moi,registrationDone);
    
public voidpreDeregisterInvoker(java.lang.Object moi)

	if (!(moi instanceof MBeanRegistration)) return;
	final MetaData meta  = getMetaData(moi);
	meta.preDeregisterInvoker(moi);
    
public javax.management.ObjectNamepreRegisterInvoker(java.lang.Object moi, javax.management.ObjectName name, javax.management.MBeanServer mbs)

   
	if (!(moi instanceof MBeanRegistration)) return name;
	final MetaData meta  = getMetaData(moi);
	return meta.preRegisterInvoker(moi,name,mbs);
    
public final java.lang.ObjectsetAttribute(java.lang.Object instance, javax.management.Attribute attribute)


	final  MetaData meta = getMetaData(instance);
	return meta.setAttribute(instance,attribute);
    
public final javax.management.AttributeListsetAttributes(java.lang.Object instance, javax.management.AttributeList attributes)

	
	final  MetaData meta = getMetaData(instance);
	return meta.setAttributes(instance,attributes);
    
public synchronized voidtestCompliance(java.lang.Class c)
This methods tests if the MBean is JMX compliant

	final  MetaData meta = getMetaData(c);
	meta.testCompliance(c);
    
private static voidtrace(java.lang.String clz, java.lang.String func, java.lang.String info)

        Trace.send(Trace.LEVEL_TRACE, Trace.INFO_MBEANSERVER, clz, func, info);
    
private static voidtrace(java.lang.String func, java.lang.String info)

        trace(dbgTag, func, info);