001 /* NotificationBroadcaster.java -- Interface for broadcasters. 002 Copyright (C) 2006 Free Software Foundation, Inc. 003 004 This file is part of GNU Classpath. 005 006 GNU Classpath is free software; you can redistribute it and/or modify 007 it under the terms of the GNU General Public License as published by 008 the Free Software Foundation; either version 2, or (at your option) 009 any later version. 010 011 GNU Classpath is distributed in the hope that it will be useful, but 012 WITHOUT ANY WARRANTY; without even the implied warranty of 013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 General Public License for more details. 015 016 You should have received a copy of the GNU General Public License 017 along with GNU Classpath; see the file COPYING. If not, write to the 018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 019 02110-1301 USA. 020 021 Linking this library statically or dynamically with other modules is 022 making a combined work based on this library. Thus, the terms and 023 conditions of the GNU General Public License cover the whole 024 combination. 025 026 As a special exception, the copyright holders of this library give you 027 permission to link this library with independent modules to produce an 028 executable, regardless of the license terms of these independent 029 modules, and to copy and distribute the resulting executable under 030 terms of your choice, provided that you also meet, for each linked 031 independent module, the terms and conditions of the license of that 032 module. An independent module is a module which is not derived from 033 or based on this library. If you modify this library, you may extend 034 this exception to your version of the library, but you are not 035 obligated to do so. If you do not wish to do so, delete this 036 exception statement from your version. */ 037 038 package 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 */ 056 public 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 } 112