X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2FPersisterAggregator.java;h=31a4f080368515c075872173e9ba066c830f5e0e;hb=f776809962df87deeaa533ba995cc6fceba64d0e;hp=7add448025b51794ef6ed0cc261e6dbd4cb50479;hpb=49bfc449558d0306f0b6550bc5bdf41e5cafca44;p=controller.git diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregator.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregator.java index 7add448025..31a4f08036 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregator.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregator.java @@ -9,7 +9,6 @@ package org.opendaylight.controller.netconf.persist.impl; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Optional; import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder; import org.opendaylight.controller.config.persist.api.Persister; import org.opendaylight.controller.config.persist.api.StorageAdapter; @@ -20,6 +19,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.ListIterator; @@ -34,21 +34,21 @@ import java.util.ListIterator; * Example configuration:
netconf.config.persister.active=2,3 # read startup configuration - netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.directory.DirectoryStorageAdapter + 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.FileStorageAdapter + 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.txt + netconf.config.persister.2.properties.fileStorage=configuration/current/controller.config.1.xml - netconf.config.persister.3.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.FileStorageAdapter - netconf.config.persister.3.properties.fileStorage=configuration/current/controller.config.2.txt + 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 {@link ConfigPersisterNotificationHandler} requests last snapshot from underlying storages. * Each storage can respond by giving snapshot or absent response. - * The {@link #loadLastConfig()} will search for first non-absent response from storages ordered backwards as user + * The {@link #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 @@ -61,7 +61,7 @@ public final class PersisterAggregator implements Persister { public static class PersisterWithConfiguration { - public final Persister storage; + private final Persister storage; private final boolean readOnly; public PersisterWithConfiguration(Persister storage, boolean readOnly) { @@ -69,6 +69,16 @@ public final class PersisterAggregator implements Persister { this.readOnly = readOnly; } + @VisibleForTesting + public Persister getStorage() { + return storage; + } + + @VisibleForTesting + public boolean isReadOnly() { + return readOnly; + } + @Override public String toString() { return "PersisterWithConfiguration{" + @@ -124,7 +134,7 @@ public final class PersisterAggregator implements Persister { public static PersisterAggregator createFromProperties(PropertiesProviderBaseImpl propertiesProvider) { List