01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.org
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package javax.management;
09:
10: /**
11: * Represents a notification emitted by the MBean server through the MBeanServerDelegate MBean.
12: * The MBean Server emits the following types of notifications: MBean registration, MBean
13: * de-registration.
14: * <P>
15: * To receive to MBeanServerNotifications, you need to be declared as listener to
16: * the {@link javax.management.MBeanServerDelegate javax.management.MBeanServerDelegate} MBean
17: * that represents the MBeanServer. The ObjectName of the MBeanServerDelegate is:
18: * <CODE>JMImplementation:type=MBeanServerDelegate</CODE>.
19: *
20: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
21: */
22:
23: public class MBeanServerNotification extends Notification {
24:
25: /**
26: * Notification type denoting that an MBean has been registered. Value is "JMX.mbean.registered".
27: */
28: public static final String REGISTRATION_NOTIFICATION = "jmx.mbean.registered";
29:
30: /**
31: * Notification type denoting that an MBean has been unregistered. Value is "JMX.mbean.unregistered".
32: */
33: public static final String UNREGISTRATION_NOTIFICATION = "jmx.mbean.unregistered";
34:
35: /** The object names of the MBeans concerned by this notification */
36: private ObjectName objectName = null;
37:
38: /**
39: * Creates an MBeanServerNotification object specifying object names of
40: * the MBeans that caused the notification and the specified notification type.
41: *
42: * @param type A string denoting the type of the notification. Set it to one these values:
43: * REGISTRATION_NOTIFICATION, UNREGISTRATION_NOTIFICATION
44: * @param source The MBeanServerNotification object responsible for forwarding MBean server notification.
45: * @param objectName The object name of the MBean that caused the notification.
46: *
47: */
48: public MBeanServerNotification(String type, Object source,
49: long sequenceNumber, ObjectName objectName) {
50: super (type, source, sequenceNumber);
51: this .objectName = objectName;
52: }
53:
54: /**
55: * Returns the object name of the MBean that caused the notification.
56: *
57: */
58: public ObjectName getMBeanName() {
59: return objectName;
60: }
61:
62: }
|