ManagedJsr77MdlBeanpublic class ManagedJsr77MdlBean extends Object
Fields Summary |
---|
DynamicMBean | m_mbean | Object | m_baseJsr77Bean |
Constructors Summary |
---|
public ManagedJsr77MdlBean(DynamicMBean mbean, Object cb)
/*J2EEManagedObjectMdl*/
m_baseJsr77Bean = cb;
m_mbean = mbean;
|
Methods Summary |
---|
public java.lang.Object | getAttribute(javax.management.modelmbean.ModelMBeanAttributeInfo attrInfo, java.lang.String attrName)Gets MBean's attribute value.
Descriptor descr = attrInfo.getDescriptor();
String getter = (String)descr.getFieldValue(MBeanMetaConstants.GETTER_FIELD_NAME);
if(getter==null)
throw new MBeanException(new MBeanRuntimeException("ManagedJsr77MdlBean:getAttribute:No getter found in descriptor"));
try
{
Method method = m_baseJsr77Bean.getClass().getMethod(getter);
return method.invoke(m_baseJsr77Bean);
}
catch (Exception e)
{
//throw new MBeanException(e, "Exception invoking getter method in runtime bean " + getter);
throw MBeanHelper.extractAndWrapTargetException(e,
"Exception invoking getter method in runtime bean " + getter);
}
| private java.lang.Class | getClassForName(java.lang.String type)
if(type.equals("int"))
return Integer.TYPE;
if(type.equals("long"))
return Long.TYPE;
if(type.equals("boolean"))
return Boolean.TYPE;
return Class.forName(type);
| public java.lang.Object | invokeOperation(javax.management.modelmbean.ModelMBeanOperationInfo opInfo, java.lang.Object[] params, java.lang.String[] signature)
String name = opInfo.getName();
try
{
Object ret = MBeanHelper.invokeOperationInBean(opInfo, this, params);
if(ret!=MBeanHelper.INVOKE_ERROR_SIGNAL_OBJECT)
{
return ret;
}
}
catch (Exception e)
{
//throw new MBeanException(e, "Exception invoking method in runtime bean" + name);
throw MBeanHelper.extractAndWrapTargetException(e,
"Exception invoking method in runtime bean " + name);
}
try
{
return MBeanHelper.invokeOperationInBean(opInfo, m_baseJsr77Bean, params);
// IT MAYBE:MBeanHelper.INVOKE_ERROR_SIGNAL_OBJECT !!!
}
catch (Exception e)
{
//throw new MBeanException(e, "Exception invoking method in runtime bean" + name);
throw MBeanHelper.extractAndWrapTargetException(e,
"Exception invoking method in runtime bean " + name);
}
| public void | setAttribute(javax.management.modelmbean.ModelMBeanAttributeInfo attrInfo, javax.management.Attribute attr)Sets MBean's attribute value.
Descriptor descr = attrInfo.getDescriptor();
String setter = (String)descr.getFieldValue(MBeanMetaConstants.SETTER_FIELD_NAME);
if(setter==null)
throw new MBeanException(new MBeanRuntimeException("ManagedJsr77MdlBean:getAttribute:No setter found in descriptor"));
try
{
Method method = m_baseJsr77Bean.getClass().getMethod(setter, new Class[]{getClassForName(attrInfo.getType())});
method.invoke(m_baseJsr77Bean, new Object[]{attr.getValue()});
}
catch (Exception e)
{
//e.printStackTrace();
//throw new MBeanException(e, "Exception invoking setter method in runtime bean " + setter);
throw MBeanHelper.extractAndWrapTargetException(e,
"Exception invoking setter method in runtime bean " + setter);
}
|
|