protected Map getTableMap()

in src/main/java/net/hydromatic/optiq/impl/csv/CsvSchema.java [50:84]


  protected Map<String, Table> getTableMap() {
    final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
    File[] files = directoryFile.listFiles(
        new FilenameFilter() {
          public boolean accept(File dir, String name) {
            return name.endsWith(".csv") || name.endsWith(".json");
          }
        });
    if (files == null) {
      System.out.println("directory " + directoryFile + " not found");
      files = new File[0];
    }
    for (File file : files) {
      String tableName = file.getName();
      if (tableName.endsWith(".json")) {
        tableName = tableName.substring(
            0, tableName.length() - ".json".length());
        JsonTable table = new JsonTable(file);
        builder.put(tableName, table);
        continue;
      }
      if (tableName.endsWith(".csv")) {
        tableName = tableName.substring(
            0, tableName.length() - ".csv".length());
      }
      final CsvTable table;
      if (smart) {
        table = new CsvSmartTable(file, null);
      } else {
        table = new CsvTable(file, null);
      }
      builder.put(tableName, table);
    }
    return builder.build();
  }