1. /*
  2. * @(#)file PersistentMBean.java
  3. * @(#)author IBM Corp.
  4. * @(#)version 1.19
  5. * @(#)lastedit 04/02/10
  6. *
  7. *
  8. * Copyright IBM Corp. 1999-2000. All rights reserved.
  9. *
  10. * The program is provided "as is" without any warranty express or implied,
  11. * including the warranty of non-infringement and the implied warranties of
  12. * merchantibility and fitness for a particular purpose. IBM will not be
  13. * liable for any damages suffered by you or any third party claim against
  14. * you regarding the Program.
  15. *
  16. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  17. * This software is the proprietary information of Sun Microsystems, Inc.
  18. * Use is subject to license terms.
  19. *
  20. * Copyright 2004 Sun Microsystems, Inc. Tous droits reserves.
  21. * Ce logiciel est propriete de Sun Microsystems, Inc.
  22. * Distribue par des licences qui en restreignent l'utilisation.
  23. *
  24. */
  25. package javax.management;
  26. import javax.management.MBeanException;
  27. import javax.management.RuntimeOperationsException;
  28. import javax.management.InstanceNotFoundException;
  29. /**
  30. * This class is the interface to be implemented by MBeans that are meant to be
  31. * persistent. MBeans supporting this interface should call the load method during
  32. * construction in order to prime the MBean from the persistent store.
  33. * In the case of a ModelMBean, the store method should be called by the MBeanServer based on the descriptors in
  34. * the ModelMBean or by the MBean itself during normal processing of the ModelMBean.
  35. *
  36. * @since 1.5
  37. */
  38. public interface PersistentMBean {
  39. /**
  40. * Instantiates thisMBean instance with the data found for
  41. * the MBean in the persistent store. The data loaded could include
  42. * attribute and operation values.
  43. *
  44. * This method should be called during construction or initialization of this instance,
  45. * and before the MBean is registered with the MBeanServer.
  46. *
  47. * @exception MBeanException Wraps another exception or persistence is not supported
  48. * @exception RuntimeOperationsException Wraps exceptions from the persistence mechanism
  49. * @exception InstanceNotFoundException Could not find or load this MBean from persistent
  50. * storage
  51. */
  52. public void load()
  53. throws MBeanException, RuntimeOperationsException, InstanceNotFoundException;
  54. /**
  55. * Captures the current state of this MBean instance and
  56. * writes it out to the persistent store. The state stored could include
  57. * attribute and operation values. If one of these methods of persistence is
  58. * not supported a "serviceNotFound" exception will be thrown.
  59. * <P>
  60. * Persistence policy from the MBean and attribute descriptor is used to guide execution
  61. * of this method. The MBean should be stored if 'persistPolicy' field is:
  62. * <PRE> != "never"
  63. * = "always"
  64. * = "onTimer" and now > 'lastPersistTime' + 'persistPeriod'
  65. * = "NoMoreOftenThan" and now > 'lastPersistTime' + 'persistPeriod'
  66. * <P>
  67. * Do not store the MBean if 'persistPolicy' field is:
  68. * = "never"
  69. * = "onUpdate"
  70. * = "onTimer" && now < 'lastPersistTime' + 'persistPeriod'
  71. * <P></PRE>
  72. *
  73. * @exception MBeanException Wraps another exception or persistence is not supported
  74. * @exception RuntimeOperationsException Wraps exceptions from the persistence mechanism
  75. * @exception InstanceNotFoundException Could not find/access the persistent store
  76. */
  77. public void store()
  78. throws MBeanException, RuntimeOperationsException, InstanceNotFoundException;
  79. }