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, 3 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

# User Rev Content
1 tdb 1.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 ajm 1.7 * @author $Author: ajm4 $
11 ajm 1.8 * @version $Id: Alert.java,v 1.7 2001/03/02 05:42:38 ajm4 Exp $
12 tdb 1.1 */
13 ajm 1.3 public class Alert {
14 tdb 1.1
15     //---FINAL ATTRIBUTES---
16    
17     /**
18     * The current CVS revision of this class
19     */
20 ajm 1.8 public static final String REVISION = "$Revision: 1.7 $";
21 tdb 1.4
22 ajm 1.8 public static final int thresholdNORMAL = 0;
23     public static final int thresholdLOWER = 1;
24     public static final int thresholdUPPER = 2;
25 ajm 1.3
26 ajm 1.8 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 tdb 1.1
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 ajm 1.8 public Alert(int alertLevel, int thresholdLevel, String source, String thresholdValue, String value, String attributeName, String timeTillNextAlert) {
46     _alertLevel = alertLevel;
47     _thresholdLevel = thresholdLevel;
48 tdb 1.5 _source = source;
49 ajm 1.3 _thresholdValue = thresholdValue;
50     _value = value;
51     _attributeName = attributeName;
52 ajm 1.8 _timeTillNextAlert = timeTillNextAlert;
53 tdb 1.1 }
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 tdb 1.2
77     /**
78     * Returns the level of this packet
79     */
80     public int getLevel() {
81 ajm 1.8 return _alertLevel;
82     }
83    
84     public int getThreshold() {
85     return _thresholdLevel;
86 tdb 1.2 }
87 ajm 1.3
88 tdb 1.5 public String getSource() {
89     return _source;
90     }
91    
92 ajm 1.3 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 ajm 1.8
104     public String getTimeTillNextAlert() {
105     return _timeTillNextAlert;
106     }
107 tdb 1.1
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 ajm 1.8 private int _alertLevel;
125    
126     private int _thresholdLevel;
127 ajm 1.3
128 tdb 1.5 private String _source;
129 ajm 1.3 private String _value;
130     private String _thresholdValue;
131     private String _attributeName;
132 ajm 1.8 private String _timeTillNextAlert;
133 tdb 1.1
134     //---STATIC ATTRIBUTES---
135    
136     }