01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package javax.management;
23:
24: /**
25: * This interface is implemented by an MBean that wants to perform
26: * operations pre and post registration and deregistration.<p>
27: *
28: * The preRegister method is called by the MBeanServer before registration.<p>
29: *
30: * The postRegister method is called by the MBeanServer after registration.<p>
31: *
32: * The preDeregister method is called by the MBeanServer before deregistration.<p>
33: *
34: * The postDeregister method is called by the MBeanServer after deregistration.<p>
35: *
36: * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
37: * @version $Revision: 57200 $
38: *
39: */
40: public interface MBeanRegistration {
41: // Constants ---------------------------------------------------
42:
43: // Public ------------------------------------------------------
44:
45: /**
46: * This method is called by the MBeanServer before registration takes
47: * place. The MBean is passed a reference of the MBeanServer it is
48: * about to be registered with. The MBean must return the ObjectName it
49: * will be registered with. The MBeanServer can pass a suggested object
50: * depending upon how the MBean is registered.<p>
51: *
52: * The MBean can stop the registration by throwing an exception.The
53: * exception is forwarded to the invoker wrapped in an
54: * MBeanRegistrationException.
55: *
56: * @param MBeanServer the MBeanServer the MBean is about to be
57: * registered with.
58: * @param ObjectName the suggested ObjectName supplied by the
59: * MBeanServer.
60: * @return the actual ObjectName to register this MBean with.
61: * @exception Exception for any error, the MBean is not registered.
62: */
63: public ObjectName preRegister(MBeanServer server, ObjectName name)
64: throws Exception;
65:
66: /**
67: * This method is called by the MBeanServer after registration takes
68: * place or when registration fails.
69: *
70: * @param registrationDone the MBeanServer passes true when the
71: * MBean was registered, false otherwise.
72: */
73: public void postRegister(Boolean registrationDone);
74:
75: /**
76: * This method is called by the MBeanServer before deregistration takes
77: * place.<p>
78: *
79: * The MBean can throw an exception, this will stop the deregistration.
80: * The exception is forwarded to the invoker wrapped in
81: * an MBeanRegistrationException.
82: */
83: public void preDeregister() throws Exception;
84:
85: /**
86: * This method is called by the MBeanServer after deregistration takes
87: * place.
88: */
89: public void postDeregister();
90: }
|