org.jboss.test.jmx.xmbean
Class XMLFilePersistenceManager

java.lang.Object
  extended byorg.jboss.test.jmx.xmbean.XMLFilePersistenceManager
All Implemented Interfaces:
PersistenceManager (src)

public class XMLFilePersistenceManager
extends java.lang.Object
implements PersistenceManager (src)

XML File Persistence Manager.

Persists the MBean to the file system using an XML file. The file has to follow this (simple) DTD:

 
 
 
 


Field Summary
protected  boolean isLoading
          A flag set to true to prevent attribute updates from within load triggering stores.
protected static Logger (src) log
           
 
Constructor Summary
XMLFilePersistenceManager()
           
 
Method Summary
protected  java.io.File getStoreFile(MBeanInfo (src)  metadata, boolean createFile)
          Obtain the store location from the ModelMBean Descriptor.
protected  boolean isLoading()
           
 void load(ModelMBeanInvoker (src)  mbean, MBeanInfo (src)  metadata)
          Loads the attributes from the given file
protected  void setIsLoading(boolean newIsLoading)
           
 void store(MBeanInfo (src)  metadata)
          What we need to get here is 1) the persist location, and 2) the entire contents of the mbean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Logger (src)  log

isLoading

protected boolean isLoading
A flag set to true to prevent attribute updates from within load triggering stores.

Constructor Detail

XMLFilePersistenceManager

public XMLFilePersistenceManager()
Method Detail

load

public void load(ModelMBeanInvoker (src)  mbean,
                 MBeanInfo (src)  metadata)
          throws MBeanException (src) 
Loads the attributes from the given file

Specified by:
load in interface PersistenceManager (src)
Parameters:
mbean - to store to
metadata - with file location etc.
Throws:
MBeanException (src)

store

public void store(MBeanInfo (src)  metadata)
           throws MBeanException (src) 
What we need to get here is 1) the persist location, and 2) the entire contents of the mbean. #2 contains the entire contents (state) of the model object, as well as the meta data that the mbean provides. As such, serializing this (MBeanInfo) object (brute force) in effect serializes the model as well.

Specified by:
store in interface PersistenceManager (src)
Parameters:
metadata -
Throws:
MBeanException (src)

isLoading

protected boolean isLoading()

setIsLoading

protected void setIsLoading(boolean newIsLoading)

getStoreFile

protected java.io.File getStoreFile(MBeanInfo (src)  metadata,
                                    boolean createFile)
                             throws MBeanException (src) 
Obtain the store location from the ModelMBean Descriptor. If the file name does not end on ".xml", it will be converted to do so.

Parameters:
metadata -
createFile -
Returns:
Throws:
MBeanException (src)