Пример #1
0
  public OpenGdmsFilePanel(String title, DriverManager driverManager) {
    super(OPEN_GDMS_FILE_PANEL, title);

    Driver[] filtered = driverManager.getDrivers(new FileDriverFilter());
    for (int i = 0; i < filtered.length; i++) {
      FileDriver fileDriver = (FileDriver) filtered[i];
      String[] extensions = fileDriver.getFileExtensions();
      this.addFilter(extensions, fileDriver.getTypeDescription());
    }
  }
  @Override
  public DataSource createDataSource(String tableName, ProgressMonitor pm)
      throws DataSourceCreationException {
    if (!file.exists()) {
      throw new DataSourceCreationException(
          file + " " + I18N.getString("gdms.datasource.error.noexits"));
    }

    final FileDriver driver;
    try {
      driver = getDriver();
    } catch (DriverException ex) {
      throw new DataSourceCreationException(ex);
    }

    driver.setDataSourceFactory(getDataSourceFactory());

    FileDataSourceAdapter ds = new FileDataSourceAdapter(getSource(tableName), file, driver, false);
    return ds;
  }