Exemple #1
0
  private void readModuleShards(Config moduleShardsConfig) {
    List<? extends ConfigObject> moduleShardsConfigObjectList =
        moduleShardsConfig.getObjectList("module-shards");

    for (ConfigObject moduleShardConfigObject : moduleShardsConfigObjectList) {

      String moduleName = moduleShardConfigObject.get("name").unwrapped().toString();

      List<? extends ConfigObject> shardsConfigObjectList =
          moduleShardConfigObject.toConfig().getObjectList("shards");

      List<Shard> shards = new ArrayList<>();

      for (ConfigObject shard : shardsConfigObjectList) {
        String shardName = shard.get("name").unwrapped().toString();
        List<String> replicas = shard.toConfig().getStringList("replicas");
        shards.add(new Shard(shardName, replicas));
      }

      this.moduleShards.add(new ModuleShard(moduleName, shards));
    }
  }
Exemple #2
0
 public String stringValue(String name) {
   return configObject.get(name).unwrapped().toString();
 }