1. /*
  2. * @(#)MBeanServerNotification.java 4.24 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. * Represents a notification emitted by the MBean server through the MBeanServerDelegate MBean.
  10. * The MBean Server emits the following types of notifications: MBean registration, MBean
  11. * de-registration.
  12. * <P>
  13. * To receive to MBeanServerNotifications, you need to be declared as listener to
  14. * the {@link javax.management.MBeanServerDelegate javax.management.MBeanServerDelegate} MBean
  15. * that represents the MBeanServer. The ObjectName of the MBeanServerDelegate is:
  16. * <CODE>JMImplementation:type=MBeanServerDelegate</CODE>.
  17. *
  18. * @since 1.5
  19. */
  20. public class MBeanServerNotification extends Notification {
  21. /* Serial version */
  22. private static final long serialVersionUID = 2876477500475969677L;
  23. /**
  24. * Notification type denoting that an MBean has been registered. Value is "JMX.mbean.registered".
  25. */
  26. public static final String REGISTRATION_NOTIFICATION = "JMX.mbean.registered" ;
  27. /**
  28. * Notification type denoting that an MBean has been unregistered. Value is "JMX.mbean.unregistered".
  29. */
  30. public static final String UNREGISTRATION_NOTIFICATION = "JMX.mbean.unregistered" ;
  31. /**
  32. * @serial The object names of the MBeans concerned by this notification
  33. */
  34. private final ObjectName objectName;
  35. /**
  36. * Creates an MBeanServerNotification object specifying object names of
  37. * the MBeans that caused the notification and the specified notification type.
  38. *
  39. * @param type A string denoting the type of the
  40. * notification. Set it to one these values: {@link
  41. * #REGISTRATION_NOTIFICATION}, {@link
  42. * #UNREGISTRATION_NOTIFICATION}.
  43. * @param source The MBeanServerNotification object responsible
  44. * for forwarding MBean server notification.
  45. * @param sequenceNumber A sequence number that can be used to order
  46. * received notifications.
  47. * @param objectName The object name of the MBean that caused the notification.
  48. *
  49. */
  50. public MBeanServerNotification(String type, Object source, long sequenceNumber, ObjectName objectName ) {
  51. super (type,source,sequenceNumber) ;
  52. this.objectName = objectName ;
  53. }
  54. /**
  55. * Returns the object name of the MBean that caused the notification.
  56. *
  57. * @return the object name of the MBean that caused the notification.
  58. */
  59. public ObjectName getMBeanName() {
  60. return objectName ;
  61. }
  62. }