| 
 | Apache Tomcat 7.0.28 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tomcat.util.modeler.BaseModelMBean
public class BaseModelMBean
Basic implementation of the DynamicMBean interface, which
 supports the minimal requirements of the interface contract.
This can be used directly to wrap an existing java bean, or inside an mlet or anywhere an MBean would be used. Limitations:
objectReference are
     supported.invoke() are immediately executed.void.
| Field Summary | |
|---|---|
| protected  BaseNotificationBroadcaster | attributeBroadcasterNotification broadcaster for attribute changes. | 
| protected  BaseNotificationBroadcaster | generalBroadcasterNotification broadcaster for general notifications. | 
| protected  ManagedBean | managedBeanMetadata for the mbean instance. | 
| protected  ObjectName | oname | 
| protected  Object | resourceThe managed resource this MBean is associated with (if any). | 
| protected  String | resourceType | 
| Constructor Summary | |
|---|---|
| protected  | BaseModelMBean()Construct a ModelMBeanwith defaultModelMBeanInfoinformation. | 
| Method Summary | |
|---|---|
|  void | addAttributeChangeNotificationListener(NotificationListener listener,
                                       String name,
                                       Object handback)Add an attribute change notification event listener to this MBean. | 
|  void | addNotificationListener(NotificationListener listener,
                        NotificationFilter filter,
                        Object handback)Add a notification event listener to this MBean. | 
|  Object | getAttribute(String name)Obtain and return the value of a specific attribute of this MBean. | 
|  AttributeList | getAttributes(String[] names)Obtain and return the values of several attributes of this MBean. | 
|  String | getClassName() | 
|  ObjectName | getJmxName() | 
|  Object | getManagedResource()Get the instance handle of the object against which we execute all methods in this ModelMBean management interface. | 
|  MBeanInfo | getMBeanInfo()Return the MBeanInfoobject for this MBean. | 
|  String | getModelerType() | 
|  MBeanNotificationInfo[] | getNotificationInfo()Return an MBeanNotificationInfoobject describing the
 notifications sent by this MBean. | 
|  String | getObjectName() | 
|  Object | invoke(String name,
       Object[] params,
       String[] signature)Invoke a particular method on this MBean, and return any returned value. | 
|  void | postDeregister() | 
|  void | postRegister(Boolean registrationDone) | 
|  void | preDeregister() | 
|  ObjectName | preRegister(MBeanServer server,
            ObjectName name) | 
|  void | removeAttributeChangeNotificationListener(NotificationListener listener,
                                          String name)Remove an attribute change notification event listener from this MBean. | 
|  void | removeAttributeChangeNotificationListener(NotificationListener listener,
                                          String attributeName,
                                          Object handback)Remove an attribute change notification event listener from this MBean. | 
|  void | removeNotificationListener(NotificationListener listener)Remove a notification event listener from this MBean. | 
|  void | removeNotificationListener(NotificationListener listener,
                           NotificationFilter filter,
                           Object handback)Remove a notification event listener from this MBean. | 
|  void | removeNotificationListener(NotificationListener listener,
                           Object handback)Remove a notification event listener from this MBean. | 
|  void | sendAttributeChangeNotification(Attribute oldValue,
                                Attribute newValue)Send an AttributeChangeNotificationto all registered
 listeners. | 
|  void | sendAttributeChangeNotification(AttributeChangeNotification notification)Send an AttributeChangeNotificationto all registered
 listeners. | 
|  void | sendNotification(Notification notification)Send a Notificationto all registered listeners as ajmx.modelmbean.generalnotification. | 
|  void | sendNotification(String message)Send a Notificationwhich contains the specified string
 as ajmx.modelmbean.genericnotification. | 
|  void | setAttribute(Attribute attribute)Set the value of a specific attribute of this MBean. | 
|  AttributeList | setAttributes(AttributeList attributes)Set the values of several attributes of this MBean. | 
|  void | setManagedBean(ManagedBean managedBean) | 
|  void | setManagedResource(Object resource,
                   String type)Set the instance handle of the object against which we will execute all methods in this ModelMBean management interface. | 
