예제 #1
0
  /**
   * Default constructor
   *
   * @throws DBNotFoundException
   */
  public DBServerImpl() {
    this.dbList = new ArrayList<DB>();
    // /////////////////////////////////
    // Bootstrap databases

    // filter for .dbcsv file
    FilenameFilter filter =
        new FilenameFilter() {
          public boolean accept(File dir, String name) {
            return name.endsWith(".dbcsv");
          }
        };

    File listDir = new File("./");
    File[] listFiles = listDir.listFiles(filter);
    // for all files --> create database
    try {
      for (File file : listFiles) {
        String dbName = file.getName().replaceAll(".dbcsv", "");
        DB database = new DB(dbName);
        database.loadDatabase(); // load database
        this.dbList.add(database);
      }
    } catch (DBNotFoundException e) {
      e.printStackTrace();
    }
  }