2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.config;
10 import static java.util.Objects.requireNonNull;
12 import com.typesafe.config.Config;
15 public class HybridModuleShardConfigProvider extends AbstractModuleShardConfigProvider {
16 private final Config moduleShardsConfig;
17 private final String modulesConfigPath;
19 public HybridModuleShardConfigProvider(final Config moduleShardsConfig, final String modulesConfigPath) {
20 this.moduleShardsConfig = requireNonNull(moduleShardsConfig, "ModuleShardsConfig can't be null");
21 this.modulesConfigPath = modulesConfigPath;
25 public Map<String, ModuleConfig.Builder> retrieveModuleConfigs(final Configuration configuration) {
26 Config modulesConfig = loadConfigFromPath(modulesConfigPath);
28 final Map<String, ModuleConfig.Builder> moduleConfigMap = readModuleShardsConfig(this.moduleShardsConfig);
29 readModulesConfig(modulesConfig, moduleConfigMap, configuration);
30 return moduleConfigMap;