J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | |
| 27 | package com.sun.jmx.snmp.agent; |
| 28 | |
| 29 | |
| 30 | |
| 31 | // jmx imports |
| 32 | // |
| 33 | import javax.management.Notification; |
| 34 | import javax.management.ObjectName; |
| 35 | |
| 36 | /** |
| 37 | * Represents a notification emitted when an |
| 38 | * entry is added or deleted from an SNMP table. |
| 39 | * <P> |
| 40 | * The <CODE>SnmpTableEntryNotification</CODE> object contains |
| 41 | * the reference to the entry added or removed from the table. |
| 42 | * <P> |
| 43 | * The list of notifications fired by the <CODE>SnmpMibTable</CODE> is |
| 44 | * the following: |
| 45 | * <UL> |
| 46 | * <LI>A new entry has been added to the SNMP table. |
| 47 | * <LI>An existing entry has been removed from the SNMP table. |
| 48 | </UL> |
| 49 | * |
| 50 | * <p><b>This API is a Sun Microsystems internal API and is subject |
| 51 | * to change without notice.</b></p> |
| 52 | */ |
| 53 | |
| 54 | public class SnmpTableEntryNotification extends Notification { |
| 55 | |
| 56 | /** |
| 57 | * Creates and initializes a table entry notification object. |
| 58 | * |
| 59 | * @param type The notification type. |
| 60 | * @param source The notification producer. |
| 61 | * @param sequenceNumber The notification sequence number within the |
| 62 | * source object. |
| 63 | * @param timeStamp The notification emission date. |
| 64 | * @param entry The entry object (may be null if the entry is |
| 65 | * registered in the MBeanServer). |
| 66 | * @param entryName The ObjectName entry object (may be null if the |
| 67 | * entry is not registered in the MBeanServer). |
| 68 | * @since 1.5 |
| 69 | */ |
| 70 | SnmpTableEntryNotification(String type, Object source, |
| 71 | long sequenceNumber, long timeStamp, |
| 72 | Object entry, ObjectName entryName) { |
| 73 | |
| 74 | super(type, source, sequenceNumber, timeStamp); |
| 75 | this.entry = entry; |
| 76 | this.name = entryName; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Gets the entry object. |
| 81 | * May be null if the entry is registered in the MBeanServer, and the |
| 82 | * MIB is using the generic MetaData (see mibgen). |
| 83 | * |
| 84 | * @return The entry. |
| 85 | */ |
| 86 | public Object getEntry() { |
| 87 | return entry; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Gets the ObjectName of the entry. |
| 92 | * May be null if the entry is not registered in the MBeanServer. |
| 93 | * |
| 94 | * @return The ObjectName of the entry. |
| 95 | * @since 1.5 |
| 96 | */ |
| 97 | public ObjectName getEntryName() { |
| 98 | return name; |
| 99 | } |
| 100 | |
| 101 | // PUBLIC VARIABLES |
| 102 | //----------------- |
| 103 | |
| 104 | /** |
| 105 | * Notification type denoting that a new entry has been added to the |
| 106 | * SNMP table. |
| 107 | * <BR>The value of this notification type is |
| 108 | * <CODE>jmx.snmp.table.entry.added</CODE>. |
| 109 | */ |
| 110 | public static final String SNMP_ENTRY_ADDED = |
| 111 | "jmx.snmp.table.entry.added"; |
| 112 | |
| 113 | /** |
| 114 | * Notification type denoting that an entry has been removed from the |
| 115 | * SNMP table. |
| 116 | * <BR>The value of this notification type is |
| 117 | * <CODE>jmx.snmp.table.entry.removed</CODE>. |
| 118 | */ |
| 119 | public static final String SNMP_ENTRY_REMOVED = |
| 120 | "jmx.snmp.table.entry.removed"; |
| 121 | |
| 122 | // PRIVATE VARIABLES |
| 123 | //------------------ |
| 124 | |
| 125 | /** |
| 126 | * The entry object. |
| 127 | * @serial |
| 128 | */ |
| 129 | private final Object entry; |
| 130 | |
| 131 | /** |
| 132 | * The entry name. |
| 133 | * @serial |
| 134 | * @since 1.5 |
| 135 | */ |
| 136 | private final ObjectName name; |
| 137 | |
| 138 | // Ensure compatibility |
| 139 | // |
| 140 | private static final long serialVersionUID = 5832592016227890252L; |
| 141 | } |