[newbie question] some question about MBean and notification
Hi,
can i manage an existing java object with OpenMBean? if yes how to connect them ( for ModeMBean it's setManagedResource but for OpenMBean)?
How can i send a notification from a generated ModelMBean ?(should i change my java object to impement NotificationBroadcasterSupport ?)
[302 byte] By [
chnada] at [2007-11-26 21:53:59]

# 1
Hi,
I would suggest you look into MXBeans. Here are three articles that will probably help you:
javax.management.StandardMBean: When and Why.
http://blogs.sun.com/jmxetc/entry/javax_management_standardmbean_when_and
DynamicMBeans, ModelMBeans, and Pojos...
http://blogs.sun.com/jmxetc/entry/dynamicmbeans%2C_modelmbeans%2C_and_pojos...
MXBeans in Java SE 6
http://java.sun.com/developer/technicalArticles/J2SE/mxbeans/
best regards,
-- daniel
JMX, SNMP, Java, etc...
http://blogs.sun.com/jmxetc
# 3
Hi,
An OpenMBean is just an MBean that has a ModelMBeanInfo, and uses only simple types
as defined by javax.management.openmbean.
You can use OpenMBeans to manage your resource, but if you don't have MXBeans
then you will need to write your OpenMBean by hand. This is not very difficult but
is a bit tedious.
There should be a chapter on OpenMBeans in the JMX tutorial - have a look at it.
http://blogs.sun.com/jmxetc/entry/looking_for_jmx_overview_examples
To send a notification with a RequiredModelMBean just use its sendNotification() method.
http://java.sun.com/j2se/1.5.0/docs/api/javax/management/modelmbean/ModelMBeanNotificationBroadcaster.html#sendNotification(javax.management.Notification)
With a "generated ModelMBean" I don't know - I assume it depends on how and by what
it was generated and whether it is a subclass of javax.management.modelmbean.RequiredModelMBean.
You will need to look at the generated code to figure it out.
Hope this helps,
-- daniel
JMX, SNMP, Java, etc...
http://blogs.sun.com/jmxetc