KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > event > StatisticMonitorNotification


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * StatisticMonitorNotification.java
26  *
27  * Created on July 11, 2005
28  */

29
30 package com.sun.appserv.management.event;
31
32
33 // jmx imports
34
//
35
import javax.management.ObjectName JavaDoc;
36
37 /**
38  * Provides definitions of the notifications sent by statistic monitor
39  * MBeans. Used for JDK version greater than 1.5.
40  * <P>
41  * The notification source and a set of parameters concerning the statistic monitor MBean's state
42  * need to be specified when creating a new object of this class.
43  *
44  * The list of notifications fired by the statistic monitor MBeans is the following:
45  *
46  * <UL>
47  * <LI>Common to all kind of monitors:
48  * <UL>
49  * <LI>The observed object is not registered in the MBean server.
50  * <LI>The observed attribute is not contained in the observed object.
51  * <LI>The type of the observed attribute is not correct.
52  * <LI>Any exception (except the cases described above) occurs when trying to get the value of the observed attribute.
53  * </UL>
54  * <LI>Common to the counter and the gauge statistic monitors:
55  * <UL>
56  * <LI>The threshold high or threshold low are not of the same type as the gauge (gauge monitors).
57  * <LI>The threshold or the offset or the modulus are not of the same type as the counter (counter statistic monitors).
58  * </UL>
59  * <LI>CounterStatistic monitors only:
60  * <UL>
61  * <LI>The observed attribute has reached the threshold value.
62  * </UL>
63  * <LI>GaugeStatistic monitors only:
64  * <UL>
65  * <LI>The observed attribute has exceeded the threshold high value.
66  * <LI>The observed attribute has exceeded the threshold low value.
67  * </UL>
68  * <LI>StringStatistic monitors only:
69  * <UL>
70  * <LI>The observed attribute has matched the "string to compare" value.
71  * <LI>The observed attribute has differed from the "string to compare" value.
72  * </UL>
73  * </UL>
74  *
75  * @author Sun Microsystems, Inc
76  */

