1. /*
  2. * @(#)NotificationBroadcaster.java 1.35 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.management;
  8. /**
  9. * <p>Interface implemented by an MBean that emits Notifications. It
  10. * allows a listener to be registered with the MBean as a notification
  11. * listener.</p>
  12. *
  13. * <p>New code should use the {@link NotificationEmitter} interface
  14. * instead.</p>
  15. *
  16. * @since 1.5
  17. */
  18. public interface NotificationBroadcaster {
  19. /**
  20. * Adds a listener to this MBean.
  21. *
  22. * @param listener The listener object which will handle the
  23. * notifications emitted by the broadcaster.
  24. * @param filter The filter object. If filter is null, no
  25. * filtering will be performed before handling notifications.
  26. * @param handback An opaque object to be sent back to the
  27. * listener when a notification is emitted. This object cannot be
  28. * used by the Notification broadcaster object. It should be
  29. * resent unchanged with the notification to the listener.
  30. *
  31. * @exception IllegalArgumentException Listener parameter is null.
  32. *
  33. * @see #removeNotificationListener
  34. */
  35. public void addNotificationListener(NotificationListener listener,
  36. NotificationFilter filter,
  37. Object handback)
  38. throws java.lang.IllegalArgumentException;
  39. /**
  40. * Removes a listener from this MBean. If the listener
  41. * has been registered with different handback objects or
  42. * notification filters, all entries corresponding to the listener
  43. * will be removed.
  44. *
  45. * @param listener A listener that was previously added to this
  46. * MBean.
  47. *
  48. * @exception ListenerNotFoundException The listener is not
  49. * registered with the MBean.
  50. *
  51. * @see #addNotificationListener
  52. * @see NotificationEmitter#removeNotificationListener
  53. */
  54. public void removeNotificationListener(NotificationListener listener)
  55. throws ListenerNotFoundException;
  56. /**
  57. * <p>Returns an array indicating, for each notification this
  58. * MBean may send, the name of the Java class of the notification
  59. * and the notification type.</p>
  60. *
  61. * <p>It is not illegal for the MBean to send notifications not
  62. * described in this array. However, some clients of the MBean
  63. * server may depend on the array being complete for their correct
  64. * functioning.</p>
  65. *
  66. * @return the array of possible notifications.
  67. */
  68. public MBeanNotificationInfo[] getNotificationInfo();
  69. }