KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > monitor > MonitorNotification


1 /*
2  * @(#)MonitorNotification.java 4.22 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.management.monitor;
9
10
11 // jmx imports
12
//
13
import javax.management.ObjectName JavaDoc;
14
15 /**
16  * Provides definitions of the notifications sent by monitor MBeans.
17  * <P>
18  * The notification source and a set of parameters concerning the monitor MBean's state
19  * need to be specified when creating a new object of this class.
20  *
21  * The list of notifications fired by the monitor MBeans is the following:
22  *
23  * <UL>
24  * <LI>Common to all kind of monitors:
25  * <UL>
26  * <LI>The observed object is not registered in the MBean server.
27  * <LI>The observed attribute is not contained in the observed object.
28  * <LI>The type of the observed attribute is not correct.
29  * <LI>Any exception (except the cases described above) occurs when trying to get the value of the observed attribute.
30  * </UL>
31  * <LI>Common to the counter and the gauge monitors:
32  * <UL>
33  * <LI>The threshold high or threshold low are not of the same type as the gauge (gauge monitors).
34  * <LI>The threshold or the offset or the modulus are not of the same type as the counter (counter monitors).
35  * </UL>
36  * <LI>Counter monitors only:
37  * <UL>
38  * <LI>The observed attribute has reached the threshold value.
39  * </UL>
40  * <LI>Gauge monitors only:
41  * <UL>
42  * <LI>The observed attribute has exceeded the threshold high value.
43  * <LI>The observed attribute has exceeded the threshold low value.
44  * </UL>
45  * <LI>String monitors only:
46  * <UL>
47  * <LI>The observed attribute has matched the "string to compare" value.
48  * <LI>The observed attribute has differed from the "string to compare" value.
49  * </UL>
50  * </UL>
51  *
52  * @version 4.22 12/19/03
53  * @author Sun Microsystems, Inc
54  *
55  * @since 1.5
56  */

