javax.management.monitor
Class StringMonitor

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--javax.management.monitor.Monitor
              |
              +--javax.management.monitor.StringMonitor

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:


Inner Class Summary
(package private)  class StringMonitor.StringMonitorThread
          This inner class implements Runnable and when the StringMonitor is started, the start method of this class is called and it periodically polls the Observed Attribute according to the granularity period and when there is a deviation from the configuration details, sends a notification.
 
Fields inherited from class javax.management.monitor.Monitor
alreadyNotified, alreadyNotifieds, capacityIncrement, dbgTag, derivedGaugeTimeStamp, elementCount, isActive, logger, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, OBSERVED_OBJECT_ERROR_NOTIFIED, RESET_FLAGS_ALREADY_NOTIFIED, RUNTIME_ERROR_NOTIFIED, sequenceNumber, server
 
Fields inherited from class javax.management.NotificationBroadcasterSupport
li
 
Constructor Summary
StringMonitor()
          Default Constructor.
 
Method Summary
 java.lang.String getDerivedGauge()
          Deprecated. Replaced by getDerivedGauge(ObjectName)
 java.lang.String getDerivedGauge(ObjectName object)
          This method gets the derived gauge of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.
 long getDerivedGaugeTimeStamp()
          Deprecated. Replaced by getDerivedGaugeTimeStamp(ObjectName)
 long getDerivedGaugeTimeStamp(ObjectName object)
          This method gets the derived gauge timestamp of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.
 MBeanNotificationInfo[] getNotificationInfo()
          This method returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the counter monitor.
 boolean getNotifyDiffer()
          This method sets the differing notification's on/off switch value common to all observed MBeans.
 boolean getNotifyMatch()
          This method gets the matching notification's on/off switch value common to all observed MBeans.
 java.lang.String getStringToCompare()
          This method gets the string to compare with the observed attribute.
(package private)  void insertSpecificElementAt(int index)
          This method is called when adding a new observed object in the list.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Overriding the preRegister() of MBeanRegistration interface to store the ObjectName locally.
(package private)  void removeSpecificElementAt(int index)
          This method is called when removing an observed object from the list.
 void setNotifyDiffer(boolean value)
          This method sets the differing notification's on/off switch value common to all observed MBeans.
 void setNotifyMatch(boolean value)
          This method sets the matching notification's on/off switch value common to all observed MBeans.
 void setStringToCompare(java.lang.String value)
          This method sets the string to compare with the observed attribute common to all observed MBeans.
 void start()
          This method starts the String Monitor.
 void stop()
          This method stops the String Monitor.
 
Methods inherited from class javax.management.monitor.Monitor
addObservedObject, containsObservedObject, getGranularityPeriod, getObservedAttribute, getObservedObject, getObservedObject, getObservedObjects, indexOf, insertElementAt, isActive, isFlagsReset, postDeregister, postRegister, preDeregister, removeElementAt, removeObservedObject, resetAllAlreadyNotifiedFlags, resetAlreadyNotifiedFlag, sendNotification, setAlreadyNotifiedFlag, setGranularityPeriod, setObservedAttribute, setObservedObject, updateDeprecatedAlreadyNotifiedFlag
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMonitor

public StringMonitor()
Default Constructor.
Method Detail

getDerivedGauge

public java.lang.String getDerivedGauge()
Deprecated. Replaced by getDerivedGauge(ObjectName)

This method gets the value of the derived gauge of the first object in the set of observed MBeans. The derived gauge is either the exact value of the observed attribute , or the difference between the two consecutive observed values of the attribute.
Specified by:
getDerivedGauge in interface StringMonitorMBean
Returns:
An instance of java.lang.String giving the value of the derived gauge.

getDerivedGauge

public java.lang.String getDerivedGauge(ObjectName object)
This method gets the derived gauge of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.
Specified by:
getDerivedGauge in interface StringMonitorMBean
Parameters:
object - the name of the MBean whose derived gauge is required.
Returns:
The derived gauge of the specified object.

