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: tdb1 $ |
11 |
* @version $Id: Alert.java,v 1.4 2001/03/02 00:13:57 tdb1 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.4 $"; |
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 source, String thresholdValue, String value, String attributeName) { |
38 |
_level = level; |
39 |
_source = source; |
40 |
_thresholdValue = thresholdValue; |
41 |
_value = value; |
42 |
_attributeName = attributeName; |
43 |
} |
44 |
|
45 |
//---PUBLIC METHODS--- |
46 |
|
47 |
/** |
48 |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
49 |
* method to provide clean logging (every class should have this). |
50 |
* |
51 |
* This uses the uk.ac.ukc.iscream.util.FormatName class |
52 |
* to format the toString() |
53 |
* |
54 |
* @return the name of this class and its CVS revision |
55 |
*/ |
56 |
public String toString() { |
57 |
return FormatName.getName( |
58 |
_name, |
59 |
getClass().getName(), |
60 |
REVISION); |
61 |
} |
62 |
|
63 |
//---PRIVATE METHODS--- |
64 |
|
65 |
//---ACCESSOR/MUTATOR METHODS--- |
66 |
|
67 |
/** |
68 |
* Returns the level of this packet |
69 |
*/ |
70 |
public int getLevel() { |
71 |
return _level; |
72 |
} |
73 |
|
74 |
public String getSource() { |
75 |
return _source; |
76 |
} |
77 |
|
78 |
public String getValue() { |
79 |
return _value; |
80 |
} |
81 |
|
82 |
public String getThresholdValue() { |
83 |
return _thresholdValue; |
84 |
} |
85 |
|
86 |
public String getAttributeName() { |
87 |
return _attributeName; |
88 |
} |
89 |
|
90 |
//---ATTRIBUTES--- |
91 |
|
92 |
/** |
93 |
* This is the friendly identifier of the |
94 |
* component this class is running in. |
95 |
* eg, a Filter may be called "filter1", |
96 |
* If this class does not have an owning |
97 |
* component, a name from the configuration |
98 |
* can be placed here. This name could also |
99 |
* be changed to null for utility classes. |
100 |
*/ |
101 |
private String _name = ClientMain.NAME; |
102 |
|
103 |
/** |
104 |
* The alert level of this packet |
105 |
*/ |
106 |
private int _level; |
107 |
|
108 |
private String _source; |
109 |
private String _value; |
110 |
private String _thresholdValue; |
111 |
private String _attributeName; |
112 |
|
113 |
//---STATIC ATTRIBUTES--- |
114 |
|
115 |
} |