0N/A/*
2362N/A * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.management.monitor;
0N/A
0N/A
0N/A// jmx imports
0N/A//
0N/Aimport javax.management.ObjectName;
0N/A
0N/A/**
0N/A * Provides definitions of the notifications sent by monitor MBeans.
0N/A * <P>
0N/A * The notification source and a set of parameters concerning the monitor MBean's state
0N/A * need to be specified when creating a new object of this class.
0N/A *
0N/A * The list of notifications fired by the monitor MBeans is the following:
0N/A *
0N/A * <UL>
0N/A * <LI>Common to all kind of monitors:
0N/A * <UL>
0N/A * <LI>The observed object is not registered in the MBean server.
0N/A * <LI>The observed attribute is not contained in the observed object.
0N/A * <LI>The type of the observed attribute is not correct.
0N/A * <LI>Any exception (except the cases described above) occurs when trying to get the value of the observed attribute.
0N/A * </UL>
0N/A * <LI>Common to the counter and the gauge monitors:
0N/A * <UL>
0N/A * <LI>The threshold high or threshold low are not of the same type as the gauge (gauge monitors).
0N/A * <LI>The threshold or the offset or the modulus are not of the same type as the counter (counter monitors).
0N/A * </UL>
0N/A * <LI>Counter monitors only:
0N/A * <UL>
0N/A * <LI>The observed attribute has reached the threshold value.
0N/A * </UL>
0N/A * <LI>Gauge monitors only:
0N/A * <UL>
0N/A * <LI>The observed attribute has exceeded the threshold high value.
0N/A * <LI>The observed attribute has exceeded the threshold low value.
0N/A * </UL>
0N/A * <LI>String monitors only:
0N/A * <UL>
0N/A * <LI>The observed attribute has matched the "string to compare" value.
0N/A * <LI>The observed attribute has differed from the "string to compare" value.
0N/A * </UL>
0N/A * </UL>
0N/A *
0N/A *
0N/A * @since 1.5
0N/A */
0N/Apublic class MonitorNotification extends javax.management.Notification {
0N/A
0N/A
0N/A /*
0N/A * ------------------------------------------
0N/A * PUBLIC VARIABLES
0N/A * ------------------------------------------
0N/A */
0N/A
0N/A /**
0N/A * Notification type denoting that the observed object is not registered in the MBean server.
0N/A * This notification is fired by all kinds of monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.error.mbean</CODE>.
0N/A */
0N/A public static final String OBSERVED_OBJECT_ERROR = "jmx.monitor.error.mbean";
0N/A
0N/A /**
0N/A * Notification type denoting that the observed attribute is not contained in the observed object.
0N/A * This notification is fired by all kinds of monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.error.attribute</CODE>.
0N/A */
0N/A public static final String OBSERVED_ATTRIBUTE_ERROR = "jmx.monitor.error.attribute";
0N/A
0N/A /**
0N/A * Notification type denoting that the type of the observed attribute is not correct.
0N/A * This notification is fired by all kinds of monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.error.type</CODE>.
0N/A */
0N/A public static final String OBSERVED_ATTRIBUTE_TYPE_ERROR = "jmx.monitor.error.type";
0N/A
0N/A /**
0N/A * Notification type denoting that the type of the thresholds, offset or modulus is not correct.
0N/A * This notification is fired by counter and gauge monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.error.threshold</CODE>.
0N/A */
0N/A public static final String THRESHOLD_ERROR = "jmx.monitor.error.threshold";
0N/A
0N/A /**
0N/A * Notification type denoting that a non-predefined error type has occurred when trying to get the value of the observed attribute.
0N/A * This notification is fired by all kinds of monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.error.runtime</CODE>.
0N/A */
0N/A public static final String RUNTIME_ERROR = "jmx.monitor.error.runtime";
0N/A
0N/A /**
0N/A * Notification type denoting that the observed attribute has reached the threshold value.
0N/A * This notification is only fired by counter monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.counter.threshold</CODE>.
0N/A */
0N/A public static final String THRESHOLD_VALUE_EXCEEDED = "jmx.monitor.counter.threshold";
0N/A
0N/A /**
0N/A * Notification type denoting that the observed attribute has exceeded the threshold high value.
0N/A * This notification is only fired by gauge monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.high</CODE>.
0N/A */
0N/A public static final String THRESHOLD_HIGH_VALUE_EXCEEDED = "jmx.monitor.gauge.high";
0N/A
0N/A /**
0N/A * Notification type denoting that the observed attribute has exceeded the threshold low value.
0N/A * This notification is only fired by gauge monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.low</CODE>.
0N/A */
0N/A public static final String THRESHOLD_LOW_VALUE_EXCEEDED = "jmx.monitor.gauge.low";
0N/A
0N/A /**
0N/A * Notification type denoting that the observed attribute has matched the "string to compare" value.
0N/A * This notification is only fired by string monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.string.matches</CODE>.
0N/A */
0N/A public static final String STRING_TO_COMPARE_VALUE_MATCHED = "jmx.monitor.string.matches";
0N/A
0N/A /**
0N/A * Notification type denoting that the observed attribute has differed from the "string to compare" value.
0N/A * This notification is only fired by string monitors.
0N/A * <BR>The value of this notification type is <CODE>jmx.monitor.string.differs</CODE>.
0N/A */
0N/A public static final String STRING_TO_COMPARE_VALUE_DIFFERED = "jmx.monitor.string.differs";
0N/A
0N/A
0N/A /*
0N/A * ------------------------------------------
0N/A * PRIVATE VARIABLES
0N/A * ------------------------------------------
0N/A */
0N/A
0N/A /* Serial version */
0N/A private static final long serialVersionUID = -4608189663661929204L;
0N/A
0N/A /**
0N/A * @serial Monitor notification observed object.
0N/A */
0N/A private ObjectName observedObject = null;
0N/A
0N/A /**
0N/A * @serial Monitor notification observed attribute.
0N/A */
0N/A private String observedAttribute = null;
0N/A
0N/A /**
0N/A * @serial Monitor notification derived gauge.
0N/A */
0N/A private Object derivedGauge = null;
0N/A
0N/A /**
0N/A * @serial Monitor notification release mechanism.
0N/A * This value is used to keep the threshold/string (depending on the
0N/A * monitor type) that triggered off this notification.
0N/A */
0N/A private Object trigger = null;
0N/A
0N/A
0N/A /*
0N/A * ------------------------------------------
0N/A * CONSTRUCTORS
0N/A * ------------------------------------------
0N/A */
0N/A
0N/A /**
0N/A * Creates a monitor notification object.
0N/A *
0N/A * @param type The notification type.
0N/A * @param source The notification producer.
0N/A * @param sequenceNumber The notification sequence number within the source object.
0N/A * @param timeStamp The notification emission date.
0N/A * @param msg The notification message.
0N/A * @param obsObj The object observed by the producer of this notification.
0N/A * @param obsAtt The attribute observed by the producer of this notification.
0N/A * @param derGauge The derived gauge.
0N/A * @param trigger The threshold/string (depending on the monitor type) that triggered the notification.
0N/A */
1790N/A MonitorNotification(String type, Object source, long sequenceNumber, long timeStamp, String msg,
0N/A ObjectName obsObj, String obsAtt, Object derGauge, Object trigger) {
0N/A
0N/A super(type, source, sequenceNumber, timeStamp, msg);
0N/A this.observedObject = obsObj;
0N/A this.observedAttribute = obsAtt;
0N/A this.derivedGauge = derGauge;
0N/A this.trigger = trigger;
0N/A }
0N/A
0N/A /*
0N/A * ------------------------------------------
0N/A * PUBLIC METHODS
0N/A * ------------------------------------------
0N/A */
0N/A
0N/A // GETTERS AND SETTERS
0N/A //--------------------
0N/A
0N/A /**
0N/A * Gets the observed object of this monitor notification.
0N/A *
0N/A * @return The observed object.
0N/A */
0N/A public ObjectName getObservedObject() {
0N/A return observedObject;
0N/A }
0N/A
0N/A /**
0N/A * Gets the observed attribute of this monitor notification.
0N/A *
0N/A * @return The observed attribute.
0N/A */
0N/A public String getObservedAttribute() {
0N/A return observedAttribute;
0N/A }
0N/A
0N/A /**
0N/A * Gets the derived gauge of this monitor notification.
0N/A *
0N/A * @return The derived gauge.
0N/A */
0N/A public Object getDerivedGauge() {
0N/A return derivedGauge;
0N/A }
0N/A
0N/A /**
0N/A * Gets the threshold/string (depending on the monitor type) that triggered off this monitor notification.
0N/A *
0N/A * @return The trigger.
0N/A */
0N/A public Object getTrigger() {
0N/A return trigger;
0N/A }
0N/A
0N/A}