Source code: javax/management/MBeanRegistration.java
1 /*
2 * JBoss, the OpenSource J2EE webOS
3 *
4 * Distributable under LGPL license.
5 * See terms of license at gnu.org.
6 */
7 package javax.management;
8
9 /**
10 * This interface is implemented by an MBean that wants to perform
11 * operations pre and post registration and deregistration.<p>
12 *
13 * The preRegister method is called by the MBeanServer before registration.<p>
14 *
15 * The postRegister method is called by the MBeanServer after registration.<p>
16 *
17 * The preDeregister method is called by the MBeanServer before deregistration.<p>
18 *
19 * The postDeregister method is called by the MBeanServer after deregistration.<p>
20 *
21 * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
22 * @version $Revision: 1.3 $
23 *
24 */
25 public interface MBeanRegistration
26 {
27 // Constants ---------------------------------------------------
28
29 // Public ------------------------------------------------------
30
31 /**
32 * This method is called by the MBeanServer before registration takes
33 * place. The MBean is passed a reference of the MBeanServer it is
34 * about to be registered with. The MBean must return the ObjectName it
35 * will be registered with. The MBeanServer can pass a suggested object
36 * depending upon how the MBean is registered.<p>
37 *
38 * The MBean can stop the registration by throwing an exception.The
39 * exception is forwarded to the invoker wrapped in an
40 * MBeanRegistrationException.
41 *
42 * @param MBeanServer the MBeanServer the MBean is about to be
43 * registered with.
44 * @param ObjectName the suggested ObjectName supplied by the
45 * MBeanServer.
46 * @return the actual ObjectName to register this MBean with.
47 * @exception Exception for any error, the MBean is not registered.
48 */
49 public ObjectName preRegister(MBeanServer server, ObjectName name)
50 throws Exception;
51
52 /**
53 * This method is called by the MBeanServer after registration takes
54 * place or when registration fails.
55 *
56 * @param registrationDone the MBeanServer passes true when the
57 * MBean was registered, false otherwise.
58 */
59 public void postRegister(Boolean registrationDone);
60
61 /**
62 * This method is called by the MBeanServer before deregistration takes
63 * place.<p>
64 *
65 * The MBean can throw an exception, this will stop the deregistration.
66 * The exception is forwarded to the invoker wrapped in
67 * an MBeanRegistrationException.
68 */
69 public void preDeregister()
70 throws Exception;
71
72 /**
73 * This method is called by the MBeanServer after deregistration takes
74 * place.
75 */
76 public void postDeregister();
77 }