Class FileSystemSaveableConfigContainer<T>
- java.lang.Object
-
- org.opennms.netmgt.config.dao.common.impl.FileSystemSaveableConfigContainer<T>
-
- All Implemented Interfaces:
ReloadableConfigContainer<T>
,SaveableConfigContainer<T>
public class FileSystemSaveableConfigContainer<T> extends Object implements SaveableConfigContainer<T>
Contains a JAXB annotated entity that is backed by a file on disk. The file is held in aAbstractWritableJaxbConfigDao
and is subject to the reloading strategy of that class.
-
-
Constructor Summary
Constructors Constructor Description FileSystemSaveableConfigContainer(Class<T> clazz, String configName, Collection<java.util.function.Consumer<T>> onConfigChangeCallbacks, File configFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getConfig()
Lock
getReadLock()
Lock
getWriteLock()
void
reload()
Instruct the container to reload the in-memory configuration from the backing configuration.void
saveConfig()
Overwrite the backing configuration with the in-memory copy of the configuration.
-
-
-
Method Detail
-
saveConfig
public void saveConfig()
Description copied from interface:SaveableConfigContainer
Overwrite the backing configuration with the in-memory copy of the configuration.- Specified by:
saveConfig
in interfaceSaveableConfigContainer<T>
-
reload
public void reload()
Description copied from interface:ReloadableConfigContainer
Instruct the container to reload the in-memory configuration from the backing configuration. This may block if the backing configuration is not immediately available.- Specified by:
reload
in interfaceReloadableConfigContainer<T>
-
getConfig
public T getConfig()
- Specified by:
getConfig
in interfaceReloadableConfigContainer<T>
- Returns:
- the in-memory copy of the configuration which may be reloaded as part of this request depending on the implementation
-
getReadLock
public Lock getReadLock()
- Specified by:
getReadLock
in interfaceSaveableConfigContainer<T>
-
getWriteLock
public Lock getWriteLock()
- Specified by:
getWriteLock
in interfaceSaveableConfigContainer<T>
-
-