Esempio n. 1
0
  public static void init(File configFile) {
    File[] files = configFile.listFiles();

    treeConfigurations = new LinkedList<TreeConfiguration>();

    if (files.length == 0) {
      for (TreeConfiguration defaultConfiguration : Defaults.getDefaults()) {
        File filename =
            new File(configFile + File.separator + defaultConfiguration.getAlgorithm() + ".cfg");

        Configuration config = new Configuration(filename);
        config.load();
        defaultConfiguration.readConfig(config);
        treeConfigurations.add(defaultConfiguration);
        config.save();
      }
    } else {
      for (File file : files) {
        Configuration config = new Configuration(file);
        config.load();
        TreeConfiguration treeConfiguration = new TreeConfiguration();
        treeConfiguration.readConfig(config);
        treeConfigurations.add(treeConfiguration);
      }
    }

    mapTreeNameToConfiguration();
  }
Esempio n. 2
0
 private static void mapTreeNameToConfiguration() {
   treeNameToConfiguration = new HashMap<String, TreeConfiguration>();
   for (TreeConfiguration treeConfiguration : treeConfigurations) {
     treeNameToConfiguration.put(treeConfiguration.getName().toLowerCase(), treeConfiguration);
   }
 }