1 package org.opendaylight.controller.cluster.common.actor;
3 import com.google.common.base.Preconditions;
4 import com.typesafe.config.Config;
5 import com.typesafe.config.ConfigFactory;
7 import java.util.HashMap;
10 public abstract class AbstractConfig implements UnifiedConfig {
12 private Config config;
14 public AbstractConfig(Config config){
23 public static abstract class Builder<T extends Builder>{
24 protected Map<String, Object> configHolder;
25 protected Config fallback;
27 private final String actorSystemName;
29 public Builder(String actorSystemName){
30 Preconditions.checkArgument(actorSystemName != null, "Actor system name must not be null");
31 this.actorSystemName = actorSystemName;
32 configHolder = new HashMap<>();
35 public T withConfigReader(AkkaConfigurationReader reader){
36 fallback = reader.read().getConfig(actorSystemName);
40 protected Config merge(){
42 fallback = ConfigFactory.load().getConfig(actorSystemName);
44 return ConfigFactory.parseMap(configHolder).withFallback(fallback);