javax.management.monitor
Class StringMonitor

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--javax.management.monitor.Monitor
              |
              +--javax.management.monitor.StringMonitor
All Implemented Interfaces:
MBeanRegistration, MonitorMBean, NotificationBroadcaster, NotificationEmitter, StringMonitorMBean

public class StringMonitor
extends Monitor
implements StringMonitorMBean

Defines a monitor MBean designed to observe the values of a string attribute.

A string monitor sends notifications as follows:

Author:
Young Yang

Field Summary
 
Fields inherited from class javax.management.monitor.Monitor
observedObjects
 
Constructor Summary
StringMonitor()
           
 
Method Summary
 void addObservedObject(ObjectName objectName)
          Adds the specified object in the set of observed MBeans.
protected  void doMonitor(ObjectName observedObject, java.lang.Object value)
           
 java.lang.String getDerivedGauge(ObjectName observedObject)
          Gets the derived gauge for the specified MBean.
 long getDerivedGaugeTimeStamp(ObjectName observedObject)
          Gets the derived gauge timestamp for the specified MBean.
 MBeanNotificationInfo[] getNotificationInfo()
          Returns a NotificationInfo object contaning the name of the Java class of the notification and the notification types sent.
 boolean getNotifyDiffer()
          Gets the differing notification's on/off switch value.
 boolean getNotifyMatch()
          Gets the matching notification's on/off switch value.
 java.lang.String getStringToCompare()
          Gets the string to compare with the observed attribute.
 void setNotifyDiffer(boolean value)
          Sets the differing notification's on/off switch value.
 void setNotifyMatch(boolean value)
          Sets the matching notification's on/off switch value.
 void setStringToCompare(java.lang.String value)
          Sets the string to compare with the observed attribute.
 void start()
           
 void stop()
           
 
Methods inherited from class javax.management.monitor.Monitor
_start, _stop, containsObservedObject, getGranularityPeriod, getMonitorData, getObservedAttribute, getObservedObjects, isActive, postDeregister, postRegister, preDeregister, preRegister, removeObservedObject, sendNotification, setGranularityPeriod, setObservedAttribute
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.management.monitor.MonitorMBean
containsObservedObject, getGranularityPeriod, getObservedAttribute, getObservedObjects, isActive, removeObservedObject, setGranularityPeriod, setObservedAttribute
 

Constructor Detail

StringMonitor

public StringMonitor()
Method Detail

start

public void start()
Specified by:
start in class Monitor

stop

public void stop()
Specified by:
stop in class Monitor

getDerivedGauge

public java.lang.String getDerivedGauge(ObjectName observedObject)
Description copied from interface: StringMonitorMBean
Gets the derived gauge for the specified MBean.

Specified by:
getDerivedGauge in interface StringMonitorMBean
Parameters:
observedObject - the MBean for which the derived gauge is to be returned
Returns:
The derived gauge for the specified MBean if this MBean is in the set of observed MBeans, or null otherwise.

getDerivedGaugeTimeStamp

public long getDerivedGaugeTimeStamp(ObjectName observedObject)
Description copied from interface: StringMonitorMBean
Gets the derived gauge timestamp for the specified MBean.

Specified by:
getDerivedGaugeTimeStamp in interface StringMonitorMBean
Parameters:
observedObject - the MBean for which the derived gauge timestamp is to be returned
Returns:
The derived gauge timestamp for the specified MBean if this MBean is in the set of observed MBeans, or null otherwise.

getStringToCompare

public java.lang.String getStringToCompare()
Description copied from interface: StringMonitorMBean
Gets the string to compare with the observed attribute.

Specified by:
getStringToCompare in interface StringMonitorMBean
Returns:
The string value.
See Also:
StringMonitorMBean.setStringToCompare(java.lang.String)

setStringToCompare

public void setStringToCompare(java.lang.String value)
                        throws java.lang.IllegalArgumentException
Description copied from interface: StringMonitorMBean
Sets the string to compare with the observed attribute.

Specified by:
setStringToCompare in interface StringMonitorMBean
Parameters:
value - The string value.
Throws:
java.lang.IllegalArgumentException - The specified string to compare is null.
See Also:
StringMonitorMBean.getStringToCompare()

getNotifyMatch

public boolean getNotifyMatch()
Description copied from interface: StringMonitorMBean
Gets the matching notification's on/off switch value.

Specified by:
getNotifyMatch in interface StringMonitorMBean
Returns:
true if the string monitor notifies when matching, false otherwise.
See Also:
StringMonitorMBean.setNotifyMatch(boolean)

setNotifyMatch

public void setNotifyMatch(boolean value)
Description copied from interface: StringMonitorMBean
Sets the matching notification's on/off switch value.

Specified by:
setNotifyMatch in interface StringMonitorMBean
Parameters:
value - The matching notification's on/off switch value.
See Also:
StringMonitorMBean.getNotifyMatch()

getNotifyDiffer

public boolean getNotifyDiffer()
Description copied from interface: StringMonitorMBean
Gets the differing notification's on/off switch value.

Specified by:
getNotifyDiffer in interface StringMonitorMBean
Returns:
true if the string monitor notifies when differing, false otherwise.
See Also:
StringMonitorMBean.setNotifyDiffer(boolean)

setNotifyDiffer

public void setNotifyDiffer(boolean value)
Description copied from interface: StringMonitorMBean
Sets the differing notification's on/off switch value.

Specified by:
setNotifyDiffer in interface StringMonitorMBean
Parameters:
value - The differing notification's on/off switch value.
See Also:
StringMonitorMBean.getNotifyDiffer()

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Description copied from class: NotificationBroadcasterSupport
Returns a NotificationInfo object contaning the name of the Java class of the notification and the notification types sent.

Specified by:
getNotificationInfo in interface NotificationBroadcaster
Overrides:
getNotificationInfo in class NotificationBroadcasterSupport

doMonitor

protected void doMonitor(ObjectName observedObject,
                         java.lang.Object value)
Specified by:
doMonitor in class Monitor

addObservedObject

public void addObservedObject(ObjectName objectName)
                       throws java.lang.IllegalArgumentException
Description copied from interface: MonitorMBean
Adds the specified object in the set of observed MBeans.

Specified by:
addObservedObject in interface MonitorMBean
Specified by:
addObservedObject in class Monitor
Parameters:
objectName - The object to observe.
Throws:
java.lang.IllegalArgumentException - the specified object is null.