001/* NotificationBroadcaster.java -- Interface for broadcasters. 002 Copyright (C) 2006 Free Software Foundation, Inc. 003 004This file is part of GNU Classpath. 005 006GNU Classpath is free software; you can redistribute it and/or modify 007it under the terms of the GNU General Public License as published by 008the Free Software Foundation; either version 2, or (at your option) 009any later version. 010 011GNU Classpath is distributed in the hope that it will be useful, but 012WITHOUT ANY WARRANTY; without even the implied warranty of 013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014General Public License for more details. 015 016You should have received a copy of the GNU General Public License 017along with GNU Classpath; see the file COPYING. If not, write to the 018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 01902110-1301 USA. 020 021Linking this library statically or dynamically with other modules is 022making a combined work based on this library. Thus, the terms and 023conditions of the GNU General Public License cover the whole 024combination. 025 026As a special exception, the copyright holders of this library give you 027permission to link this library with independent modules to produce an 028executable, regardless of the license terms of these independent 029modules, and to copy and distribute the resulting executable under 030terms of your choice, provided that you also meet, for each linked 031independent module, the terms and conditions of the license of that 032module. An independent module is a module which is not derived from 033or based on this library. If you modify this library, you may extend 034this exception to your version of the library, but you are not 035obligated to do so. If you do not wish to do so, delete this 036exception statement from your version. */ 037 038package javax.management; 039 040/** 041 * <p> 042 * Represents a bean that can emit notifications when 043 * events occur. Other beans can use this interface 044 * to add themselves to the list of recipients of such 045 * notifications. 046 * </p> 047 * <p> 048 * <strong>Note</strong>: New classes should use 049 * {@link NotificationEmitter}, a subinterface of this, 050 * in preference to using this interface directly. 051 * </p> 052 * 053 * @author Andrew John Hughes (gnu_andrew@member.fsf.org) 054 * @since 1.5 055 */ 056public interface NotificationBroadcaster 057{ 058 059 /** 060 * Registers the specified listener as a new recipient of 061 * notifications from this bean. If non-null, the filter 062 * argument will be used to select which notifications are 063 * delivered. The supplied object will also be passed to 064 * the recipient with each notification. This should not 065 * be modified by the broadcaster, but instead should be 066 * passed unmodified to the listener. 067 * 068 * @param listener the new listener, who will receive 069 * notifications from this broadcasting bean. 070 * @param filter a filter to determine which notifications are 071 * delivered to the listener, or <code>null</code> 072 * if no filtering is required. 073 * @param passback an object to be passed to the listener with 074 * each notification. 075 * @throws IllegalArgumentException if <code>listener</code> is 076 * <code>null</code>. 077 * @see #removeNotificationListener(NotificationListener) 078 */ 079 void addNotificationListener(NotificationListener listener, 080 NotificationFilter filter, 081 Object passback) 082 throws IllegalArgumentException; 083 084 /** 085 * Returns an array describing the notifications this 086 * bean may send to its registered listeners. Ideally, this 087 * array should be complete, but in some cases, this may 088 * not be possible. However, be aware that some listeners 089 * may expect this to be so. 090 * 091 * @return the array of possible notifications. 092 */ 093 MBeanNotificationInfo[] getNotificationInfo(); 094 095 /** 096 * Removes the specified listener from the list of recipients 097 * of notifications from this bean. This includes all combinations 098 * of filters and passback objects registered for this listener. 099 * For more specific removal of listeners, see the subinterface 100 * {@link NotificationEmitter}. 101 * 102 * @param listener the listener to remove. 103 * @throws ListenerNotFoundException if the specified listener 104 * is not registered with this bean. 105 * @see #addNotificationListener(NotificationListener, NotificationFilter, 106 * java.lang.Object) 107 */ 108 void removeNotificationListener(NotificationListener listener) 109 throws ListenerNotFoundException; 110 111}