DynamicMetaDataImplpublic class DynamicMetaDataImpl extends BaseMetaDataImpl The DynamicMetaDataImpl class provides local access to the metadata
service in an agent.
The DynamicMetaDataImpl only handles DynamicMBeans. |
Fields Summary |
---|
private static final String | dbgTagThe name of this class to be used for tracing |
Constructors Summary |
---|
public DynamicMetaDataImpl()Creates a Metadata Service.
// ------------------------------
// ------------------------------
|
Methods Summary |
---|
private static void | debug(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 void | debug(java.lang.String func, java.lang.String info)
debug(dbgTag, func, info);
| private static void | debugX(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.Object | getAttribute(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.AttributeList | getAttributes(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.MBeanInfo | getMBeanInfo(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.Object | invoke(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 boolean | isDebugOn()
return Trace.isSelected(Trace.LEVEL_DEBUG, Trace.INFO_MBEANSERVER);
| private static boolean | isTraceOn()
return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_MBEANSERVER);
| public java.lang.Object | setAttribute(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.AttributeList | setAttributes(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 void | testCompliance(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 void | trace(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 void | trace(java.lang.String func, java.lang.String info)
trace(dbgTag, func, info);
|
|