001: /**
002: * The XMOJO Project 5
003: * Copyright © 2003 XMOJO.org. All rights reserved.
004:
005: * NO WARRANTY
006:
007: * BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
008: * THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
009: * OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
010: * PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
011: * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
012: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
013: * TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE
014: * LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
015: * REPAIR OR CORRECTION.
016:
017: * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
018: * ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
019: * THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
020: * GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
021: * USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
022: * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
023: * PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
024: * EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
025: * SUCH DAMAGES.
026: **/package javax.management.monitor;
027:
028: import java.lang.*;
029: import java.io.*;
030: import java.util.*;
031: import java.net.*;
032:
033: import javax.management.*;
034:
035: /**
036: * Provides definitions of the notifications sent by monitor MBeans.
037: * The notification source and a set of parameters concerning the monitor MBean's state
038: * need to be specified when creating a new object of this class. The list of notifications
039: * fired by the monitor
040: * MBeans is the following:
041: *
042: * Common to all kind of monitors:
043: * The observed object is not registered in the MBean server.
044: * The observed attribute is not contained in the observed object.
045: * The type of the observed attribute is not correct.
046: * Any exception (except the cases described above) occurs when trying to get the
047: * value of the observed attribute.
048: * Common to the counter and the gauge monitors:
049: * The threshold high or threshold low are not of the same type as the gauge (gauge
050: * monitors).
051: * The threshold or the offset or the modulus are not of the same type as the counter
052: * (counter monitors).
053: * Counter monitors only:
054: * The observed attribute has reached the threshold value.
055: * Gauge monitors only:
056: * The observed attribute has exceeded the threshold high value.
057: * The observed attribute has exceeded the threshold low value.
058: * String monitors only:
059: * The observed attribute has matched the "string to compare" value.
060: * The observed attribute has differed from the "string to compare" value.
061: *
062: */
063: public class MonitorNotification extends Notification {
064:
065: /**
066: * Notification type denoting that the observed attribute is not contained in the observed
067: * object. This notification is fired by all kinds of monitors.
068: * The value of this notification type is jmx.monitor.error.attribute.
069: */
070: public static final String OBSERVED_ATTRIBUTE_ERROR = "jmx.monitor.error.attribute";
071:
072: /**
073: * Notification type denoting that the type of the observed attribute is not correct. This
074: * notification is fired by all kinds of monitors.
075: * The value of this notification type is jmx.monitor.error.type.
076: */
077: public static final String OBSERVED_ATTRIBUTE_TYPE_ERROR = "jmx.monitor.error.type";
078:
079: /**
080: * Notification type denoting that the observed object is not registered in the MBean server.
081: * This notification is fired by all kinds of monitors.
082: * The value of this notification type is jmx.monitor.error.mbean.
083: */
084: public static final String OBSERVED_OBJECT_ERROR = "jmx.monitor.error.mbean";
085:
086: /**
087: * Notification type denoting that a non-predefined error type has occurred when trying to get
088: * the value of the observed attribute. This notification is fired by all kinds of monitors.
089: * The value of this notification type is jmx.monitor.error.runtime.
090: */
091: public static final String RUNTIME_ERROR = "jmx.monitor.error.runtime";
092:
093: /**
094: * Notification type denoting that the observed attribute has differed from the "string to
095: * compare" value. This notification is only fired by string monitors.
096: * The value of this notification type is jmx.monitor.string.differs.
097: */
098: public static final String STRING_TO_COMPARE_VALUE_DIFFERED = "jmx.monitor.string.differs";
099:
100: /**
101: * Notification type denoting that the observed attribute has matched the "string to compare"
102: * value. This notification is only fired by string monitors.
103: * The value of this notification type is jmx.monitor.string.matches.
104: */
105: public static final String STRING_TO_COMPARE_VALUE_MATCHED = "jmx.monitor.string.matches";
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 monitors.
110: * The value of this notification type is jmx.monitor.error.threshold.
111: */
112: public static final String THRESHOLD_ERROR = "jmx.monitor.error.threshold";
113:
114: /**
115: * Notification type denoting that the observed attribute has exceeded the threshold high value.
116: * This notification is only fired by gauge monitors.
117: * The value of this notification type is jmx.monitor.gauge.high.
118: */
119: public static final String THRESHOLD_HIGH_VALUE_EXCEEDED = "jmx.monitor.gauge.high";
120:
121: /**
122: * Notification type denoting that the observed attribute has exceeded the threshold low value.
123: * This notification is only fired by gauge monitors.
124: * The value of this notification type is jmx.monitor.gauge.low.
125: */
126: public static final String THRESHOLD_LOW_VALUE_EXCEEDED = "jmx.monitor.gauge.low";
127:
128: /**
129: * Notification type denoting that the observed attribute has reached the threshold value. This
130: * notification is only fired by counter monitors.
131: * The value of this notification type is jmx.monitor.counter.threshold.
132: */
133: public static final String THRESHOLD_VALUE_EXCEEDED = "jmx.monitor.counter.threshold";
134:
135: //private variables to this class.
136:
137: private ObjectName observedObject = null;
138: private String observedAttribute = null;
139: private Object derivedGauge = null;
140: private Object trigger = null;
141: private String type = null;
142:
143: MonitorNotification(String type, Object source,
144: ObjectName objectName, String attributeName,
145: Object derivedgauge, Object trigger, long sequenceNumber) {
146:
147: super (type, source, sequenceNumber);
148: this .type = type;
149: this .observedObject = objectName;
150: this .observedAttribute = attributeName;
151: this .derivedGauge = derivedgauge;
152: this .trigger = trigger;
153: }
154:
155: /**
156: * Gets the observed object of this monitor notification.
157: * @return - The Observed Object.
158: */
159: public ObjectName getObservedObject() {
160: return observedObject;
161: }
162:
163: /**
164: * Gets the observed attribute of this monitor notification.
165: * @return - The Observed Attribute.
166: */
167: public java.lang.String getObservedAttribute() {
168: return observedAttribute;
169: }
170:
171: /**
172: * Gets the derived gauge of this monitor notification.
173: * @return - The derived gauge.
174: */
175: public java.lang.Object getDerivedGauge() {
176: return derivedGauge;
177: }
178:
179: /**
180: * Gets the threshold/string (depending on the monitor type) that triggered off this
181: * monitor notification.
182: * @return - The trigger value.
183: */
184:
185: public java.lang.Object getTrigger() {
186: return trigger;
187: }
188:
189: }
|