jdk/src/share/classes/javax/management/modelmbean/ModelMBeanNotificationBroadcaster.java
author rriggs
Tue, 12 Nov 2013 14:03:28 -0500
changeset 21656 d4c777ccb1db
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
8028014: Doclint warning/error cleanup in javax.management Summary: Improve generated html by fixing doclint warnings Reviewed-by: sla, jbachorik
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @author    IBM Corp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * Copyright IBM Corp. 1999-2000.  All rights reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
package javax.management.modelmbean;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.management.Attribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.management.AttributeChangeNotification;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.management.ListenerNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.management.MBeanException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.management.Notification;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.management.NotificationBroadcaster;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import javax.management.NotificationListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import javax.management.RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * This interface must be implemented by the ModelMBeans. An implementation of this interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * must be shipped with every JMX Agent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * Java resources wishing to be manageable instantiate the ModelMBean using the MBeanServer's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * createMBean method.  The resource then sets the ModelMBeanInfo (with Descriptors) for the ModelMBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * instance. The attributes and operations exposed via the ModelMBeanInfo for the ModelMBean are accessible
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * from MBeans, connectors/adaptors like other MBeans. Through the ModelMBeanInfo Descriptors, values and methods in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * the managed application can be defined and mapped to attributes and operations of the ModelMBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * This mapping can be defined during development in an XML formatted file or dynamically and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * programmatically at runtime.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * Every ModelMBean which is instantiated in the MBeanServer becomes manageable:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * its attributes and operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * become remotely accessible through the connectors/adaptors connected to that MBeanServer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * A Java object cannot be registered in the MBeanServer unless it is a JMX compliant MBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * By instantiating a ModelMBean, resources are guaranteed that the MBean is valid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * MBeanException and RuntimeOperationsException must be thrown on every public method.  This allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * for wrapping exceptions from distributed communications (RMI, EJB, etc.).  These exceptions do
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * not have to be thrown by the implementation except in the scenarios described in the specification
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * and javadoc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
public interface ModelMBeanNotificationBroadcaster extends NotificationBroadcaster
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
         * Sends a Notification which is passed in to the registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         * Notification listeners on the ModelMBean as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
         * jmx.modelmbean.generic notification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
         * @param ntfyObj The notification which is to be passed to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
         * the 'handleNotification' method of the listener object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
         * @exception MBeanException Wraps a distributed communication Exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
         * @exception RuntimeOperationsException Wraps an IllegalArgumentException:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
         *       The Notification object passed in parameter is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        public void sendNotification(Notification ntfyObj)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        throws MBeanException, RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
         * Sends a Notification which contains the text string that is passed in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
         * to the registered Notification listeners on the ModelMBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
         * @param ntfyText The text which is to be passed in the Notification to the 'handleNotification'
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
         * method of the listener object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
         * the constructed Notification will be:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
         *   type        "jmx.modelmbean.generic"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
         *   source      this ModelMBean instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
         *   sequence    1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
         * @exception MBeanException Wraps a distributed communication Exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
         * @exception RuntimeOperationsException Wraps an IllegalArgumentException:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
         *       The Notification text string passed in parameter is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        public void sendNotification(String ntfyText)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        throws MBeanException, RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
         * Sends an attributeChangeNotification which is passed in to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
         * the registered attributeChangeNotification listeners on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
         * ModelMBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
         * @param notification The notification which is to be passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
         * to the 'handleNotification' method of the listener object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
         * @exception MBeanException Wraps a distributed communication Exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
         * @exception RuntimeOperationsException Wraps an IllegalArgumentException: The AttributeChangeNotification object passed in parameter is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        public void sendAttributeChangeNotification(AttributeChangeNotification notification)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        throws MBeanException, RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
         * Sends an attributeChangeNotification which contains the old value and new value for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
         * attribute to the registered AttributeChangeNotification listeners on the ModelMBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
         * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
         * @param oldValue The original value for the Attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
         * @param newValue The current value for the Attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
         * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
         * The constructed attributeChangeNotification will be:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
         *   type        "jmx.attribute.change"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
         *   source      this ModelMBean instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
         *   sequence    1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
         *   attributeName oldValue.getName()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
         *   attributeType oldValue's class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
         *   attributeOldValue oldValue.getValue()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
         *   attributeNewValue newValue.getValue()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
         * </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
         * @exception MBeanException Wraps a distributed communication Exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
         * @exception RuntimeOperationsException Wraps an IllegalArgumentException: An Attribute object passed in parameter is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
         * or the names of the two Attribute objects in parameter are not the same.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        public void sendAttributeChangeNotification(Attribute oldValue, Attribute newValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        throws MBeanException, RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
         * Registers an object which implements the NotificationListener interface as a listener.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
         * object's 'handleNotification()' method will be invoked when any attributeChangeNotification is issued through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
         * or by the ModelMBean.  This does not include other Notifications.  They must be registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
         * for independently. An AttributeChangeNotification will be generated for this attributeName.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
         * @param listener The listener object which will handles notifications emitted by the registered MBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
         * @param attributeName The name of the ModelMBean attribute for which to receive change notifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
         *      If null, then all attribute changes will cause an attributeChangeNotification to be issued.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
         * @param handback The context to be sent to the listener with the notification when a notification is emitted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
         * @exception IllegalArgumentException The listener cannot be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
         * @exception MBeanException Wraps a distributed communication Exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
         * @exception RuntimeOperationsException Wraps an IllegalArgumentException The attribute name passed in parameter does not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
         * @see #removeAttributeChangeNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        public void addAttributeChangeNotificationListener(NotificationListener listener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                                                           String attributeName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                                                           Object handback)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        throws MBeanException, RuntimeOperationsException, IllegalArgumentException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
         * Removes a listener for attributeChangeNotifications from the RequiredModelMBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
         * @param listener The listener name which was handling notifications emitted by the registered MBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
         * This method will remove all information related to this listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
         * @param attributeName The attribute for which the listener no longer wants to receive attributeChangeNotifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
         * If null the listener will be removed for all attributeChangeNotifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
         * @exception ListenerNotFoundException The listener is not registered in the MBean or is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
         * @exception MBeanException Wraps a distributed communication Exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
         * @exception RuntimeOperationsException Wraps an IllegalArgumentException If the inAttributeName parameter does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
         * correspond to an attribute name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
         * @see #addAttributeChangeNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        public void removeAttributeChangeNotificationListener(NotificationListener listener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                                                              String attributeName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        throws MBeanException, RuntimeOperationsException, ListenerNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
}