public BasicDatastore(String dir, String name) throws SQLException, IOException {
    Preconditions.checkNotNull(dir);
    Preconditions.checkNotNull(name);

    this.datastoreDir = dir;
    this.datastoreName = name;
    this.extensionsDir = FilenameUtils.concat(this.datastoreDir, "extensions");
    String dbFilename = FilenameUtils.concat(this.datastoreDir, DB_FILE_NAME);
    this.sqlDb = SQLDatabaseFactory.openSqlDatabase(dbFilename);
    this.updateSchema();
    this.eventBus = new EventBus();
    this.attachmentManager = new AttachmentManager(this);
  }
 private void updateSchema() throws SQLException {
   SQLDatabaseFactory.updateSchema(this.sqlDb, DatastoreConstants.getSchemaVersion3(), 3);
   SQLDatabaseFactory.updateSchema(this.sqlDb, DatastoreConstants.getSchemaVersion4(), 4);
   SQLDatabaseFactory.updateSchema(this.sqlDb, DatastoreConstants.getSchemaVersion5(), 5);
 }