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 java.lang.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(java.lang.Class<T> clazz, java.lang.String configName, java.util.Collection<java.util.function.Consumer<T>> onConfigChangeCallbacks, java.io.File configFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getConfig()
java.util.concurrent.locks.Lock
getReadLock()
java.util.concurrent.locks.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 java.util.concurrent.locks.Lock getReadLock()
- Specified by:
getReadLock
in interfaceSaveableConfigContainer<T>
-
getWriteLock
public java.util.concurrent.locks.Lock getWriteLock()
- Specified by:
getWriteLock
in interfaceSaveableConfigContainer<T>
-
-