FileDocCategorySizeDatePackage
DynamicMetaDataImpl.javaAPI DocJava SE 5 API8642Fri Aug 26 14:54:58 BST 2005com.sun.jmx.mbeanserver

DynamicMetaDataImpl

public class DynamicMetaDataImpl extends BaseMetaDataImpl
The DynamicMetaDataImpl class provides local access to the metadata service in an agent. The DynamicMetaDataImpl only handles DynamicMBeans.
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
Constructors Summary
public DynamicMetaDataImpl()
Creates a Metadata Service.

    

             
       
	// ------------------------------ 
	// ------------------------------ 
    
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);
	}
    
public java.lang.ObjectgetAttribute(java.lang.Object instance, java.lang.String attribute)

        if (attribute == null) {
	    final RuntimeException r = 
		new IllegalArgumentException("Attribute name cannot be null");
            throw new RuntimeOperationsException(r, 
                "Exception occured trying to invoke the getter on the MBean");
        }  
 
	try {
	    return ((javax.management.DynamicMBean)instance).
		getAttribute(attribute);
	} catch (RuntimeOperationsException r) {
	    throw r;
	} catch (RuntimeErrorException r) {
	    throw r;
	} catch (RuntimeException e) {
	    debugX("getAttribute",e);
	    throw new RuntimeMBeanException(e, "RuntimeException" +
		    " thrown by the getAttribute method of the DynamicMBean" +
		    " for the attribute " + attribute);
	} catch (Error e) {
	    debugX("getAttribute",e);
	    throw new RuntimeErrorException((Error)e, "Error" + 
                    " thrown by the getAttribute method of the DynamicMBean "+
                    " for the attribute " + attribute);                  
	}
    
public javax.management.AttributeListgetAttributes(java.lang.Object instance, java.lang.String[] attributes)


        if (attributes == null) {
            throw new RuntimeOperationsException(new 
		IllegalArgumentException("Attributes cannot be null"), 
                "Exception occured trying to invoke the getter on the MBean");
        }

	try {
	    return ((javax.management.DynamicMBean)instance).
		getAttributes(attributes);
	} catch (RuntimeOperationsException r) {
	    throw r;
	} catch (RuntimeErrorException r) {
	    throw r;
	} catch (RuntimeException e) {
	    debugX("getAttributes",e);
	    throw new RuntimeOperationsException(e, "RuntimeException" +
                   " thrown by the getAttributes method of the DynamicMBean");
	} catch (Error e) {
	    debugX("getAttributes",e);
	    throw new RuntimeErrorException((Error)e, "Error" + 
                   " thrown by the getAttributes method of the DynamicMBean");
	}
    
public javax.management.MBeanInfogetMBeanInfo(java.lang.Object moi)


	try {
	    return (MBeanInfo) 
		((javax.management.DynamicMBean)moi).getMBeanInfo();
	} catch (RuntimeMBeanException r) {
	    throw r;
	} catch (RuntimeErrorException r) {
	    throw r;
	} catch (RuntimeException r) {
	    debugX("getMBeanInfo",r);
	    throw new RuntimeMBeanException((RuntimeException)r, 
           "Runtime Exception thrown by getMBeanInfo method of Dynamic MBean");
	} catch (Error e ) {
	    debugX("getMBeanInfo",e);
	    throw new RuntimeErrorException((Error)e, 
                      "Error thrown by getMBeanInfo method of Dynamic MBean");
	}

    
public 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");
        } 

	try {
	    return (((javax.management.DynamicMBean)instance).
		    invoke(operationName, params, signature));
	} catch (ReflectionException e) {
	    debugX("invoke",e);
	    throw e;
	} catch (MBeanException e) {
	    debugX("invoke",e);
	    throw e;
	} catch (RuntimeOperationsException r) {
	    throw r;
	} catch (RuntimeErrorException r) {
	    throw r;
	} catch (RuntimeException e) {
	    debugX("invoke",e);
	    throw new RuntimeMBeanException(e, "RuntimeException" +
		      " thrown by the invoke method of the Dynamic MBean");
	} catch (Error e) {
	    debugX("invoke",e);
	    throw new RuntimeErrorException((Error)e, "Error" + 
                     " thrown by the invoke method of the Dynamic MBean");
	}
    
private static booleanisDebugOn()

        return Trace.isSelected(Trace.LEVEL_DEBUG, Trace.INFO_MBEANSERVER);
    
private static booleanisTraceOn()

        return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_MBEANSERVER);
    
public java.lang.ObjectsetAttribute(java.lang.Object instance, javax.management.Attribute attribute)


        if (attribute == null) {
	    final RuntimeException r = 
		new IllegalArgumentException("Attribute name cannot be null");
            throw new RuntimeOperationsException(r, 
                "Exception occured trying to invoke the setter on the MBean");
        }  
 
	try {
	    ((javax.management.DynamicMBean)instance).
		setAttribute(attribute);
	    return attribute.getValue();
	} catch (RuntimeOperationsException r) {
	    throw r;
	} catch (RuntimeErrorException r) {
	    throw r;
	} catch (RuntimeException e) {
	    debugX("setAttribute",e);
	    throw new RuntimeMBeanException(e, 
		      "RuntimeException thrown by the setAttribute " + 
		      attribute + "method of the Dynamic MBean");
	} catch (Error e) {
	    debugX("setAttribute",e);
	    throw new RuntimeErrorException((Error)e, 
                      "Error thrown by the setAttribute " + attribute + 
		      "method of the Dynamic MBean");
	}
    
public javax.management.AttributeListsetAttributes(java.lang.Object instance, javax.management.AttributeList attributes)


	try {
	    return ((javax.management.DynamicMBean)instance).
		setAttributes(attributes);
	} catch (RuntimeOperationsException r) {
	    throw r;
	} catch (RuntimeErrorException r) {
	    throw r;
	} catch (RuntimeException e) {
	    debugX("setAttributes",e);
	    throw new RuntimeOperationsException(e, 
		     "RuntimeException thrown by the setAttributes " + 
		     "method of the Dynamic MBean");
	} catch (Error e) {
	    debugX("setAttributes",e);
	    throw new RuntimeErrorException((Error)e, 
                      "Error thrown by the setAttributes " + 
		      "method of the Dynamic MBean");
	}
    
public voidtestCompliance(java.lang.Class c)
This methods tests if the MBean is JMX compliant

	// ------------------------------ 
	// ------------------------------ 
	if (DynamicMBean.class.isAssignableFrom(c)) return;
	throw new NotCompliantMBeanException(
	       "Only DynamicMBeans are supported by this implementation");
    
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);