uk.org.iscream.cms.server.client
Class Alert

java.lang.Object
  |
  +--uk.org.iscream.cms.server.client.Alert

public class Alert
extends Object

An object to hold the state of an Alert. When an alert is generated, it has lots of information about the cirscumstances and source of the alert. This object holds the information. It is created by Monitors (specifically in the fireAlert method of MonitorSkeleton). It then places the alert in the alert queue for Alerters to read and process.

Version:
$Id: Alert.java,v 1.19 2003/02/05 16:43:44 tdb Exp $
Author:
$Author: tdb $

Field Summary
private  int _alertLevel
          The alert level of this Alert object
private  String _attributeName
          The textual representation of the attribute that caused the alert.
private  long _initialAlertTime
          The time in milliseconds that this alert first occured.
private  int _lastAlert
          The last alert level for this attribute
private  String _name
          This is the friendly identifier of the component this class is running in.
private  String _source
          The source of the alert, eg hostname
private  int _thresholdLevel
          The threshold level that was broken
private  String _thresholdValue
          The threshold value that was broken
private  String _timeTillNextAlert
          The time in seconds till the next alert for this attribute will occur.
private  String _value
          The attribute value that caused the alert
static int alertCAUTION
          An internal representation of the CAUTION alert
static int alertCRITICAL
          An internal representation of the CRITICAL alert
static int alertFINAL
          An internal representation of the FINAL alert This must ALWAYS be the highest.
static String[] alertLevels
          The textual names of the alert levels.
static int alertNOTICE
          An internal representation of the NOTICE alert
static int alertOK
          An internal representation of the OK alert This must ALWAYS be 0.
static int alertWARNING
          An internal representation of the WARNING alert
static String REVISION
          The current CVS revision of this class
static String[] thresholdLevels
          The textual names of the threshold levels.
static int thresholdLOWER
          An internal representation of a LOWER threshold
static int thresholdNORMAL
          An internal representation of a NORMAL threshold
static int thresholdUPPER
          An internal representation of an UPPER threshold
 
Constructor Summary
Alert(int alertLevel, int lastAlert, int thresholdLevel, String source, String thresholdValue, String value, String attributeName, String timeTillNextAlert, long initialAlertTime)
          Construct an Alert object with the appropriate data
 
Method Summary
 String getAttributeName()
          Returns the textual representation of the name of the attribute that caused the alert.
 long getInitialAlertTime()
          Returns the time in milliseconds when the initial alert for this problem with the attribute occured.
 int getLastLevel()
          Returns the previous alert level for the attribute
 int getLevel()
          Returns the alert level of this Alert object
 String getSource()
          Returns the source of the alert
 int getThreshold()
          Returns the threshold level that was broken
 String getThresholdValue()
          Returns the value of the threshold level this alert broke
 String getTimeTillNextAlert()
          Returns the time in seconds till the next alert will be sent
 String getValue()
          Returns the value that the alert level was caused by
 String printAll()
          Prints a String representation of the Alert object.
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

thresholdNORMAL

public static final int thresholdNORMAL
An internal representation of a NORMAL threshold

See Also:
Constant Field Values

thresholdLOWER

public static final int thresholdLOWER
An internal representation of a LOWER threshold

See Also:
Constant Field Values

thresholdUPPER

public static final int thresholdUPPER
An internal representation of an UPPER threshold

See Also:
Constant Field Values

thresholdLevels

public static final String[] thresholdLevels
The textual names of the threshold levels. The position of the names in this array correspond to the internal integer representation constants.


alertOK

public static final int alertOK
An internal representation of the OK alert This must ALWAYS be 0.

See Also:
Constant Field Values

alertNOTICE

public static final int alertNOTICE
An internal representation of the NOTICE alert

See Also:
Constant Field Values

alertWARNING

public static final int alertWARNING
An internal representation of the WARNING alert

See Also:
Constant Field Values

alertCAUTION

public static final int alertCAUTION
An internal representation of the CAUTION alert

See Also:
Constant Field Values

alertCRITICAL

public static final int alertCRITICAL
An internal representation of the CRITICAL alert

See Also:
Constant Field Values

alertFINAL

public static final int alertFINAL
An internal representation of the FINAL alert This must ALWAYS be the highest.

See Also:
Constant Field Values

alertLevels

public static final String[] alertLevels
The textual names of the alert levels. The position of the names in this array correspond to the internal integer representation constants.


_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.


_alertLevel

private int _alertLevel
The alert level of this Alert object


_lastAlert

private int _lastAlert
The last alert level for this attribute


_thresholdLevel

private int _thresholdLevel
The threshold level that was broken


_source

private String _source
The source of the alert, eg hostname


_value

private String _value
The attribute value that caused the alert


_thresholdValue

private String _thresholdValue
The threshold value that was broken


_attributeName

private String _attributeName
The textual representation of the attribute that caused the alert.


_timeTillNextAlert

private String _timeTillNextAlert
The time in seconds till the next alert for this attribute will occur.


_initialAlertTime

private long _initialAlertTime
The time in milliseconds that this alert first occured.

Constructor Detail

Alert

public Alert(int alertLevel,
             int lastAlert,
             int thresholdLevel,
             String source,
             String thresholdValue,
             String value,
             String attributeName,
             String timeTillNextAlert,
             long initialAlertTime)
Construct an Alert object with the appropriate data

Parameters:
alertLevel - the alert level for this Alert object
lastAlert - the last alert level before this one
thresholdLevel - the threshold level that was broken to raise the alert
source - the source of the alert eg, hostname
thresholdValue - the configured value of the treshold level that was broken
value - the value of the attribute that raised the alert
attributeName - the textual representation of the attribute that has raised the alert
timeTillNextAlert - the time until the next alert will be sent concerning this attribute (in seconds)
initialAlertTime - the time the problem with this attribute first occured
Method Detail

printAll

public String printAll()
Prints a String representation of the Alert object. It is designed to resemble a HashMap.toString(), such that it is similar to the XMLPacket.printAll() method. This method is used by the WebFeeder specifically.

Returns:
a String representation of this Alert object.

toString

public String toString()
Overrides the Object.toString() method to provide clean logging (every class should have this). This uses the uk.org.iscream.cms.util.FormatName class to format the toString()

Overrides:
toString in class Object
Returns:
the name of this class and its CVS revision

getLevel

public int getLevel()
Returns the alert level of this Alert object

Returns:
the level

getLastLevel

public int getLastLevel()
Returns the previous alert level for the attribute

Returns:
the previous level

getThreshold

public int getThreshold()
Returns the threshold level that was broken

Returns:
the threshold level

getSource

public String getSource()
Returns the source of the alert

Returns:
the alerts source eg, hostname

getValue

public String getValue()
Returns the value that the alert level was caused by

Returns:
the value

getThresholdValue

public String getThresholdValue()
Returns the value of the threshold level this alert broke

Returns:
the value

getAttributeName

public String getAttributeName()
Returns the textual representation of the name of the attribute that caused the alert.

Returns:
the attribute name

getTimeTillNextAlert

public String getTimeTillNextAlert()
Returns the time in seconds till the next alert will be sent

Returns:
the time till the next alert

getInitialAlertTime

public long getInitialAlertTime()
Returns the time in milliseconds when the initial alert for this problem with the attribute occured.

Returns:
the initial alert time


Copyright © 2000-2003 i-scream. All Rights Reserved.