2 * Copyright (c) 2015 Brocade Communications Systems, Inc. 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 com.typesafe.config.Config;
14 * Implementation of ModuleShardConfigProvider that reads the module and shard configuration from files.
16 * @author Thomas Pantelis
18 public class FileModuleShardConfigProvider extends AbstractModuleShardConfigProvider {
19 private final String moduleShardsConfigPath;
20 private final String modulesConfigPath;
22 public FileModuleShardConfigProvider(final String moduleShardsConfigPath, final String modulesConfigPath) {
23 this.moduleShardsConfigPath = moduleShardsConfigPath;
24 this.modulesConfigPath = modulesConfigPath;
28 public Map<String, ModuleConfig.Builder> retrieveModuleConfigs(final Configuration configuration) {
29 Config moduleShardsConfig = loadConfigFromPath(moduleShardsConfigPath);
30 Config modulesConfig = loadConfigFromPath(modulesConfigPath);
32 final Map<String, ModuleConfig.Builder> moduleConfigMap = readModuleShardsConfig(moduleShardsConfig);
33 readModulesConfig(modulesConfig, moduleConfigMap, configuration);
34 return moduleConfigMap;