com.sun.jaw.impl.agent.services.monitor
Class Monitor

java.lang.Object
  |
  +--com.sun.jaw.impl.agent.services.monitor.Monitor
Direct Known Subclasses:
CounterMonitor, GaugeMonitor

public class Monitor
extends java.lang.Object
implements AlarmClockListener, java.io.Serializable, ActivatableIf

This class provides a simple implementation of a monitor service.

The aim of this service is to observe the evolution in time of the value of a property of a given m-bean. The monitor service monitors values of a property in an observed m-bean. The observed property is monitored at intervals specified by the granularity period. A gauge value (derived gauge) is derived from the values of the observed property.

See Also:
CounterMonitor, GaugeMonitor, Serialized Form

Field Summary
protected  java.lang.Boolean administrativeStateOnOff
          State of the monitor.
protected  AlarmClock alarmClock
          Alarm-clock service.
protected  int already_notified
          Selected monitor errors that have already been notified
protected static int ALREADY_NOTIFIED_FLAGS_CLEARED
          Flags defining possible monitor errors
protected  Framework cmf
          Reference on the Core Management Framework.
protected  java.lang.Number derivedGauge
          Derived gauge.
protected  java.util.Date derivedGaugeTimestamp
          Derived gauge timestamp.
protected  int event_type
          Type of monitor event
protected static int GRANULARITY_PERIOD_ALREADY_NOTIFIED
           
protected  java.lang.Long granularityPeriod
          Granularity period.
protected  java.util.Vector listeners
          List of listeners for alarm-clock service.
protected static int OBSERVED_OBJECT_ALREADY_NOTIFIED
           
protected static int OBSERVED_PROPERTY_ALREADY_NOTIFIED
           
protected static int OBSERVED_PROPERTY_TYPE_ALREADY_NOTIFIED
           
protected  ObjectName observedObject
          Object to which the property to observe belongs to.
protected  java.lang.String observedProperty
          Name of the property to observe.
 
Constructor Summary
Monitor()
          Default constructor.
 
Method Summary
 void addMonitorListener(MonitorListener listener)
          Allows to register a listener for receiving monitor events.
 void deleteCmf()
          Delete the monitor.
static java.lang.String getClassVersion()
          Returns the version of this class.
 java.lang.Number getDerivedGauge()
          Returns the derived gauge.
 java.util.Date getDerivedGaugeTimestamp()
          Returns the derived gauge timestamp.
 java.lang.Integer getGranularityPeriod()
          Deprecated.  
 java.lang.Long getGranularityPeriodAsLong()
          Returns the granularity period (in milliseconds).
 ObjectName getObservedObject()
          Returns the object being observed.
 java.lang.String getObservedProperty()
          Returns the name of the property being observed.
 void handleAlarmClock(AlarmClockEvent e)
          This handle will be called each time the alarm-clock has exceeded its timeout.
 void initCmf(Framework cmf, ObjectName name, boolean db, ModificationList list)
          Initialize the monitor.
 boolean isActive()
          Tests if the Monitor is active.
protected  void notifyMonitor(java.lang.Integer eType, java.lang.String eMsg, java.lang.Object eObsObj, java.lang.String eObsProp, java.lang.Number eDerGauge)
          This method is used by the monitor service to send a monitor event to all the listeners registered for this kind of event.
 void performStart()
          Activates the Monitor service.
 void performStop()
          Deactivates the Monitor service.
 void removeMonitorListener(MonitorListener listener)
          Enables a listener for monitor events to be removed.
 void setGranularityPeriod(java.lang.Integer gp)
          Deprecated.  
 void setGranularityPeriodAsLong(java.lang.Long gp)
          Sets the granularity period (in milliseconds).
 void setObservedObject(ObjectName object)
          Sets the object to observe.
 void setObservedProperty(java.lang.String property)
          Sets the property to observe.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

observedObject

protected ObjectName observedObject
Object to which the property to observe belongs to.

observedProperty

protected java.lang.String observedProperty
Name of the property to observe.

granularityPeriod

protected java.lang.Long granularityPeriod
Granularity period.

derivedGauge

protected transient java.lang.Number derivedGauge
Derived gauge.

derivedGaugeTimestamp

protected transient java.util.Date derivedGaugeTimestamp
Derived gauge timestamp.

administrativeStateOnOff

protected transient java.lang.Boolean administrativeStateOnOff
State of the monitor.

