ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/Alert.java
Revision: 1.8
Committed: Sun Mar 4 02:41:16 2001 UTC (23 years, 2 months ago) by ajm
Branch: MAIN
Changes since 1.7: +31 -10 lines
Log Message:
Revamped monitoring and alert fireing mechanism.
Now takes account of timing of last alerts.
Now uses threshold value a guide to how quickly alerts should be escalated.

File Contents

# Content
1 //---PACKAGE DECLARATION---
2 package uk.ac.ukc.iscream.client;
3
4 //---IMPORTS---
5 import uk.ac.ukc.iscream.util.*;
6
7 /**
8 * Alert Object
9 *
10 * @author $Author: ajm4 $
11 * @version $Id: Alert.java,v 1.7 2001/03/02 05:42:38 ajm4 Exp $
12 */
13 public class Alert {
14
15 //---FINAL ATTRIBUTES---
16
17 /**
18 * The current CVS revision of this class
19 */
20 public static final String REVISION = "$Revision: 1.7 $";
21
22 public static final int thresholdNORMAL = 0;
23 public static final int thresholdLOWER = 1;
24 public static final int thresholdUPPER = 2;
25
26 public static final String[] thresholdLevels = {"NORMAL", "LOWER", "UPPER"};
27
28 public static final int alertOK = 0;
29 public static final int alertNOTICE = 1;
30 public static final int alertWARNING = 2;
31 public static final int alertCAUTION = 3;
32 public static final int alertCRITICAL = 4;
33
34 public static final String[] alertLevels = {"OK", "NOTICE", "WARNING", "CAUTION", "CRITICAL"};
35
36 //---STATIC METHODS---
37
38 //---CONSTRUCTORS---
39
40 /**
41 * Construct an Alert packet at a set level.
42 *
43 * @param level the level of the alert
44 */
45 public Alert(int alertLevel, int thresholdLevel, String source, String thresholdValue, String value, String attributeName, String timeTillNextAlert) {
46 _alertLevel = alertLevel;
47 _thresholdLevel = thresholdLevel;
48 _source = source;
49 _thresholdValue = thresholdValue;
50 _value = value;
51 _attributeName = attributeName;
52 _timeTillNextAlert = timeTillNextAlert;
53 }
54
55 //---PUBLIC METHODS---
56
57 /**
58 * Overrides the {@link java.lang.Object#toString() Object.toString()}
59 * method to provide clean logging (every class should have this).
60 *
61 * This uses the uk.ac.ukc.iscream.util.FormatName class
62 * to format the toString()
63 *
64 * @return the name of this class and its CVS revision
65 */
66 public String toString() {
67 return FormatName.getName(
68 _name,
69 getClass().getName(),
70 REVISION);
71 }
72
73 //---PRIVATE METHODS---
74
75 //---ACCESSOR/MUTATOR METHODS---
76
77 /**
78 * Returns the level of this packet
79 */
80 public int getLevel() {
81 return _alertLevel;
82 }
83
84 public int getThreshold() {
85 return _thresholdLevel;
86 }
87
88 public String getSource() {
89 return _source;
90 }
91
92 public String getValue() {
93 return _value;
94 }
95
96 public String getThresholdValue() {
97 return _thresholdValue;
98 }
99
100 public String getAttributeName() {
101 return _attributeName;
102 }
103
104 public String getTimeTillNextAlert() {
105 return _timeTillNextAlert;
106 }
107
108 //---ATTRIBUTES---
109
110 /**
111 * This is the friendly identifier of the
112 * component this class is running in.
113 * eg, a Filter may be called "filter1",
114 * If this class does not have an owning
115 * component, a name from the configuration
116 * can be placed here. This name could also
117 * be changed to null for utility classes.
118 */
119 private String _name = ClientMain.NAME;
120
121 /**
122 * The alert level of this packet
123 */
124 private int _alertLevel;
125
126 private int _thresholdLevel;
127
128 private String _source;
129 private String _value;
130 private String _thresholdValue;
131 private String _attributeName;
132 private String _timeTillNextAlert;
133
134 //---STATIC ATTRIBUTES---
135
136 }