API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.management. AttributeChangeNotification View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

/*
 * @(#)AttributeChangeNotification.java	4.21 05/11/17
 * 
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package javax.management; 



/**
 * Provides definitions of the attribute change notifications sent by MBeans.
 * <P>
 * It's up to the MBean owning the attribute of interest to create and send 
 * attribute change notifications when the attribute change occurs.
 * So the <CODE>NotificationBroadcaster</CODE> interface has to be implemented 
 * by any MBean for which an attribute change is of interest.
 * <P>
 * Example:
 * If an MBean called <CODE>myMbean</CODE> needs to notify registered listeners 
 * when its attribute: 
 * <BLOCKQUOTE><CODE>
 *      String myString
 * </CODE></BLOCKQUOTE> 
 * is modified, <CODE>myMbean</CODE> creates and emits the following notification:
 * <BLOCKQUOTE><CODE>
 * new AttributeChangeNotification(myMbean, sequenceNumber, timeStamp, msg,
 *                                 "myString", "String", oldValue, newValue); 
 * </CODE></BLOCKQUOTE> 
 *
 * @since 1.5
 */
public class AttributeChangeNotification extends javax.management.Notification { 

    /* Serial version */
    private static final long serialVersionUID = 535176054565814134L;

    /**
     * Notification type which indicates that the observed MBean attribute value has changed.
     * <BR>The value of this type string is <CODE>jmx.attribute.change</CODE>.
     */
    public static final String ATTRIBUTE_CHANGE = "jmx.attribute.change";
      

    /**
     * @serial The MBean attribute name.
     */
    private String attributeName = null;

    /**
     * @serial The MBean attribute type.
     */
    private String attributeType = null;

    /**
     * @serial The MBean attribute old value.
     */
    private Object oldValue = null;
    
    /**
     * @serial The MBean attribute new value.
     */
    private Object newValue = null;

    
    /**
     * Constructs an attribute change notification object.
     * In addition to the information common to all notification, the caller must supply the name and type
     * of the attribute, as well as its old and new values.
     *
     * @param source The notification producer, that is, the MBean the attribute belongs to.
     * @param sequenceNumber The notification sequence number within the source object.
     * @param timeStamp The date at which the notification is being sent.
     * @param msg A String containing the message of the notification.
     * @param attributeName A String giving the name of the attribute.
     * @param attributeType A String containing the type of the attribute.
     * @param oldValue An object representing value of the attribute before the change.
     * @param newValue An object representing value of the attribute after the change.
     */
    public AttributeChangeNotification(Object source, long sequenceNumber, long timeStamp, String msg,
                                       String attributeName, String attributeType, Object oldValue, Object newValue) {
        
        super(AttributeChangeNotification.ATTRIBUTE_CHANGE, source, sequenceNumber, timeStamp, msg);
        this.attributeName = attributeName;
        this.attributeType = attributeType;
        this.oldValue = oldValue;
        this.newValue = newValue;
    }
      
    
    /**
     * Gets the name of the attribute which has changed.
     *
     * @return A String containing the name of the attribute.
     */
    public String getAttributeName() { 
        return attributeName;
    } 

    /**
     * Gets the type of the attribute which has changed.
     *
     * @return A String containing the type of the attribute.
     */
    public String getAttributeType() { 
        return attributeType;
    } 

    /**
     * Gets the old value of the attribute which has changed.
     *
     * @return An Object containing the old value of the attribute.
     */
    public Object getOldValue() { 
        return oldValue;
    }
    
    /**
     * Gets the new value of the attribute which has changed.
     *
     * @return An Object containing the new value of the attribute.
     */
    public Object getNewValue() { 
        return newValue;
    }
      
}

Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar