站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

ObjectStreamPersistenceManager (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


org.jboss.mx.persistence
Class ObjectStreamPersistenceManager

java.lang.Object
  extended byorg.jboss.mx.persistence.ObjectStreamPersistenceManager
All Implemented Interfaces:
PersistenceManager

public class ObjectStreamPersistenceManager
extends Object
implements PersistenceManager

Object Stream Persistence Manager.

Persists the MBean to the file system using an Object Stream. Includes code based on examples in Juha's JMX Book.

Object Streams written to disk are admittedly lacking in the area of "long-term", "portable", or "human-readable" persistence. They are fairly straightforward, however. Primarily, this class is useful for demonstration and "quick & dirty" persistence.

Version:
$Revision: 1.8 $
Author:
Matt Munz, Scott.Stark@jboss.org

Field Summary
protected  boolean isLoading
          A flag set to true to prevent attribute updates from within load triggering stores.
protected static org.jboss.logging.Logger log
           
 
Constructor Summary
ObjectStreamPersistenceManager()
           
 
Method Summary
protected  File getStoreFile(MBeanInfo metadata, boolean createFile)
           
protected  boolean isLoading()
           
 void load(ModelMBeanInvoker mbean, MBeanInfo metadata)
          deserializes state from the object input stream
protected  void loadFromMetadata(ModelMBeanInvoker mbean, ModelMBeanInfo metadata)
          Obtain the attribute values from the metadata and invoke setAttributes on the mbean invoker.
protected  void setIsLoading(boolean newIsLoading)
           
 void store(MBeanInfo 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 org.jboss.logging.Logger log

isLoading

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

Constructor Detail

ObjectStreamPersistenceManager

public ObjectStreamPersistenceManager()
Method Detail

load

public void load(ModelMBeanInvoker mbean,
                 MBeanInfo metadata)
          throws MBeanException
deserializes state from the object input stream

Specified by:
load in interface PersistenceManager
Parameters:
mbean -
metadata -
Throws:
MBeanException

store

public void store(MBeanInfo metadata)
           throws MBeanException
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
Parameters:
metadata -
Throws:
MBeanException

loadFromMetadata

protected void loadFromMetadata(ModelMBeanInvoker mbean,
                                ModelMBeanInfo metadata)
Obtain the attribute values from the metadata and invoke setAttributes on the mbean invoker.

Parameters:
mbean - the invoker and assocaited mbean resource
metadata - the metadata to use as the attributes value source

isLoading

protected boolean isLoading()

setIsLoading

protected void setIsLoading(boolean newIsLoading)

getStoreFile

protected File getStoreFile(MBeanInfo metadata,
                            boolean createFile)
                     throws MBeanException
Throws:
MBeanException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.