alarmClock

protected AlarmClock alarmClock
Alarm-clock service.

listeners

protected transient java.util.Vector listeners
List of listeners for alarm-clock service.

cmf

protected Framework cmf
Reference on the Core Management Framework.

already_notified

protected int already_notified
Selected monitor errors that have already been notified

ALREADY_NOTIFIED_FLAGS_CLEARED

protected static final int ALREADY_NOTIFIED_FLAGS_CLEARED
Flags defining possible monitor errors

GRANULARITY_PERIOD_ALREADY_NOTIFIED

protected static final int GRANULARITY_PERIOD_ALREADY_NOTIFIED

OBSERVED_OBJECT_ALREADY_NOTIFIED

protected static final int OBSERVED_OBJECT_ALREADY_NOTIFIED

OBSERVED_PROPERTY_ALREADY_NOTIFIED

protected static final int OBSERVED_PROPERTY_ALREADY_NOTIFIED

OBSERVED_PROPERTY_TYPE_ALREADY_NOTIFIED

protected static final int OBSERVED_PROPERTY_TYPE_ALREADY_NOTIFIED

event_type

protected int event_type
Type of monitor event
Constructor Detail

Monitor

public Monitor()
Default constructor.
Method Detail

initCmf

public void initCmf(Framework cmf,
                    ObjectName name,
                    boolean db,
                    ModificationList list)
             throws InstanceAlreadyExistException
Initialize the monitor. The method will declare the object to the Core Management Framework.
For internal use only.
Parameters:
cmf - The core management framework to register the service with.
name - Object name containing configuration infotmation.
db - Indicates if persistent storage is required.
list - The modification list to use for setting up parameters.
Throws:
InstanceAlreadyExistException - The m-bean is already registered in the repository.

deleteCmf

public void deleteCmf()
Delete the monitor.

handleAlarmClock

public void handleAlarmClock(AlarmClockEvent e)
This handle will be called each time the alarm-clock has exceeded its timeout.
Specified by:
handleAlarmClock in interface AlarmClockListener

addMonitorListener

public void addMonitorListener(MonitorListener listener)
Allows to register a listener for receiving monitor events.

removeMonitorListener

public void removeMonitorListener(MonitorListener listener)
Enables a listener for monitor events to be removed.

getObservedObject

public ObjectName getObservedObject()
Returns the object being observed.

setObservedObject

public void setObservedObject(ObjectName object)
Sets the object to observe.

getObservedProperty

public java.lang.String getObservedProperty()
Returns the name of the property being observed.

setObservedProperty

public void setObservedProperty(java.lang.String property)
Sets the property to observe.

getGranularityPeriodAsLong

public java.lang.Long getGranularityPeriodAsLong()
Returns the granularity period (in milliseconds).
Since:
JDMK 3.0 patch

getGranularityPeriod

public java.lang.Integer getGranularityPeriod()
Deprecated.  

setGranularityPeriodAsLong

public void setGranularityPeriodAsLong(java.lang.Long gp)
Sets the granularity period (in milliseconds).
Since:
JDMK 3.0 patch

setGranularityPeriod

public void setGranularityPeriod(java.lang.Integer gp)
Deprecated.  

getDerivedGauge

public java.lang.Number getDerivedGauge()
Returns the derived gauge.

getDerivedGaugeTimestamp

public java.util.Date getDerivedGaugeTimestamp()
Returns the derived gauge timestamp.

getClassVersion

public static java.lang.String getClassVersion()
Returns the version of this class.

performStart

public void performStart()
Activates the Monitor service.
Specified by:
performStart in interface ActivatableIf

performStop

public void performStop()
Deactivates the Monitor service.
Specified by:
performStop in interface ActivatableIf

isActive

public boolean isActive()
Tests if the Monitor is active.
Specified by:
isActive in interface ActivatableIf

notifyMonitor

protected void notifyMonitor(java.lang.Integer eType,
                             java.lang.String eMsg,
                             java.lang.Object eObsObj,
                             java.lang.String eObsProp,
                             java.lang.Number eDerGauge)
This method is used by the monitor service to send a monitor event to all the listeners registered for this kind of event.
Parameters:
eType - one of the event types defined by MonitorEvent.
eMsg - message for event.
eObsObj - the observed object this monitor is observing.
eObsProp - the observed property this monitor is observing.
eDerGauge - the value of the derived gauge for the given object and property.