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

BaseMetaDataImpl

public abstract class BaseMetaDataImpl extends Object implements MetaData
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
BaseMetaDataImpl()
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);
	}
    
java.lang.ClassfindClass(java.lang.String className, java.lang.ClassLoader loader)

	try {
	    if (loader == null) 
		return Class.forName(className);
	    else 
		return loader.loadClass(className);
	} catch (ClassNotFoundException x) {
	    throw new ReflectionException(x,x.getMessage());
	}
    
public abstract java.lang.ObjectgetAttribute(java.lang.Object instance, java.lang.String attribute)

public abstract javax.management.AttributeListgetAttributes(java.lang.Object instance, java.lang.String[] attributes)

public java.lang.StringgetMBeanClassName(java.lang.Object moi)


	final MBeanInfo mbi;
	try {
	    // Ask the MBeanInfo for the class name
	    mbi = getMBeanInfo(moi);
	} catch (SecurityException x) {
	    throw x;
	} catch (IntrospectionException x) {
	    throw x;
	} catch (Exception x) {
	    throw new NotCompliantMBeanException("Can't obtain MBeanInfo " +
						 "from DynamicMBean: " + x);
	}

	if (mbi == null) {
	    throw new 
		NotCompliantMBeanException("The MBeanInfo returned is null");
	}
	
	final String className = mbi.getClassName();
		
	if (className == null) {
	    throw new 
		IntrospectionException("The class Name returned is null");
	}

	return className;
    
public abstract javax.management.MBeanInfogetMBeanInfo(java.lang.Object moi)

public abstract java.lang.Objectinvoke(java.lang.Object instance, java.lang.String operationName, java.lang.Object[] params, java.lang.String[] signature)

private static booleanisDebugOn()

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


	try {
	    final String cn = getMBeanClassName(instance);
	    if (cn.equals(className))
		return true; 	    
	    try {
		final ClassLoader cl = instance.getClass().getClassLoader();
		
		final Class classNameClass = findClass(className,cl);
		if (classNameClass == null) return false;
		if (classNameClass.isInstance(instance)) return true;
		
		final Class instanceClass = findClass(cn,cl);
		if (instanceClass == null) return false;
		return classNameClass.isAssignableFrom(instanceClass);
	    } catch (Exception x) {
		/* Could be SecurityException or ClassNotFoundException */
		debugX("isInstanceOf",x);
		return false;
	    }
	} catch (IntrospectionException x) {
	    debugX("isInstanceOf",x);
	    throw new ReflectionException(x,x.getMessage());
	} catch (NotCompliantMBeanException x) {
	    debugX("isInstanceOf",x);
	    throw new ReflectionException(x,x.getMessage());
	}
    
private static booleanisTraceOn()

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

	if (!(moi instanceof MBeanRegistration)) return;

        try {
            ((MBeanRegistration)moi).postDeregister();
        } catch (RuntimeException e) {
	    throw new RuntimeMBeanException((RuntimeException)e, 
                         "RuntimeException thrown in postDeregister method"); 
	} catch (Error er) {
	    throw new RuntimeErrorException((Error) er, 
                         "Error thrown in postDeregister method"); 
	} 
    
public voidpostRegisterInvoker(java.lang.Object moi, boolean registrationDone)

	if (!(moi instanceof MBeanRegistration)) return;

        try {
            ((MBeanRegistration)moi).
		postRegister(new Boolean(registrationDone));
        } catch (RuntimeException e) {
	    throw new RuntimeMBeanException((RuntimeException)e,  
		      "RuntimeException thrown in postRegister method");   
	} catch (Error er) {
	    throw new RuntimeErrorException((Error) er,  
		      "Error thrown in postRegister method");       
	}
    
public voidpreDeregisterInvoker(java.lang.Object moi)

	if (!(moi instanceof MBeanRegistration)) return;

	try {
            ((MBeanRegistration)moi).preDeregister();
        } catch (RuntimeException e) {
	    throw new RuntimeMBeanException((RuntimeException) e,  
                         "RuntimeException thrown in preDeregister method");
	} catch (Error er) {         
	    throw new RuntimeErrorException((Error) er,  
                         "Error thrown in preDeregister method");     
	} catch (MBeanRegistrationException t) {
	    throw (MBeanRegistrationException)t;   
	} catch (Exception ex) {
	    throw new MBeanRegistrationException((Exception)ex,  
                         "Exception thrown in preDeregister method"); 
	}
    
public javax.management.ObjectNamepreRegisterInvoker(java.lang.Object moi, javax.management.ObjectName name, javax.management.MBeanServer mbs)

   
	if (!(moi instanceof MBeanRegistration)) return name;

        final ObjectName newName;
      
        try {
            newName=(ObjectName)
		((MBeanRegistration)moi).preRegister(mbs, name);
        } catch (RuntimeException e) {
                throw new RuntimeMBeanException((RuntimeException)e, 
			   "RuntimeException thrown in preRegister method");       
	} catch (Error er) {      
                throw new RuntimeErrorException((Error) er, 
                           "Error thrown in preRegister method");
	} catch (MBeanRegistrationException r) {
	    throw (MBeanRegistrationException)r;
	} catch (Exception ex) {
	    throw new MBeanRegistrationException((Exception) ex, 
			  "Exception thrown in preRegister method");
	}      
        
	if (newName != null) return newName;
	else return name;
    
public abstract java.lang.ObjectsetAttribute(java.lang.Object instance, javax.management.Attribute attribute)

public abstract javax.management.AttributeListsetAttributes(java.lang.Object instance, javax.management.AttributeList attributes)

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);