org.apache.avalon.cornerstone.blocks.masterstore.xml
Class XMLFilePersistentObjectRepository

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.cornerstone.blocks.masterstore.AbstractFileRepository
          extended byorg.apache.avalon.cornerstone.blocks.masterstore.xml.XMLFilePersistentObjectRepository
All Implemented Interfaces:
Configurable, Contextualizable, Initializable, LogEnabled, ObjectRepository, Repository, Serviceable

public class XMLFilePersistentObjectRepository
extends AbstractFileRepository
implements ObjectRepository

This is a simple implementation of persistent object store using XML serialization from JDK 1.4 to a file system. This implementation of ObjectRepository comes with the following warning: "XMLEncoder provides suitable persistence delegates for all public subclasses of java.awt.Component in J2SE and the types of all of their properties, recursively. All other classes will be handled with the default persistence delegate which assumes the class follows the beans conventions" (snipped from the BugParade) Basically, don't use this block for anything other than Swing component serialization. Sun will have to do a lot of work writing a "PersistenceDelegate" to handle other JDK types let alone custom classes.

Author:
Paul Hammant, Stefano Mazzocchi, Federico Barbieri

Field Summary
 
Fields inherited from class org.apache.avalon.cornerstone.blocks.masterstore.AbstractFileRepository
BYTE_MASK, DEBUG, HANDLED_URL, HEX_DIGITS, m_baseDirectory, m_destination, m_extension, m_filter, m_name, m_path, m_serviceManager
 
Constructor Summary
XMLFilePersistentObjectRepository()
           
 
Method Summary
 Object get(String key)
          Get the object associated to the given unique key.
 Object get(String key, ClassLoader classLoader)
           
protected  String getExtensionDecorator()
           
 void put(String key, Object value)
          Store the given object and associates it to the given key
 
Methods inherited from class org.apache.avalon.cornerstone.blocks.masterstore.AbstractFileRepository
configure, containsKey, contextualize, createChildRepository, decode, encode, getChildRepository, getFile, getInputStream, getOutputStream, initialize, list, remove, service, setDestination
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.cornerstone.services.store.ObjectRepository
containsKey, list, remove
 
Methods inherited from interface org.apache.avalon.cornerstone.services.store.Repository
getChildRepository
 

Constructor Detail

XMLFilePersistentObjectRepository

public XMLFilePersistentObjectRepository()
Method Detail

getExtensionDecorator

protected String getExtensionDecorator()
Specified by:
getExtensionDecorator in class AbstractFileRepository

get

public Object get(String key)
Get the object associated to the given unique key.

Specified by:
get in interface ObjectRepository

get

public Object get(String key,
                  ClassLoader classLoader)
Specified by:
get in interface ObjectRepository

put

public void put(String key,
                Object value)
Store the given object and associates it to the given key

Specified by:
put in interface ObjectRepository


Copyright © Apache Software Foundation. All Rights Reserved.