1. /*
  2. * @(#)MBeanRegistration.java 4.17 04/02/11
  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. * Can be implemented by an MBean in order to
  10. * carry out operations before and after being registered or unregistered from
  11. * the MBean server.
  12. *
  13. * @since 1.5
  14. */
  15. public interface MBeanRegistration {
  16. /**
  17. * Allows the MBean to perform any operations it needs before
  18. * being registered in the MBean server. If the name of the MBean
  19. * is not specified, the MBean can provide a name for its
  20. * registration. If any exception is raised, the MBean will not be
  21. * registered in the MBean server.
  22. *
  23. * @param server The MBean server in which the MBean will be registered.
  24. *
  25. * @param name The object name of the MBean. This name is null if
  26. * the name parameter to one of the <code>createMBean</code> or
  27. * <code>registerMBean</code> methods in the {@link MBeanServer}
  28. * interface is null. In that case, this method must return a
  29. * non-null ObjectName for the new MBean.
  30. *
  31. * @return The name under which the MBean is to be registered.
  32. * This value must not be null. If the <code>name</code>
  33. * parameter is not null, it will usually but not necessarily be
  34. * the returned value.
  35. *
  36. * @exception java.lang.Exception This exception will be caught by
  37. * the MBean server and re-thrown as an {@link
  38. * MBeanRegistrationException}.
  39. */
  40. public ObjectName preRegister(MBeanServer server,
  41. ObjectName name) throws java.lang.Exception;
  42. /**
  43. * Allows the MBean to perform any operations needed after having been
  44. * registered in the MBean server or after the registration has failed.
  45. *
  46. * @param registrationDone Indicates whether or not the MBean has
  47. * been successfully registered in the MBean server. The value
  48. * false means that the registration phase has failed.
  49. */
  50. public void postRegister(Boolean registrationDone);
  51. /**
  52. * Allows the MBean to perform any operations it needs before
  53. * being unregistered by the MBean server.
  54. *
  55. * @exception java.lang.Exception This exception will be caught by
  56. * the MBean server and re-thrown as an {@link
  57. * MBeanRegistrationException}.
  58. */
  59. public void preDeregister() throws java.lang.Exception ;
  60. /**
  61. * Allows the MBean to perform any operations needed after having been
  62. * unregistered in the MBean server.
  63. */
  64. public void postDeregister();
  65. }