1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.init.rev160407;
import io.fd.honeycomb.data.init.RestoringInitializer;
import java.nio.file.InvalidPathException;
import java.nio.file.Paths;
import org.opendaylight.controller.config.api.JmxAttributeValidationException;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.api.rev160411.DatatreeType;
/**
* Initializer restoring data from a persisted file
*/
public class PersistedFileInitializerModule extends AbstractPersistedFileInitializerModule {
public PersistedFileInitializerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
public PersistedFileInitializerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, PersistedFileInitializerModule oldModule, java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
@Override
public void customValidation() {
try {
Paths.get(getPersistFilePath());
} catch (InvalidPathException e) {
throw new JmxAttributeValidationException("Invalid persist path", e, persistFilePathJmxAttribute);
}
}
@Override
public java.lang.AutoCloseable createInstance() {
return new RestoringInitializer(getSchemaServiceDependency(), Paths.get(getPersistFilePath()),
getDomDataBrokerDependency(), getRestorationType(),
getDatastoreType() == DatatreeType.Config ? LogicalDatastoreType.CONFIGURATION : LogicalDatastoreType.OPERATIONAL);
}
}
|