Class PersistentProperties
- java.lang.Object
- 
- java.util.Dictionary<K,V>
- 
- java.util.Hashtable<java.lang.Object,java.lang.Object>
- 
- java.util.Properties
- 
- com.inductiveautomation.ignition.common.PersistentProperties
 
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable,- java.util.Map<java.lang.Object,java.lang.Object>
 
 public class PersistentProperties extends java.util.PropertiesA simple extension of properties that is meant to represent a file based property file. The entire property file will be written eventually after a call to setProperty(), according to the max storage frequency.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected boolean_savePausedprotected intmaxStorageFrequencyMSprotected booleanwriteQueuedprotected java.lang.ThreadwriteThread
 - 
Constructor SummaryConstructors Constructor Description PersistentProperties()PersistentProperties(java.io.File file, java.lang.String comments)PersistentProperties(java.io.File file, java.lang.String comments, boolean requireInitial)Creates a new PersistentProperties object.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopyFile(java.io.File source, java.io.File dest)java.io.FilegetFile()intgetMaxStorageFrequencyMS()Returns the maximum rate at which the file will be written.java.io.FilegetTempFile()booleanisNew()java.util.Set<java.lang.Object>keySet()protected voidpotentiallyExecuteWrite()java.lang.Objectremove(java.lang.Object key)java.lang.ObjectremoveIntermediate(java.lang.Object key)voidsetMaxStorageFrequencyMS(int maxStorageFrequencyMS)Sets the maximum rate at which the file will be written.java.lang.ObjectsetProperty(java.lang.String key, java.lang.String value)java.lang.ObjectsetPropertyIntermediate(java.lang.String key, java.lang.String value)Sets a property without pesisting the change.voidstoreChanges()Do the following to ensure there is always a well-formed file on the HD Write file to temp file Copy temp file to main fileprotected voidtryLoad(java.io.File file)Tries to call super.loadFromXML with an input stream from this file.- 
Methods inherited from class java.util.Propertiesclear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, replace, replace, replaceAll, save, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
 
- 
 
- 
- 
- 
Constructor Detail- 
PersistentPropertiespublic PersistentProperties(java.io.File file, java.lang.String comments) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
PersistentPropertiespublic PersistentProperties(java.io.File file, java.lang.String comments, boolean requireInitial) throws java.io.IOExceptionCreates a new PersistentProperties object. The backup file will be "."+filename+".bak" and the clean file will be filename+"_clean".- Parameters:
- requireInitial- Whether or not a valid file or _clean file is required. If false, the constructor will accept the situation where none of the 3 files exist.
- Throws:
- java.io.IOException
 
 - 
PersistentPropertiespublic PersistentProperties() 
 
- 
 - 
Method Detail- 
getMaxStorageFrequencyMSpublic int getMaxStorageFrequencyMS() Returns the maximum rate at which the file will be written. After a property is set, the file is written immediately, unless the specified time has not passed, in which case the file will be marked as "dirty" and written when the delay expires.Defaults to 500ms. 
 - 
setMaxStorageFrequencyMSpublic void setMaxStorageFrequencyMS(int maxStorageFrequencyMS) Sets the maximum rate at which the file will be written. If 0, writes will occur immediately, and in the same thread, instead of asynchronously.
 - 
isNewpublic boolean isNew() 
 - 
getFilepublic java.io.File getFile() 
 - 
getTempFilepublic java.io.File getTempFile() 
 - 
tryLoadprotected void tryLoad(java.io.File file) throws java.io.IOExceptionTries to call super.loadFromXML with an input stream from this file.- Throws:
- java.io.IOException- if anything goes wrong with the load.
 
 - 
removeIntermediatepublic java.lang.Object removeIntermediate(java.lang.Object key) 
 - 
removepublic java.lang.Object remove(java.lang.Object key) - Specified by:
- removein interface- java.util.Map<java.lang.Object,java.lang.Object>
- Overrides:
- removein class- java.util.Properties
 
 - 
setPropertypublic java.lang.Object setProperty(java.lang.String key, java.lang.String value)- Overrides:
- setPropertyin class- java.util.Properties
 
 - 
setPropertyIntermediatepublic java.lang.Object setPropertyIntermediate(java.lang.String key, java.lang.String value)Sets a property without pesisting the change.
 - 
keySetpublic java.util.Set<java.lang.Object> keySet() - Specified by:
- keySetin interface- java.util.Map<java.lang.Object,java.lang.Object>
- Overrides:
- keySetin class- java.util.Properties
 
 - 
storeChangespublic void storeChanges() Do the following to ensure there is always a well-formed file on the HD- Write file to temp file
- Copy temp file to main file
 
 - 
potentiallyExecuteWriteprotected void potentiallyExecuteWrite() 
 - 
copyFileprotected void copyFile(java.io.File source, java.io.File dest) throws java.io.IOException- Throws:
- java.io.IOException
 
 
- 
 
-