com.adventnet.services.monitor
Class TableMonitor

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by javax.management.monitor.Monitor
          extended by com.adventnet.services.monitor.TableMonitor
All Implemented Interfaces:
TableMonitorMBean, javax.management.MBeanRegistration, javax.management.monitor.MonitorMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter

public class TableMonitor
extends javax.management.monitor.Monitor
implements TableMonitorMBean

This class defines a monitor MBean designed to observe the values of the table attributes.


Nested Class Summary
(package private)  class TableMonitor.TableMonitorThread
           
 
Field Summary
 
Fields inherited from class javax.management.monitor.Monitor
alreadyNotified, alreadyNotifieds, capacityIncrement, dbgTag, elementCount, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, OBSERVED_OBJECT_ERROR_NOTIFIED, RESET_FLAGS_ALREADY_NOTIFIED, RUNTIME_ERROR_NOTIFIED, server
 
Constructor Summary
TableMonitor()
          Default constructor
 
Method Summary
 boolean checkImplementsModelListener()
          Determines whether ModelListener is implemented or not
 long getGranularityPeriod()
          This method gets the granularity period (in milliseconds).
 java.lang.Object getHighThreshold()
          Returns the high threshold value
 java.lang.Object getLowThreshold()
          Returns the low threshold value
 java.lang.String getObservedAttribute()
          This method gets the name of the attribute being observed.
 java.lang.String getObservedColumn()
          Returns the observed column
 java.lang.String getObservedColumnType()
          Returns the type of the observed column
 javax.management.ObjectName getObservedObject()
          This method gets the object name of the object being observed.
 boolean isActive()
          This method tests whether the monitor MBean is active.
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          Overriding the preRegister() of MBeanRegistration interface to store the ObjectName locally.
 void setGranularityPeriod(long period)
          This method sets the granularity period (in milliseconds) .The default value is one second.
 void setObservedAttribute(java.lang.String attribute)
          This method sets the attribute being observed.
 void setObservedColumn(java.lang.String colName, java.lang.String typeName)
          Sets the column to be observed
 void setObservedObject(javax.management.ObjectName object)
          This method sets the object name of the object being observed.
 void setThresholds(java.lang.Object low, java.lang.Object high)
          Sets the high and the low threshold value
 void start()
          Starts the Table monitoring Thread
 void stop()
          Stops the monitoring Thread
 
Methods inherited from class javax.management.monitor.Monitor
addObservedObject, containsObservedObject, getObservedObjects, postDeregister, postRegister, preDeregister, removeObservedObject
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, 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
addObservedObject, containsObservedObject, getObservedObjects, removeObservedObject
 

Constructor Detail

TableMonitor

public TableMonitor()
Default constructor

Method Detail

getGranularityPeriod

public long getGranularityPeriod()
This method gets the granularity period (in milliseconds).

Specified by:
getGranularityPeriod in interface javax.management.monitor.MonitorMBean
Overrides:
getGranularityPeriod in class javax.management.monitor.Monitor
Returns:
long value representing the value of the granularity period (in milliseconds).

setGranularityPeriod

public void setGranularityPeriod(long period)
                          throws java.lang.IllegalArgumentException
This method sets the granularity period (in milliseconds) .The default value is one second.

Specified by:
setGranularityPeriod in interface javax.management.monitor.MonitorMBean
Overrides:
setGranularityPeriod in class javax.management.monitor.Monitor
Parameters:
period - the granularity period value.
Throws:
java.lang.IllegalArgumentException - - The granularity period is less than or equal to zero.

getObservedAttribute

public java.lang.String getObservedAttribute()
This method gets the name of the attribute being observed.

Specified by:
getObservedAttribute in interface javax.management.monitor.MonitorMBean
Overrides:
getObservedAttribute in class javax.management.monitor.Monitor
Returns:
String The name of the attribute that is being observed.

setObservedAttribute

public void setObservedAttribute(java.lang.String attribute)
This method sets the attribute being observed.

Specified by:
setObservedAttribute in interface javax.management.monitor.MonitorMBean
Overrides:
setObservedAttribute in class javax.management.monitor.Monitor
Parameters:
attribute - The attribute to be observed.

getObservedObject

public javax.management.ObjectName getObservedObject()
This method gets the object name of the object being observed.

Specified by:
getObservedObject in interface javax.management.monitor.MonitorMBean
Overrides:
getObservedObject in class javax.management.monitor.Monitor
Returns:
The ObjectName of the object being observed.

setObservedObject

public void setObservedObject(javax.management.ObjectName object)
This method sets the object name of the object being observed.

Specified by:
setObservedObject in interface javax.management.monitor.MonitorMBean
Overrides:
setObservedObject in class javax.management.monitor.Monitor
Parameters:
object - The ObjectName of the object to be observed.

isActive

public boolean isActive()
This method tests whether the monitor MBean is active. A monitor MBean is marked active when the start method is called. It becomes inactive when the stop method is called.

Specified by:
isActive in interface javax.management.monitor.MonitorMBean
Overrides:
isActive in class javax.management.monitor.Monitor
Returns:
boolean value indicating whether the MBean is active or not.

setObservedColumn

public void setObservedColumn(java.lang.String colName,
                              java.lang.String typeName)
Sets the column to be observed

Specified by:
setObservedColumn in interface TableMonitorMBean
Parameters:
colName - The name of the column to be observed
typeName - The type of the column to be observed

getObservedColumn

public java.lang.String getObservedColumn()
Returns the observed column

Specified by:
getObservedColumn in interface TableMonitorMBean
Returns:
The name of the observed column

getObservedColumnType

public java.lang.String getObservedColumnType()
Returns the type of the observed column

Specified by:
getObservedColumnType in interface TableMonitorMBean
Parameters:
The - type of the observed column

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Overriding the preRegister() of MBeanRegistration interface to store the ObjectName locally.

Specified by:
preRegister in interface javax.management.MBeanRegistration
Overrides:
preRegister in class javax.management.monitor.Monitor
Throws:
java.lang.Exception

start

public void start()
Starts the Table monitoring Thread

Specified by:
start in interface javax.management.monitor.MonitorMBean
Specified by:
start in class javax.management.monitor.Monitor

setThresholds

public void setThresholds(java.lang.Object low,
                          java.lang.Object high)
Sets the high and the low threshold value

Specified by:
setThresholds in interface TableMonitorMBean
Parameters:
low - The low threshold value
high - The high threshold value

getLowThreshold

public java.lang.Object getLowThreshold()
Returns the low threshold value

Specified by:
getLowThreshold in interface TableMonitorMBean

getHighThreshold

public java.lang.Object getHighThreshold()
Returns the high threshold value

Specified by:
getHighThreshold in interface TableMonitorMBean

stop

public void stop()
Stops the monitoring Thread

Specified by:
stop in interface javax.management.monitor.MonitorMBean
Specified by:
stop in class javax.management.monitor.Monitor

checkImplementsModelListener

public boolean checkImplementsModelListener()
Determines whether ModelListener is implemented or not

Returns:
true if ModelListener is implemented and false otherwise