01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package javax.management;
10:
11: /**
12: * Defines a series of callbacks that allow the MBean to interact with the process of MBean
13: * registration and unregistration performed by the MBeanServer.
14: * Implementing this interface is an easy way for an MBean to get the reference to the
15: * MBeanServer that manages it.
16: *
17: * @version $Revision: 1.6 $
18: */
19: public interface MBeanRegistration {
20: /**
21: * Callback called just before MBean registration in the MBeanServer.
22: * Any exception thrown by this method will cause the MBean registration to abort.
23: *
24: * @param server The MBeanServer on which the MBean will be registered.
25: * @param name The <code>ObjectName</code> of the MBean.
26: * @return The <code>ObjectName</code> of the registered MBean, must not be null
27: * @throws Exception Any possible exception generated by this method will be caught
28: * by the <code>MBeanServer</code> and re-thrown as an <code>MBeanRegistrationException</code>
29: * to the client.
30: */
31: public ObjectName preRegister(MBeanServer server, ObjectName name)
32: throws Exception;
33:
34: /**
35: * Callback called just after the MBean has been registered (successfully or not).
36: *
37: * @param registrationDone True if the registration was successful, false otherwise.
38: */
39: public void postRegister(Boolean registrationDone);
40:
41: /**
42: * Callback called just before MBean unregistration from the MBeanServer.
43: * Any exception thrown by this method will cause the MBean unregistration to abort.
44: *
45: * @throws Exception Any possible exception generated by this method will be caught
46: * by the <code>MBeanServer</code> and re-thrown as an <code>MBeanRegistrationException</code>
47: * to the client.
48: */
49: public void preDeregister() throws Exception;
50:
51: /**
52: * Callback called just after the MBean has been successfully unregistered.
53: */
54: public void postDeregister();
55: }
|