org.eigenbase.util.property
Class PersistentPropertyStorage

java.lang.Object
  extended by org.eigenbase.util.property.PersistentPropertyStorage

 class PersistentPropertyStorage
extends Object

PersistentPropertyStorage handles storage for persistent property objects. For example, see PersistentStringProperty.

Since:
December 3, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/property/PersistentPropertyStorage.java#11 $
Author:
stephan

Field Summary
private  File propertyFile
           
private static HashMap propertyFileMap
           
 
Constructor Summary
private PersistentPropertyStorage(File propertyFile)
          Creates a PersistentPropertyStorage for the given property file.
 
Method Summary
(package private) static PersistentPropertyStorage newPersistentPropertyStorage(String propertyFile)
          Factory method for PersistentPropertyStorage.
(package private)  void storeProperty(Property property)
          Stores the given property's value in the property file.
private  void writePropertyValue(Writer writer, Property property)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyFileMap

private static final HashMap propertyFileMap

propertyFile

private File propertyFile
Constructor Detail

PersistentPropertyStorage

private PersistentPropertyStorage(File propertyFile)
Creates a PersistentPropertyStorage for the given property file.

Parameters:
propertyFile - the name of the property file to use
Method Detail

newPersistentPropertyStorage

static PersistentPropertyStorage newPersistentPropertyStorage(String propertyFile)
                                                       throws IOException
Factory method for PersistentPropertyStorage. Guarantees that only a single PersistentPropertyStorage object exists for any property file.

Parameters:
propertyFile - the name of the property file to use
Throws:
IOException - if propertyFile cannot be converted into a canonical path name (via File.getCanonicalPath()).

storeProperty

void storeProperty(Property property)
             throws IOException
Stores the given property's value in the property file. Unlike Properties.store(java.io.OutputStream, String) this method does not obliterate the format of the existing property file.

Parameters:
property - a Property value to store.
Throws:
IOException - if a temporary file cannot be created (File.createTempFile(String, String)) or written, or if the property file given during construction cannot be created (if it didn't already exist) or written.

writePropertyValue

private void writePropertyValue(Writer writer,
                                Property property)
                         throws IOException
Throws:
IOException