|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<java.lang.Object,java.lang.Object>
java.util.Properties
com.gridsystems.utils.FileProperties
public class FileProperties
This class implements a Properties object linked to a File object. Changes in the file will be automatically updated, and changes in the object will produce changes in the file.
| Field Summary | |
|---|---|
protected java.io.File |
f
The source file for the property data. |
protected java.lang.String |
header
The header to set when writing the file. |
protected long |
lastModified
The last known modification time of the file. |
protected java.util.concurrent.atomic.AtomicInteger |
lockWrite
A flag indicating if a setProperty should invoke commit. |
static java.lang.Boolean |
synchronize
This value controls the access synchronised to the security files. |
protected long |
ts
Last update time. |
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
FileProperties(java.io.File f)
Create a file linked Properties object. |
|
FileProperties(java.io.File f,
java.util.Properties defaults)
Creates a file linked Properties object, with the specified default values. |
|
| Method Summary | |
|---|---|
void |
commit()
Propagates changes in memory to the file associated with this object. |
boolean |
getBoolProperty(java.lang.String key)
Gets a property as a boolean value. |
int |
getIntProperty(java.lang.String key)
Gets a property as an int value. |
int |
getIntProperty(java.lang.String key,
int defaultValue)
Generic property access method for integer properties. |
long |
getLongProperty(java.lang.String key)
Gets a property as a long value. |
long |
getLongProperty(java.lang.String key,
long def)
Gets a property as a long value. |
java.lang.String |
getProperty(java.lang.String key)
Searches for the property with the specified key in this property list. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Searches for the property with the specified key in this property list. |
void |
lockWrites()
It locks commits. |
java.util.Enumeration<?> |
propertyNames()
Returns an enumeration of all the keys in this property list, including the keys in the default property list. |
void |
setFile(java.io.File f)
Sets the file associated to this instance. |
void |
setHeader(java.lang.String header)
Sets the text of the header that will be written to the file. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Calls the hashtable method put. |
protected void |
sync()
If associated file is older than current version, updates the properties from the file. |
void |
unlockWrites()
It unlocks commits and commits the last changes. |
| Methods inherited from class java.util.Properties |
|---|
list, list, load, load, loadFromXML, save, store, store, storeToXML, storeToXML, stringPropertyNames |
| 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 |
| Field Detail |
|---|
public static java.lang.Boolean synchronize
protected java.io.File f
protected long lastModified
protected long ts
protected java.lang.String header
protected java.util.concurrent.atomic.AtomicInteger lockWrite
| Constructor Detail |
|---|
public FileProperties(java.io.File f,
java.util.Properties defaults)
f - The file to link todefaults - The default valuespublic FileProperties(java.io.File f)
f - The file to link to| Method Detail |
|---|
public void setHeader(java.lang.String header)
header - The header text to usepublic void setFile(java.io.File f)
f - The filepublic void lockWrites()
public void unlockWrites()
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
getProperty in class java.util.Propertieskey - the key.defaultValue - a default value.
public java.lang.String getProperty(java.lang.String key)
null if the property is not found.
getProperty in class java.util.Propertieskey - the property key.
public int getIntProperty(java.lang.String key,
int defaultValue)
key - The name of the propertydefaultValue - The default value to return in case of error
public int getIntProperty(java.lang.String key)
key - The property key
public boolean getBoolProperty(java.lang.String key)
key - The key of the property
public long getLongProperty(java.lang.String key)
key - The key of the property
public long getLongProperty(java.lang.String key,
long def)
key - The key of the propertydef - The default value in case of error
public java.lang.Object setProperty(java.lang.String key,
java.lang.String value)
put. Provided for
parallelism with the getProperty method. Enforces use of
strings for property keys and values.
setProperty in class java.util.Propertieskey - the key to be placed into this property list.value - the value corresponding to key.
public java.util.Enumeration<?> propertyNames()
propertyNames in class java.util.PropertiesEnumerationprotected void sync()
public void commit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||