01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.org
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package javax.management;
09:
10: /**
11: * This class is the interface to be implemented by MBeans that are meant to be
12: * persistent. MBeans supporting this interface should call the load method during
13: * construction in order to prime the MBean from the persistent store.
14: * In the case of a ModelMBean, the store method should be called by the MBeanServer based on the descriptors in
15: * the ModelMBean or by the MBean itself during normal processing of the ModelMBean.
16: *
17: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
18: */
19:
20: public interface PersistentMBean {
21:
22: /**
23: * Instantiates thisMBean instance with the data found for
24: * the MBean in the persistent store. The data loaded could include
25: * attribute and operation values.
26: *
27: * This method should be called during construction or inialization of this instance,
28: * and before the MBean is registered with the MBeanServer.
29: *
30: * @exception MBeanException Wraps another exception or persistence is not supported
31: * @exception RuntimeOperationsException Wraps exceptions from the persistence mechanism
32: * @exception InstanceNotFoundException Could not find or load this MBean from persistent
33: * storage
34: */
35: public void load() throws MBeanException,
36: RuntimeOperationsException, InstanceNotFoundException;
37:
38: /**
39: * Captures the current state of this MMBean instance and
40: * writes it out to the persistent store. The state stored could include
41: * attribute and operation values. If one of these methods of persistence is
42: * not supported a "serviceNotFound" exception will be thrown.
43: * <P>
44: * Persistance policy from the mbean and attribute descriptor is used to guide execution
45: * of this method. The MBean should be stored if 'persistPolicy' field is:
46: * <PRE> != "never"
47: * = "always"
48: * = "onTimer" and now > 'lastPersistTime' + 'persistPeriod'
49: * = "NoMoreOftenThan" and now > 'lastPersistTime' + 'persistPeriod'
50: * <P>
51: * Do not store the MBean if 'persistPolicy' field is:
52: * = "never"
53: * = "onUpdate"
54: * = "onTimer" && now < 'lastPersistTime' + 'persistPeriod'
55: * <P></PRE>
56: *
57: * @exception MBeanException Wraps another exception or persistence is not supported
58: * @exception RuntimeOperationsException Wraps exceptions from the persistence mechanism
59: * @exception InstanceNotFoundException Could not find/access the persistant store
60: */
61: public void store() throws MBeanException,
62: RuntimeOperationsException, InstanceNotFoundException;
63:
64: }
|