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.9
Committed: Mon Mar 5 12:45:51 2001 UTC (23 years, 2 months ago) by ajm
Branch: MAIN
Changes since 1.8: +10 -3 lines
Log Message:
Now shows OK alerts if the previous alert exceeded the alerters level

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.9 * @version $Id: Alert.java,v 1.8 2001/03/04 02:41:16 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.9 public static final String REVISION = "$Revision: 1.8 $";
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.9 public Alert(int alertLevel, int lastAlert, int thresholdLevel, String source, String thresholdValue, String value, String attributeName, String timeTillNextAlert) {
46 ajm 1.8 _alertLevel = alertLevel;
47 ajm 1.9 _lastAlert = lastAlert;
48 ajm 1.8 _thresholdLevel = thresholdLevel;
49 tdb 1.5 _source = source;
50 ajm 1.3 _thresholdValue = thresholdValue;
51     _value = value;
52     _attributeName = attributeName;
53 ajm 1.8 _timeTillNextAlert = timeTillNextAlert;
54 tdb 1.1 }
55    
56     //---PUBLIC METHODS---
57    
58     /**
59     * Overrides the {@link java.lang.Object#toString() Object.toString()}
60     * method to provide clean logging (every class should have this).
61     *
62     * This uses the uk.ac.ukc.iscream.util.FormatName class
63     * to format the toString()
64     *
65     * @return the name of this class and its CVS revision
66     */
67     public String toString() {
68     return FormatName.getName(
69     _name,
70     getClass().getName(),
71     REVISION);
72     }
73    
74     //---PRIVATE METHODS---
75    
76     //---ACCESSOR/MUTATOR METHODS---
77 tdb 1.2
78     /**
79     * Returns the level of this packet
80     */
81     public int getLevel() {
82 ajm 1.8 return _alertLevel;
83     }
84    
85 ajm 1.9 public int getLastLevel() {
86     return _lastAlert;
87     }
88    
89 ajm 1.8 public int getThreshold() {
90     return _thresholdLevel;
91 tdb 1.2 }
92 ajm 1.3
93 tdb 1.5 public String getSource() {
94     return _source;
95     }
96    
97 ajm 1.3 public String getValue() {
98     return _value;
99     }
100    
101     public String getThresholdValue() {
102     return _thresholdValue;
103     }
104    
105     public String getAttributeName() {
106     return _attributeName;
107     }
108 ajm 1.8
109     public String getTimeTillNextAlert() {
110     return _timeTillNextAlert;
111     }
112 tdb 1.1
113     //---ATTRIBUTES---
114    
115     /**
116     * This is the friendly identifier of the
117     * component this class is running in.
118     * eg, a Filter may be called "filter1",
119     * If this class does not have an owning
120     * component, a name from the configuration
121     * can be placed here. This name could also
122     * be changed to null for utility classes.
123     */
124     private String _name = ClientMain.NAME;
125    
126     /**
127     * The alert level of this packet
128     */
129 ajm 1.8 private int _alertLevel;
130 ajm 1.9
131     private int _lastAlert;
132 ajm 1.8
133     private int _thresholdLevel;
134 ajm 1.3
135 tdb 1.5 private String _source;
136 ajm 1.3 private String _value;
137     private String _thresholdValue;
138     private String _attributeName;
139 ajm 1.8 private String _timeTillNextAlert;
140 tdb 1.1
141     //---STATIC ATTRIBUTES---
142    
143     }