Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.util
Class SyncedPropertiesFile

java.lang.Object
  extended by eu.esdihumboldt.util.SyncedPropertiesFile
Direct Known Subclasses:
ProjectProperties

public class SyncedPropertiesFile
extends Object

Properties file that is in sync with its physical counterpart.

Author:
Simon Templer

Constructor Summary
SyncedPropertiesFile(File propertiesFile, Properties defaults)
          Create a synced properties file.
 
Method Summary
 String getProperty(String key)
          Get the property value for the given key.
 String getPropertyQuiet(String key)
          Get the property value for the given key.
 void setProperty(String key, String value)
          Set the property value for the given key.
 void setPropertyQuiet(String key, String value)
          Set the property value for the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncedPropertiesFile

public SyncedPropertiesFile(File propertiesFile,
                            Properties defaults)
                     throws IOException
Create a synced properties file.

Parameters:
propertiesFile - the properties file
defaults - the default properties, may be null
Throws:
IOException - if reading the file fails
Method Detail

getProperty

public String getProperty(String key)
                   throws IOException
Get the property value for the given key. Before retrieving the property value, the properties are synced with the file.

Parameters:
key - the property key
Returns:
the property value or null if no default is found
Throws:
IOException - if syncing with the file fails.

getPropertyQuiet

public String getPropertyQuiet(String key)
Get the property value for the given key. Before retrieving the property value, the properties are synced with the file, a failure is ignored.

Parameters:
key - the property key
Returns:
the property value or null if no default is found

setProperty

public void setProperty(String key,
                        String value)
                 throws IOException
Set the property value for the given key. Before and after setting the property value, the properties are synced with the file.

Parameters:
key - the property key
value - the property value
Throws:
IOException - if syncing with the file fails.

setPropertyQuiet

public void setPropertyQuiet(String key,
                             String value)
Set the property value for the given key. Before and after setting the property value, the properties are synced with the file, a failure is ignored.

Parameters:
key - the property key
value - the property value

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d