|  String | toString() | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected ObjectName oname
protected BaseNotificationBroadcaster attributeBroadcaster
protected BaseNotificationBroadcaster generalBroadcaster
protected ManagedBean managedBean
protected Object resource
protected String resourceType
| Constructor Detail | 
|---|
protected BaseModelMBean()
                  throws MBeanException,
                         RuntimeOperationsException
ModelMBean with default
 ModelMBeanInfo information.
MBeanException - if the initializer of an object
  throws an exception
RuntimeOperationsException - if an IllegalArgumentException
  occurs| Method Detail | 
|---|
public Object getAttribute(String name)
                    throws AttributeNotFoundException,
                           MBeanException,
                           ReflectionException
getAttribute in interface DynamicMBeanname - Name of the requested attribute
AttributeNotFoundException - if this attribute is not
  supported by this MBean
MBeanException - if the initializer of an object
  throws an exception
ReflectionException - if a Java reflection exception
  occurs when invoking the getterpublic AttributeList getAttributes(String[] names)
getAttributes in interface DynamicMBeannames - Names of the requested attributespublic void setManagedBean(ManagedBean managedBean)
public MBeanInfo getMBeanInfo()
MBeanInfo object for this MBean.
getMBeanInfo in interface DynamicMBean
public Object invoke(String name,
                     Object[] params,
                     String[] signature)
              throws MBeanException,
                     ReflectionException
IMPLEMENTATION NOTE - This implementation will attempt to invoke this method on the MBean itself, or (if not available) on the managed resource object associated with this MBean.
invoke in interface DynamicMBeanname - Name of the operation to be invokedparams - Array containing the method parameters of this operationsignature - Array containing the class names representing
  the signature of this operation
MBeanException - if the initializer of an object
  throws an exception
ReflectioNException - if a Java reflection exception
  occurs when invoking a method
ReflectionException
public void setAttribute(Attribute attribute)
                  throws AttributeNotFoundException,
                         MBeanException,
                         ReflectionException
setAttribute in interface DynamicMBeanattribute - The identification of the attribute to be set
  and the new value
AttributeNotFoundException - if this attribute is not
  supported by this MBean
MBeanException - if the initializer of an object
  throws an exception
ReflectionException - if a Java reflection exception
  occurs when invoking the getterpublic String toString()
toString in class Objectpublic AttributeList setAttributes(AttributeList attributes)
setAttributes in interface DynamicMBeanattributes - THe names and values to be set
public Object getManagedResource()
                          throws InstanceNotFoundException,
                                 InvalidTargetObjectTypeException,
                                 MBeanException,
                                 RuntimeOperationsException
InstanceNotFoundException - if the managed resource object
  cannot be found
InvalidTargetObjectTypeException - if the managed resource
  object is of the wrong type
MBeanException - if the initializer of the object throws
  an exception
RuntimeOperationsException - if the managed resource or the
  resource type is null or invalid
public void setManagedResource(Object resource,
                               String type)
                        throws InstanceNotFoundException,
                               MBeanException,
                               RuntimeOperationsException
resource - The resource object to be managedtype - The type of reference for the managed resource
  ("ObjectReference", "Handle", "IOR", "EJBHandle", or
  "RMIReference")
InstanceNotFoundException - if the managed resource object
  cannot be found
InvalidTargetObjectTypeException - if this ModelMBean is
  asked to handle a reference type it cannot deal with
MBeanException - if the initializer of the object throws
  an exception
RuntimeOperationsException - if the managed resource or the
  resource type is null or invalid
public void addAttributeChangeNotificationListener(NotificationListener listener,
                                                   String name,
                                                   Object handback)
                                            throws IllegalArgumentException
addAttributeChangeNotificationListener in interface ModelMBeanNotificationBroadcasterlistener - Listener that will receive event notificationsname - Name of the attribute of interest, or null
  to indicate interest in all attributeshandback - Handback object to be sent along with event
  notifications
IllegalArgumentException - if the listener parameter is null
public void removeAttributeChangeNotificationListener(NotificationListener listener,
                                                      String name)
                                               throws ListenerNotFoundException
removeAttributeChangeNotificationListener in interface ModelMBeanNotificationBroadcasterlistener - The listener to be removedname - The attribute name for which no more events are required
ListenerNotFoundException - if this listener is not
  registered in the MBean