77 public class StatisticMonitorNotification extends javax.management.Notification JavaDoc {
78
79
80     /*
81      * ------------------------------------------
82      * PUBLIC VARIABLES
83      * ------------------------------------------
84      */

85     
86     /**
87      * Notification type denoting that the observed object is not registered in the MBean server.
88      * This notification is fired by all kinds of statistic monitors.
89      * <BR>The value of this notification type is <CODE>jmx.monitor.error.mbean</CODE>.
90      */

91     public static final String JavaDoc OBSERVED_OBJECT_ERROR = "jmx.monitor.error.mbean";
92
93     /**
94      * Notification type denoting that the observed attribute is not contained in the observed object.
95      * This notification is fired by all kinds of statistic monitors.
96      * <BR>The value of this notification type is <CODE>jmx.monitor.error.attribute</CODE>.
97      */

98     public static final String JavaDoc OBSERVED_ATTRIBUTE_ERROR = "jmx.monitor.error.attribute";
99
100     /**
101      * Notification type denoting that the type of the observed attribute is not correct.
102      * This notification is fired by all kinds of statistic monitors.
103      * <BR>The value of this notification type is <CODE>jmx.monitor.error.type</CODE>.
104      */

105     public static final String JavaDoc OBSERVED_ATTRIBUTE_TYPE_ERROR = "jmx.monitor.error.type";
106
107     /**
108      * Notification type denoting that the type of the thresholds, offset or modulus is not correct.
109      * This notification is fired by counter and gauge statistic monitors.
110      * <BR>The value of this notification type is <CODE>jmx.monitor.error.threshold</CODE>.
111      */

112     public static final String JavaDoc THRESHOLD_ERROR = "jmx.monitor.error.threshold";
113     
114     /**
115      * Notification type denoting that a non-predefined error type has occurred when trying to get the value of the observed attribute.
116      * This notification is fired by all kinds of statistic monitors.
117      * <BR>The value of this notification type is <CODE>jmx.monitor.error.runtime</CODE>.
118      */

119     public static final String JavaDoc RUNTIME_ERROR = "jmx.monitor.error.runtime";
120     
121     /**
122      * Notification type denoting that the observed attribute has reached the threshold value.
123      * This notification is only fired by counter statistic monitors.
124      * <BR>The value of this notification type is <CODE>jmx.monitor.counter.threshold</CODE>.
125      */

126     public static final String JavaDoc THRESHOLD_VALUE_EXCEEDED = "jmx.monitor.counter.threshold";
127
128     /**
129      * Notification type denoting that the observed attribute has exceeded the threshold high value.
130      * This notification is only fired by gauge statistic monitors.
131      * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.high</CODE>.
132      */

133     public static final String JavaDoc THRESHOLD_HIGH_VALUE_EXCEEDED = "jmx.monitor.gauge.high";
134
135     /**
136      * Notification type denoting that the observed attribute has exceeded the threshold low value.
137      * This notification is only fired by gauge statistic monitors.
138      * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.low</CODE>.
139      */

140     public static final String JavaDoc THRESHOLD_LOW_VALUE_EXCEEDED = "jmx.monitor.gauge.low";
141     
142     /**
143      * Notification type denoting that the observed attribute has matched the "string to compare" value.
144      * This notification is only fired by string statistic monitors.
145      * <BR>The value of this notification type is <CODE>jmx.monitor.string.matches</CODE>.
146      */

147     public static final String JavaDoc STRING_TO_COMPARE_VALUE_MATCHED = "jmx.monitor.string.matches";
148
149     /**
150      * Notification type denoting that the observed attribute has differed from the "string to compare" value.
151      * This notification is only fired by string statistic monitors.
152      * <BR>The value of this notification type is <CODE>jmx.monitor.string.differs</CODE>.
153      */

154     public static final String JavaDoc STRING_TO_COMPARE_VALUE_DIFFERED = "jmx.monitor.string.differs";
155     
156     
157     /*
158      * ------------------------------------------
159      * PRIVATE VARIABLES
160      * ------------------------------------------
161      */

162     
163     /* Serial version */
164     private static final long serialVersionUID = -4608189663661929204L;
165
166     /**
167      * @serial Monitor notification observed object.
168      */

169     private ObjectName JavaDoc observedObject = null;
170
171     /**
172      * @serial Monitor notification observed attribute.
173      */

174     private String JavaDoc observedAttribute = null;
175
176     /**
177      * @serial Monitor notification derived gauge.
178      */

179     private Object JavaDoc derivedGauge = null;
180     
181     /**
182      * @serial Monitor notification release mechanism.
183      * This value is used to keep the threshold/string (depending on the
184      * monitor type) that triggered off this notification.
185      */

186     private Object JavaDoc trigger = null;
187
188
189     /*
190      * ------------------------------------------
191      * CONSTRUCTORS
192      * ------------------------------------------
193      */

194     
195     /**
196      * Creates a statistic monitor notification object.
197      *
198      * @param type The notification type.
199      * @param source The notification producer.
200      * @param sequenceNumber The notification sequence number within the source object.
201      * @param timeStamp The notification emission date.
202      * @param msg The notification message.
203      * @param obsObj The object observed by the producer of this notification.
204      * @param obsAtt The attribute observed by the producer of this notification.
205      * @param derGauge The derived gauge.
206      * @param trigger The threshold/string (depending on the monitor type) that triggered the notification.
207      */

208     public StatisticMonitorNotification(String JavaDoc type, Object JavaDoc source, long sequenceNumber, long timeStamp, String JavaDoc msg,
209                                ObjectName JavaDoc obsObj, String JavaDoc obsAtt, Object JavaDoc derGauge, Object JavaDoc trigger) {
210         
211         super(type, source, sequenceNumber, timeStamp, msg);
212         this.observedObject = obsObj;
213         this.observedAttribute = obsAtt;
214         this.derivedGauge = derGauge;
215         this.trigger = trigger;
216     }
217     
218     /*
219      * ------------------------------------------
220      * PUBLIC METHODS
221      * ------------------------------------------
222      */

223     
224     // GETTERS AND SETTERS
225
//--------------------
226

227     /**
228      * Gets the observed object of this statistic monitor notification.
229      *
230      * @return The observed object.
231      */

232     public ObjectName JavaDoc getObservedObject() {
233         return observedObject;
234     }
235
236     /**
237      * Gets the observed attribute of this statistic monitor notification.
238      *
239      * @return The observed attribute.
240      */

241     public String JavaDoc getObservedAttribute() {
242         return observedAttribute;
243     }
244
245     /**
246      * Gets the derived gauge of this statistic monitor notification.
247      *
248      * @return The derived gauge.
249      */

250     public Object JavaDoc getDerivedGauge() {
251         return derivedGauge;
252     }
253     
254     /**
255      * Gets the threshold/string (depending on the monitor type) that triggered off this statistic monitor notification.
256      *
257      * @return The trigger.
258      */

259     public Object JavaDoc getTrigger() {
260         return trigger;
261     }
262     
263 }
264
Popular Tags