K - The type of the identifier which identifies data.V - The type of the data.public abstract class AbstractConfigFileUpdater<K,V> extends Object
AbstractConfigFileUpdater describes changes to be applied to the
configuration file.
Note that this class is not synchronized.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConfigFileUpdater(XmlConfigFile.Type ftype,
String desc)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addRemoved(K key)
Add the removed data to be removed from the configuration file.
|
boolean |
addUpdated(K key,
V value)
Add the updated data to be saved into the configuration file.
|
void |
apply(org.slf4j.Logger logger)
Apply changes to the configuration file.
|
protected void |
fixUp(org.slf4j.Logger logger)
Fix up changes before applying.
|
boolean |
isChanged(K key)
Determine whether the contents of the specified data is changed or not.
|
boolean |
isRemoved(K key)
Determine whether the data specified by the given key has been removed
or not.
|
protected abstract void |
onRemoved(K key)
Invoked when the configuration file associated with the given data
is removed.
|
protected abstract boolean |
onUpdated(K key,
V value)
Invoked when the given data is saved into the configuration file.
|
void |
setChanged(K key)
Mark the specified data as changed.
|
protected AbstractConfigFileUpdater(XmlConfigFile.Type ftype, String desc)
ftype - The type of the XML configuration file.desc - A brief description about the target data.public final boolean addUpdated(K key, V value)
key - The identifier of the given data.value - The value to be saved into the configuration file.true only if the given data was actually added.public boolean addRemoved(K key)
key - The identifier of the removed data.true only if the given data was actually added.public boolean isRemoved(K key)
key - The identifier of the data.true only if the specified data has been removed.public void setChanged(K key)
key - The identifier of the changed data.public boolean isChanged(K key)
key - The identifier of the data.true only if the contents of the specified data is
changed.public final void apply(org.slf4j.Logger logger)
logger - A Logger instance.protected void fixUp(org.slf4j.Logger logger)
This method in this class does nothing. Subclass can override this method to insert hook just before applying changes.
logger - A Logger instance.protected abstract boolean onUpdated(K key, V value)
key - The identifier of the given data.value - The value to be saved into the configuration file.true if the given data is newly created data.
Otherwise false.protected abstract void onRemoved(K key)
key - The identifier of the removed data.Copyright © 2018 OpenDaylight. All rights reserved.