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 26 27 package javax.management; 28 29 30 import javax.management.MBeanException; 31 import javax.management.RuntimeOperationsException; 32 import javax.management.InstanceNotFoundException; 33 34 /** 35 * This class is the interface to be implemented by MBeans that are meant to be 36 * persistent. MBeans supporting this interface should call the load method during 37 * construction in order to prime the MBean from the persistent store. 38 * In the case of a ModelMBean, the store method should be called by the MBeanServer based on the descriptors in 39 * the ModelMBean or by the MBean itself during normal processing of the ModelMBean. 40 * 41 * @since 1.5 42 */ 43 public interface PersistentMBean { 44 45 46 /** 47 * Instantiates thisMBean instance with the data found for 48 * the MBean in the persistent store. The data loaded could include 49 * attribute and operation values. 50 * 51 * This method should be called during construction or initialization of this instance, 52 * and before the MBean is registered with the MBeanServer. 53 * 54 * @exception MBeanException Wraps another exception or persistence is not supported 55 * @exception RuntimeOperationsException Wraps exceptions from the persistence mechanism 56 * @exception InstanceNotFoundException Could not find or load this MBean from persistent 57 * storage 58 */ 59 public void load() 60 throws MBeanException, RuntimeOperationsException, InstanceNotFoundException; 61 62 /** 63 * Captures the current state of this MBean instance and 64 * writes it out to the persistent store. The state stored could include 65 * attribute and operation values. If one of these methods of persistence is 66 * not supported a "serviceNotFound" exception will be thrown. 67 * <P> 68 * Persistence policy from the MBean and attribute descriptor is used to guide execution 69 * of this method. The MBean should be stored if 'persistPolicy' field is: 70 * <PRE> != "never" 71 * = "always" 72 * = "onTimer" and now > 'lastPersistTime' + 'persistPeriod' 73 * = "NoMoreOftenThan" and now > 'lastPersistTime' + 'persistPeriod' 74 * <P> 75 * Do not store the MBean if 'persistPolicy' field is: 76 * = "never" 77 * = "onUpdate" 78 * = "onTimer" && now < 'lastPersistTime' + 'persistPeriod' 79 * <P></PRE> 80 * 81 * @exception MBeanException Wraps another exception or persistence is not supported 82 * @exception RuntimeOperationsException Wraps exceptions from the persistence mechanism 83 * @exception InstanceNotFoundException Could not find/access the persistent store 84 */ 85 public void store() 86 throws MBeanException, RuntimeOperationsException, InstanceNotFoundException; 87 88 } 89