getDerivedGaugeTimeStamp

public long getDerivedGaugeTimeStamp()
Deprecated. Replaced by getDerivedGaugeTimeStamp(ObjectName)

This method gets the derived gauge time stamp value of the first object in the set of observed MBeans. The derived gauge time stamp is the value(in the nearest miliseconds) when the notification was triggered.
Specified by:
getDerivedGaugeTimeStamp in interface StringMonitorMBean
Returns:
long value representing the time the notification was triggered.

getDerivedGaugeTimeStamp

public long getDerivedGaugeTimeStamp(ObjectName object)
This method gets the derived gauge timestamp of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.
Specified by:
getDerivedGaugeTimeStamp in interface StringMonitorMBean
Parameters:
object - the name of the MBean whose derived gauge timestamp is required.
Returns:
The derived gauge timestamp of the specified object.

getNotifyDiffer

public boolean getNotifyDiffer()
This method sets the differing notification's on/off switch value common to all observed MBeans.
Specified by:
getNotifyDiffer in interface StringMonitorMBean
Returns:
true if the string monitor notifies when differing from the string to compare, false otherwise.
See Also:
setNotifyDiffer(boolean)

setNotifyDiffer

public void setNotifyDiffer(boolean value)
This method sets the differing notification's on/off switch value common to all observed MBeans.
Specified by:
setNotifyDiffer in interface StringMonitorMBean
Parameters:
value - - The differing notification's on/off switch value.
See Also:
getNotifyDiffer()

getNotifyMatch

public boolean getNotifyMatch()
This method gets the matching notification's on/off switch value common to all observed MBeans.
Specified by:
getNotifyMatch in interface StringMonitorMBean
Returns:
true if the string monitor notifies when matching the string to compare, false otherwise.
See Also:
setNotifyMatch(boolean)

setNotifyMatch

public void setNotifyMatch(boolean value)
This method sets the matching notification's on/off switch value common to all observed MBeans.
Specified by:
setNotifyMatch in interface StringMonitorMBean
Parameters:
value - The matching notification's on/off switch value.
See Also:
getNotifyMatch()

getStringToCompare

public java.lang.String getStringToCompare()
This method gets the string to compare with the observed attribute.
Specified by:
getStringToCompare in interface StringMonitorMBean
Returns:
the String to be compared.

setStringToCompare

public void setStringToCompare(java.lang.String value)
                        throws java.lang.IllegalArgumentException
This method sets the string to compare with the observed attribute common to all observed MBeans.
Specified by:
setStringToCompare in interface StringMonitorMBean
Parameters:
The - String Value to be compared.
Throws:
java.lang.IllegalArgumentException - - The specified string to compare is null.
See Also:
getStringToCompare()

start

public void start()
This method starts the String Monitor.
Overrides:
start in class Monitor

stop

public void stop()
This method stops the String Monitor.
Overrides:
stop in class Monitor

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
Overriding the preRegister() of MBeanRegistration interface to store the ObjectName locally.
Overrides:
preRegister in class Monitor
Tags copied from class: Monitor
Parameters:
server - - The MBean server in which the monitor MBean will be registered.
name - - The object name of the monitor MBean.
Returns:
The name of the monitor MBean registered.
Throws:
- - java.lang.Exception.

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Description copied from class: Monitor
This method returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the counter monitor.
Overrides:
getNotificationInfo in class Monitor
Tags copied from class: Monitor
Returns:
An Array of MBeanNotificationInfo objects.

insertSpecificElementAt

void insertSpecificElementAt(int index)
This method is called when adding a new observed object in the list. It updates all the string specific arrays.
Overrides:
insertSpecificElementAt in class Monitor
Parameters:
index - The index of the observed object.

removeSpecificElementAt

void removeSpecificElementAt(int index)
This method is called when removing an observed object from the list. It updates all the string specific arrays.
Overrides:
removeSpecificElementAt in class Monitor
Parameters:
index - The index of the observed object.