57 public class MonitorNotification extends javax.management.Notification JavaDoc {
58
59
60     /*
61      * ------------------------------------------
62      * PUBLIC VARIABLES
63      * ------------------------------------------
64      */

65     
66     /**
67      * Notification type denoting that the observed object is not registered in the MBean server.
68      * This notification is fired by all kinds of monitors.
69      * <BR>The value of this notification type is <CODE>jmx.monitor.error.mbean</CODE>.
70      */

71     public static final String JavaDoc OBSERVED_OBJECT_ERROR = "jmx.monitor.error.mbean";
72
73     /**
74      * Notification type denoting that the observed attribute is not contained in the observed object.
75      * This notification is fired by all kinds of monitors.
76      * <BR>The value of this notification type is <CODE>jmx.monitor.error.attribute</CODE>.
77      */

78     public static final String JavaDoc OBSERVED_ATTRIBUTE_ERROR = "jmx.monitor.error.attribute";
79
80     /**
81      * Notification type denoting that the type of the observed attribute is not correct.
82      * This notification is fired by all kinds of monitors.
83      * <BR>The value of this notification type is <CODE>jmx.monitor.error.type</CODE>.
84      */

85     public static final String JavaDoc OBSERVED_ATTRIBUTE_TYPE_ERROR = "jmx.monitor.error.type";
86
87     /**
88      * Notification type denoting that the type of the thresholds, offset or modulus is not correct.
89      * This notification is fired by counter and gauge monitors.
90      * <BR>The value of this notification type is <CODE>jmx.monitor.error.threshold</CODE>.
91      */

92     public static final String JavaDoc THRESHOLD_ERROR = "jmx.monitor.error.threshold";
93     
94     /**
95      * Notification type denoting that a non-predefined error type has occurred when trying to get the value of the observed attribute.
96      * This notification is fired by all kinds of monitors.
97      * <BR>The value of this notification type is <CODE>jmx.monitor.error.runtime</CODE>.
98      */

99     public static final String JavaDoc RUNTIME_ERROR = "jmx.monitor.error.runtime";
100     
101     /**
102      * Notification type denoting that the observed attribute has reached the threshold value.
103      * This notification is only fired by counter monitors.
104      * <BR>The value of this notification type is <CODE>jmx.monitor.counter.threshold</CODE>.
105      */

106     public static final String JavaDoc THRESHOLD_VALUE_EXCEEDED = "jmx.monitor.counter.threshold";
107
108     /**
109      * Notification type denoting that the observed attribute has exceeded the threshold high value.
110      * This notification is only fired by gauge monitors.
111      * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.high</CODE>.
112      */

113     public static final String JavaDoc THRESHOLD_HIGH_VALUE_EXCEEDED = "jmx.monitor.gauge.high";
114
115     /**
116      * Notification type denoting that the observed attribute has exceeded the threshold low value.
117      * This notification is only fired by gauge monitors.
118      * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.low</CODE>.
119      */

120     public static final String JavaDoc THRESHOLD_LOW_VALUE_EXCEEDED = "jmx.monitor.gauge.low";
121     
122     /**
123      * Notification type denoting that the observed attribute has matched the "string to compare" value.
124      * This notification is only fired by string monitors.
125      * <BR>The value of this notification type is <CODE>jmx.monitor.string.matches</CODE>.
126      */

127     public static final String JavaDoc STRING_TO_COMPARE_VALUE_MATCHED = "jmx.monitor.string.matches";
128
129     /**
130      * Notification type denoting that the observed attribute has differed from the "string to compare" value.
131      * This notification is only fired by string monitors.
132      * <BR>The value of this notification type is <CODE>jmx.monitor.string.differs</CODE>.
133      */

134     public static final String JavaDoc STRING_TO_COMPARE_VALUE_DIFFERED = "jmx.monitor.string.differs";
135     
136     
137     /*
138      * ------------------------------------------
139      * PRIVATE VARIABLES
140      * ------------------------------------------
141      */

142     
143     /* Serial version */
144     private static final long serialVersionUID = -4608189663661929204L;
145
146     /**
147      * @serial Monitor notification observed object.
148      */

149     private ObjectName JavaDoc observedObject = null;
150
151     /**
152      * @serial Monitor notification observed attribute.
153      */

154     private String JavaDoc observedAttribute = null;
155
156     /**
157      * @serial Monitor notification derived gauge.
158      */

159     private Object JavaDoc derivedGauge = null;
160     
161     /**
162      * @serial Monitor notification release mechanism.
163      * This value is used to keep the threshold/string (depending on the
164      * monitor type) that triggered off this notification.
165      */

166     private Object JavaDoc trigger = null;
167
168
169     /*
170      * ------------------------------------------
171      * CONSTRUCTORS
172      * ------------------------------------------
173      */

174     
175     /**
176      * Creates a monitor notification object.
177      *
178      * @param type The notification type.
179      * @param source The notification producer.
180      * @param sequenceNumber The notification sequence number within the source object.
181      * @param timeStamp The notification emission date.
182      * @param msg The notification message.
183      * @param obsObj The object observed by the producer of this notification.
184      * @param obsAtt The attribute observed by the producer of this notification.
185      * @param derGauge The derived gauge.
186      * @param trigger The threshold/string (depending on the monitor type) that triggered the notification.
187      */

188     MonitorNotification(String JavaDoc type, Object JavaDoc source, long sequenceNumber, long timeStamp, String JavaDoc msg,
189                                ObjectName JavaDoc obsObj, String JavaDoc obsAtt, Object JavaDoc derGauge, Object JavaDoc trigger) {
190         
191         super(type, source, sequenceNumber, timeStamp, msg);
192         this.observedObject = obsObj;
193         this.observedAttribute = obsAtt;
194         this.derivedGauge = derGauge;
195         this.trigger = trigger;
196     }
197     
198     /*
199      * ------------------------------------------
200      * PUBLIC METHODS
201      * ------------------------------------------
202      */

203     
204     // GETTERS AND SETTERS
205
//--------------------
206

207     /**
208      * Gets the observed object of this monitor notification.
209      *
210      * @return The observed object.
211      */

212     public ObjectName JavaDoc getObservedObject() {
213         return observedObject;
214     }
215
216     /**
217      * Gets the observed attribute of this monitor notification.
218      *
219      * @return The observed attribute.
220      */

221     public String JavaDoc getObservedAttribute() {
222         return observedAttribute;
223     }
224
225     /**
226      * Gets the derived gauge of this monitor notification.
227      *
228      * @return The derived gauge.
229      */

230     public Object JavaDoc getDerivedGauge() {
231         return derivedGauge;
232     }
233     
234     /**
235      * Gets the threshold/string (depending on the monitor type) that triggered off this monitor notification.
236      *
237      * @return The trigger.
238      */

239     public Object JavaDoc getTrigger() {
240         return trigger;
241     }
242     
243 }
244
Popular Tags