Persister
implementation that delegates persisting functionality to
underlying
Persister
storages. Each storage has unique id, class, readonly value.
Storage adapters are low level persisters that do the heavy lifting for this
class. Instances of storage adapters can be injected directly via constructor
or instantiated from a full name of its class provided in a properties file.
Example configuration:
netconf.config.persister.active=2,3
# read startup configuration
netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.directory.xml.XmlDirectoryStorageAdapter
netconf.config.persister.1.properties.fileStorage=configuration/initial/
netconf.config.persister.2.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter
netconf.config.persister.2.readonly=true
netconf.config.persister.2.properties.fileStorage=configuration/current/controller.config.1.xml
netconf.config.persister.3.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter
netconf.config.persister.3.properties.fileStorage=configuration/current/controller.config.2.xml
netconf.config.persister.3.properties.numberOfBackups=3
During server startup
ConfigPersisterNotificationHandler
requests last snapshot from underlying storages.
Each storage can respond by giving snapshot or absent response.
The
loadLastConfigs()
will search for first non-absent response from storages ordered backwards as user
specified (first '3', then '2').
When a commit notification is received, '2' will be omitted because readonly flag is set to true, so
only '3' will have a chance to persist new configuration. If readonly was false or not specified, both storage adapters
would be called in order specified by 'netconf.config.persister' property.