public void removeAttributeChangeNotificationListener(NotificationListener listener,
                                                      String attributeName,
                                                      Object handback)
                                               throws ListenerNotFoundException
listener - The listener to be removedattributeName - The attribute name for which no more events are requiredhandback - Handback object to be sent along with event
  notifications
ListenerNotFoundException - if this listener is not
  registered in the MBean
public void sendAttributeChangeNotification(AttributeChangeNotification notification)
                                     throws MBeanException,
                                            RuntimeOperationsException
AttributeChangeNotification to all registered
 listeners.
sendAttributeChangeNotification in interface ModelMBeanNotificationBroadcasternotification - The AttributeChangeNotification
  that will be passed
MBeanException - if an object initializer throws an
  exception
RuntimeOperationsException - wraps IllegalArgumentException
  when the specified notification is null or invalid
public void sendAttributeChangeNotification(Attribute oldValue,
                                            Attribute newValue)
                                     throws MBeanException,
                                            RuntimeOperationsException
AttributeChangeNotification to all registered
 listeners.
sendAttributeChangeNotification in interface ModelMBeanNotificationBroadcasteroldValue - The original value of the AttributenewValue - The new value of the Attribute
MBeanException - if an object initializer throws an
  exception
RuntimeOperationsException - wraps IllegalArgumentException
  when the specified notification is null or invalid
public void sendNotification(Notification notification)
                      throws MBeanException,
                             RuntimeOperationsException
Notification to all registered listeners as a
 jmx.modelmbean.general notification.
sendNotification in interface ModelMBeanNotificationBroadcasternotification - The Notification that will be passed
MBeanException - if an object initializer throws an
  exception
RuntimeOperationsException - wraps IllegalArgumentException
  when the specified notification is null or invalid
public void sendNotification(String message)
                      throws MBeanException,
                             RuntimeOperationsException
Notification which contains the specified string
 as a jmx.modelmbean.generic notification.
sendNotification in interface ModelMBeanNotificationBroadcastermessage - The message string to be passed
MBeanException - if an object initializer throws an
  exception
RuntimeOperationsException - wraps IllegalArgumentException
  when the specified notification is null or invalid
public void addNotificationListener(NotificationListener listener,
                                    NotificationFilter filter,
                                    Object handback)
                             throws IllegalArgumentException
addNotificationListener in interface NotificationBroadcasterlistener - Listener that will receive event notificationsfilter - Filter object used to filter event notifications
  actually delivered, or null for no filteringhandback - Handback object to be sent along with event
  notifications
IllegalArgumentException - if the listener parameter is nullpublic MBeanNotificationInfo[] getNotificationInfo()
MBeanNotificationInfo object describing the
 notifications sent by this MBean.
getNotificationInfo in interface NotificationBroadcaster
public void removeNotificationListener(NotificationListener listener)
                                throws ListenerNotFoundException
removeNotificationListener in interface NotificationBroadcasterlistener - The listener to be removed (any and all registrations
  for this listener will be eliminated)
ListenerNotFoundException - if this listener is not
  registered in the MBean
public void removeNotificationListener(NotificationListener listener,
                                       Object handback)
                                throws ListenerNotFoundException
listener - The listener to be removed (any and all registrations
  for this listener will be eliminated)handback - Handback object to be sent along with event
  notifications
ListenerNotFoundException - if this listener is not
  registered in the MBean
public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws ListenerNotFoundException
listener - The listener to be removed (any and all registrations
  for this listener will be eliminated)filter - Filter object used to filter event notifications
  actually delivered, or null for no filteringhandback - Handback object to be sent along with event
  notifications
ListenerNotFoundException - if this listener is not
  registered in the MBeanpublic String getModelerType()
public String getClassName()
public ObjectName getJmxName()
public String getObjectName()
public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
preRegister in interface MBeanRegistrationExceptionpublic void postRegister(Boolean registrationDone)
postRegister in interface MBeanRegistration
public void preDeregister()
                   throws Exception
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
postDeregister in interface MBeanRegistration| 
 | Apache Tomcat 7.0.28 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||