org.benow.java.config.persist
Class XMLConfigurationPersister
java.lang.Object
org.benow.java.config.ConfigurationPersisterImpl
org.benow.java.config.persist.XMLConfigurationPersister
- All Implemented Interfaces:
- ConfigurationMonitor, ConfigurationPersister
public class XMLConfigurationPersister
- extends ConfigurationPersisterImpl
A persister that reads and writes in xml format.
FEATURE add file monitoring.
FEATURE buffer writes.
onChange element, add elem to thread, index by package, update pkg timestamp. on timestamp timeout, flush
package to file.
FEATURE write initially to temp file in same dir then rename. Prevents corruption on disk
full
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLConfigurationPersister
public XMLConfigurationPersister()
write
public void write(java.util.Vector<ConfigurationEntry> toWrite)
- Rewrite package config file. NOTE: a bit of overhead when changing many entries within a class or
package. Could have a triggered timeout or be within a transaction. NOTE is destructive. comments to
config won't be carried forth, etc. Tried non-destructive, but removeChild didn't work, resulting in
repeated additions, despite clearing.
NOTE: synchronized so as to not fail on write
- Specified by:
write in interface ConfigurationPersister- Overrides:
write in class ConfigurationPersisterImpl
doWrite
protected void doWrite(ConfigurationEntry toWrite)
- Specified by:
doWrite in class ConfigurationPersisterImpl
getOverridenValue
protected java.lang.Object getOverridenValue(ConfigurationEntry entry)
- Description copied from class:
ConfigurationPersisterImpl
- Get the overriden value for the given entry, if any
- Specified by:
getOverridenValue in class ConfigurationPersisterImpl
- Returns:
- overriden value, or null if not overridden
loadDocument
public static org.w3c.dom.Document loadDocument(java.io.InputStream docStream)
throws java.lang.Exception
- Throws:
java.lang.Exception
elementToString
public static java.lang.String elementToString(org.w3c.dom.Element toShow)
toString
public static java.lang.String toString(java.io.InputStream docStream)
throws java.io.IOException,
java.lang.Exception
- Throws:
java.io.IOException
java.lang.Exception
getSource
public java.lang.String getSource()
- Returns:
- string identifying where persistence is happening
hasOverridenValue
public boolean hasOverridenValue(ConfigurationEntryImpl entry)
- Specified by:
hasOverridenValue in class ConfigurationPersisterImpl