at.spardat.xma.boot.util
Class PropertyFile

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended byat.spardat.xma.boot.util.PropertyFile
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class PropertyFile
extends java.util.Properties

PropertiesFile which automatically flushes its properties into its file.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
PropertyFile(java.io.File file, boolean debug)
          ProertyFile backed by the specified "file"
PropertyFile(java.io.File file, java.lang.String header)
          ProertyFile backed by the specified "file"
 
Method Summary
 java.lang.String getProperty(java.lang.String key)
          Returns the value of the specified key, or null if the key does not exist.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Returns the value of the specified key, or the default value if the key does not exist.
 java.io.File getStoreFile()
          get the underlying file_
 void load()
          load from file_
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
          Sets the value for the specified key and updates the corresponding .ifo file.
 java.lang.Object setPropertyNoflush(java.lang.String key, java.lang.String value)
          Sets the value for the specified key without updating the file now.
 void store()
          Saves the properties to the file_.
 
Methods inherited from class java.util.Properties
list, list, load, propertyNames, save, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyFile

public PropertyFile(java.io.File file,
                    java.lang.String header)
             throws java.io.IOException
ProertyFile backed by the specified "file"

Parameters:
file - the file to save and load to
header - the file header
Throws:
java.io.IOException - containing the filename

PropertyFile

public PropertyFile(java.io.File file,
                    boolean debug)
             throws java.io.IOException
ProertyFile backed by the specified "file"

Parameters:
file - the file to save and load to
debug - if true trace information is writen into the log file
Throws:
java.io.IOException - containing the filename
Method Detail

getProperty

public java.lang.String getProperty(java.lang.String key)
Returns the value of the specified key, or null if the key does not exist.

Parameters:
key - key to look for

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Returns the value of the specified key, or the default value if the key does not exist.


setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Sets the value for the specified key and updates the corresponding .ifo file.

Returns:
the previous value
Throws:
java.lang.RuntimeException - if the property could not be persisted

setPropertyNoflush

public java.lang.Object setPropertyNoflush(java.lang.String key,
                                           java.lang.String value)
Sets the value for the specified key without updating the file now.

Returns:
the previous value
Since:
1.3.1

getStoreFile

public java.io.File getStoreFile()
get the underlying file_


load

public void load()
          throws java.io.IOException
load from file_

Throws:
java.io.IOException - containing the filename

store

public void store()
           throws java.io.IOException
Saves the properties to the file_.

Throws:
java.io.IOException - containing the filename