|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.modelmbean.RequiredModelMBean org.jsesoft.mmbi.NamedModelMBean
public class NamedModelMBean
Couples the Model MBean with its ObjectInstance
information (eg
ObjectName
).
This convenience class provides a ModelMBean with attached
ObjectInstance
information. Especially, it provides the
ObjectName
.
If the managed resource emits JMX notification (i.e. implements the
NotificationEmitter
interface, adding and removing Notification
listeners is forwarded to the managed resource (which should be done by the
RequiredModelMBean
).
Example:
NamedModelMBean mbean = new NamedModelMBean();
mbean.setModelMBeanInfo( ... );
mbean.setManagedResource( ..., "ObjectReference");
ObjectName objectName = new ObjectName( ... );
MBeanServer server =
java.lang.management.ManagementFactory.getPlatformMBeanServer();
mbean.setInstance( server.registerMBean( mbean, objectName ) );
...
server.unregisterMBean( mbean.getName() );
Constructor Summary | |
---|---|
NamedModelMBean()
Creates an NamedModelMBean instance from the
RequiredModelMBean . |
Method Summary | |
---|---|
void |
addNotificationEmitter(javax.management.NotificationEmitter emitter)
Registers a notification emitter. |
void |
addNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
|
javax.management.ObjectInstance |
getInstance()
Gets the instance attribute. |
java.lang.Object |
getManagedResource()
Gets the managed resource. |
javax.management.ObjectName |
getName()
Gets the object name. |
void |
register(javax.management.ObjectName objectName)
Registers an object at MBean server. |
void |
removeNotificationListener(javax.management.NotificationListener listener)
|
void |
removeNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
|
void |
sendNotification(javax.management.Notification ntfyObj)
|
void |
setInstance(javax.management.ObjectInstance theInstance)
Sets the instance attribute. |
void |
setManagedResource(java.lang.Object managed,
java.lang.String type)
|
void |
unregister()
Unregisters and object at MBean server. |
Methods inherited from class javax.management.modelmbean.RequiredModelMBean |
---|
addAttributeChangeNotificationListener, getAttribute, getAttributes, getClassLoaderRepository, getMBeanInfo, getNotificationInfo, invoke, load, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, setAttribute, setAttributes, setModelMBeanInfo, store |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NamedModelMBean() throws java.lang.Exception
NamedModelMBean
instance from the
RequiredModelMBean
.
java.lang.Exception
- if RequiredModelMBean
construction failsMethod Detail |
---|
public void setInstance(javax.management.ObjectInstance theInstance)
theInstance
- ObjectInstancegetInstance()
public javax.management.ObjectInstance getInstance()
setInstance(javax.management.ObjectInstance)
public javax.management.ObjectName getName()
public void setManagedResource(java.lang.Object managed, java.lang.String type) throws javax.management.MBeanException, javax.management.RuntimeOperationsException, javax.management.InstanceNotFoundException, javax.management.modelmbean.InvalidTargetObjectTypeException
setManagedResource
in interface javax.management.modelmbean.ModelMBean
setManagedResource
in class javax.management.modelmbean.RequiredModelMBean
javax.management.MBeanException
javax.management.RuntimeOperationsException
javax.management.InstanceNotFoundException
javax.management.modelmbean.InvalidTargetObjectTypeException
public java.lang.Object getManagedResource()
public void addNotificationEmitter(javax.management.NotificationEmitter emitter)
emitter
- the emitter to addpublic void addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
addNotificationListener
in interface javax.management.NotificationBroadcaster
addNotificationListener
in class javax.management.modelmbean.RequiredModelMBean
public void removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback) throws javax.management.ListenerNotFoundException
removeNotificationListener
in interface javax.management.NotificationEmitter
removeNotificationListener
in class javax.management.modelmbean.RequiredModelMBean
javax.management.ListenerNotFoundException
public void removeNotificationListener(javax.management.NotificationListener listener) throws javax.management.ListenerNotFoundException
removeNotificationListener
in interface javax.management.NotificationBroadcaster
removeNotificationListener
in class javax.management.modelmbean.RequiredModelMBean
javax.management.ListenerNotFoundException
public void sendNotification(javax.management.Notification ntfyObj) throws javax.management.MBeanException, javax.management.RuntimeOperationsException
sendNotification
in interface javax.management.modelmbean.ModelMBeanNotificationBroadcaster
sendNotification
in class javax.management.modelmbean.RequiredModelMBean
javax.management.MBeanException
javax.management.RuntimeOperationsException
public void register(javax.management.ObjectName objectName) throws javax.management.InstanceAlreadyExistsException, javax.management.MBeanRegistrationException, javax.management.NotCompliantMBeanException
objectName
- the object's name
javax.management.InstanceAlreadyExistsException
- if already registered
javax.management.MBeanRegistrationException
- on registration failure
javax.management.NotCompliantMBeanException
- if object not compliantpublic void unregister() throws javax.management.InstanceNotFoundException, javax.management.MBeanRegistrationException
javax.management.InstanceNotFoundException
- if not registered
javax.management.MBeanRegistrationException
- on registration failure
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |