PersistentMBean.java :  » JMX » XMOJO » javax » management » Java Open Source

Java Open Source » JMX » XMOJO 
XMOJO » javax » management » PersistentMBean.java
/**
* The XMOJO Project 5
* Copyright  2003 XMOJO.org. All rights reserved.

* NO WARRANTY

* BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
* THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
* OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
* PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
* OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
* TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE
* LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
* REPAIR OR CORRECTION.

* IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
* ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
* THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
* GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
* USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
* DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
* PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
* EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
**/

package javax.management;


/**
 * This class is the interface to be implemented by MBeans that are meant to
 * be persistent. MBeans supporting this interface should call the load method
 * during construction in order to prime the MBean from the persistent store.
 * In the case of a ModelMBean, the store method should be called by the
 * MBeanServer based on the descriptors in the ModelMBean or by the MBean
 * itself during normal processing of the ModelMBean.
 */
public interface PersistentMBean
{
    /**
     * Instantiates thisMBean instance with the data found for the MBean in
   * the persistent store.  The data loaded could include attribute
   * and operation values.
     *
     * This method should be called during construction or inialization of
   * this instance, and before the MBean is registered with the MBeanServer.
     *
     * @return Object - returns the handle of the persistent persion of the MBean.
     *
     * @exception MBeanException Wraps another exception or persistence is not supported.
     *
     * @exception RuntimeOperationsException Wraps exceptions from
   *         the persistence mechanism.
   *
     * @exception InstanceNotFoundException Could not find or load this MBean
   *         from persistent storage.
     */
  public void load() throws MBeanException,
                RuntimeOperationsException,
                InstanceNotFoundException;

    /**
     * Captures the current state of this MMBean instance and writes it out to
   * the persistent store.  The state stored could include  attribute and
   * operation values. If one of these methods of persistence is not
   * supported a "serviceNotFound" exception will be thrown.
     * <P>
     * Persistance policy from the mbean and attribute descriptor is used to
   * guide execution of this method. The MBean should be stored if
   * 'persistPolicy' field is:
     * <PRE>  != "never"
     *   = "always"
     *   = "onTimer" and now > 'lastPersistTime' + 'persistPeriod'
     *   = "NoMoreOftenThan" and now > 'lastPersistTime' + 'persistPeriod'
     * <P>
     * Do not store the MBean if 'persistPolicy' field is:
     *    = "never"
     *    = "onUpdate"
     *    = "onTimer" && now < 'lastPersistTime' + 'persistPeriod'
     * <P></PRE>
     *
     * @exception MBeanException Wraps another exception or persistence is not supported.
     *
     * @exception RuntimeOperationsException Wraps exceptions from
   *         the persistence mechanism.
   *
     * @exception InstanceNotFoundException Could not find/access the persistant store.
     */
  public void store() throws MBeanException,
                 RuntimeOperationsException,
                 InstanceNotFoundException;
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.