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.3 2001/03/02 00:08:17 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.3 $"; |
21 |
|
22 |
public static final int OK = 0; |
23 |
public static final int WARNING = 1; |
24 |
public static final int FATAL = 2; |
25 |
|
26 |
public static final String[] alerts = {"OK", "WARNING", "FATAL"}; |
27 |
|
28 |
//---STATIC METHODS--- |
29 |
|
30 |
//---CONSTRUCTORS--- |
31 |
|
32 |
/** |
33 |
* Construct an Alert packet at a set level. |
34 |
* |
35 |
* @param level the level of the alert |
36 |
*/ |
37 |
public Alert(int level, String thresholdValue, String value, String attributeName) { |
38 |
_level = level; |
39 |
_thresholdValue = thresholdValue; |
40 |
_value = value; |
41 |
_attributeName = attributeName; |
42 |
} |
43 |
|
44 |
//---PUBLIC METHODS--- |
45 |
|
46 |
/** |
47 |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
48 |
* method to provide clean logging (every class should have this). |
49 |
* |
50 |
* This uses the uk.ac.ukc.iscream.util.FormatName class |
51 |
* to format the toString() |
52 |
* |
53 |
* @return the name of this class and its CVS revision |
54 |
*/ |
55 |
public String toString() { |
56 |
return FormatName.getName( |
57 |
_name, |
58 |
getClass().getName(), |
59 |
REVISION); |
60 |
} |
61 |
|
62 |
//---PRIVATE METHODS--- |
63 |
|
64 |
//---ACCESSOR/MUTATOR METHODS--- |
65 |
|
66 |
/** |
67 |
* Returns the level of this packet |
68 |
*/ |
69 |
public int getLevel() { |
70 |
return _level; |
71 |
} |
72 |
|
73 |
public String getValue() { |
74 |
return _value; |
75 |
} |
76 |
|
77 |
public String getThresholdValue() { |
78 |
return _thresholdValue; |
79 |
} |
80 |
|
81 |
public String getAttributeName() { |
82 |
return _attributeName; |
83 |
} |
84 |
|
85 |
//---ATTRIBUTES--- |
86 |
|
87 |
/** |
88 |
* This is the friendly identifier of the |
89 |
* component this class is running in. |
90 |
* eg, a Filter may be called "filter1", |
91 |
* If this class does not have an owning |
92 |
* component, a name from the configuration |
93 |
* can be placed here. This name could also |
94 |
* be changed to null for utility classes. |
95 |
*/ |
96 |
private String _name = ClientMain.NAME; |
97 |
|
98 |
/** |
99 |
* The alert level of this packet |
100 |
*/ |
101 |
private int _level; |
102 |
|
103 |
private String _value; |
104 |
private String _thresholdValue; |
105 |
private String _attributeName; |
106 |
|
107 |
//---STATIC ATTRIBUTES--- |
108 |
|
109 |
} |