@Override
  public void openDatabase() throws CantOpenDatabaseException, DatabaseNotFoundException {

    String databasePath = "";
    /** if owner id if null because it comes from platformdatabase */
    if (ownerId != null)
      // databasePath =  this.context.getFilesDir().getPath() +  "/databases/" +
      // ownerId.toString();
      databasePath = EnvironmentVariables.getExternalStorageDirectory() + "/" + ownerId.toString();
    else
      // databasePath =  this.context.getFilesDir().getPath() + "/databases/";
      databasePath = String.valueOf(EnvironmentVariables.getExternalStorageDirectory());

    File storagePath = new File(databasePath);
    if (!storagePath.exists()) {
      // storagePath.mkdirs();
      throw new DatabaseNotFoundException();
    } else {

      databasePath += "/" + databaseName.replace("-", "") + ".db";

      this.Database = DesktopDatabaseBridge.openDatabase(databasePath, null, 0, null);
    }

    databasePath += "/" + this.databaseName.replace("-", "") + ".db";

    Database = DesktopDatabaseBridge.openDatabase(databasePath, null, 0, null);
  }
  /**
   * Delete a specific database file if used by a plugin, It use plugin id to define directory path
   * name
   *
   * @param databaseName name of database to deleted
   * @throws CantOpenDatabaseException
   * @throws DatabaseNotFoundException
   */
  public void deleteDatabase(String databaseName)
      throws CantOpenDatabaseException, DatabaseNotFoundException {

    try {
      // determine directry path name
      String databasePath = "";
      /** if owner id if null because it comes from platformdatabase */
      if (ownerId != null)
        databasePath =
            EnvironmentVariables.getExternalStorageDirectory() + "/" + ownerId.toString();
      // databasePath =  this.context.getFilesDir().getPath() +  "/databases/" +
      // ownerId.toString();
      else databasePath = String.valueOf(EnvironmentVariables.getExternalStorageDirectory());
      // databasePath =  this.context.getFilesDir().getPath() + "/databases/";

      databasePath += "/" + databaseName.replace("-", "") + ".db";
      File databaseFile = new File(databasePath);

      DesktopDatabaseBridge.deleteDatabase(databaseFile);

    } catch (Exception exception) {

      /** unexpected error deleting the database * * */
      throw new DatabaseNotFoundException();
    }
  }
  /** This method execute a string query command in database */
  @Override
  public void executeQuery(String query) throws CantExecuteQueryException {

    try {
      Database.execSQL(query);
    } catch (SQLException exception) {
      throw new CantExecuteQueryException(exception);
    }
  }
  /** DatabaseFactory interface implementation. */
  @Override
  public void createDatabase(String databaseName) throws CantCreateDatabaseException {

    /** First I try to open the database. */
    try {

      String databasePath = "";
      /** if owner id if null because it comes from platformdatabase */

      // preguntar si conviene más centralizar la carpeta de base de datos o hacer un contexto
      // individual

      if (ownerId != null)
        databasePath =
            EnvironmentVariables.getExternalStorageDirectory() + "/" + ownerId.toString();
      // databasePath =  this.context.getFilesDir().getPath() +   "/databases/" +
      // ownerId.toString();
      else databasePath = String.valueOf(EnvironmentVariables.getExternalStorageDirectory());
      // databasePath =  this.context.getFilesDir().getPath() +  "/databases/" ;

      File storagePath = new File(databasePath);
      if (!storagePath.exists()) {
        storagePath.mkdirs();
      }

      /** Hash data base name */
      databasePath += "/" + databaseName.replace("-", "") + ".db";
      File databaseFile = new File(databasePath);
      this.Database = DesktopDatabaseBridge.openOrCreateDatabase(databaseFile, null);

    } catch (Exception exception) {

      /**
       * Probably there is no distinctions between a database that it can not be opened and a one
       * that doesn't not exist. We will assume that if it didn't open it was because it didn't
       * exist. * *
       */
      throw new CantCreateDatabaseException();
    }
  }
  public void openDatabase(String databaseName)
      throws CantOpenDatabaseException, DatabaseNotFoundException {

    /** First I try to open the database. */
    try {
      String databasePath = "";
      /** if owner id if null because it comes from platformdatabase */
      if (ownerId != null)
        // databasePath =  this.context.getFilesDir().getPath() +  "/databases/" +
        // ownerId.toString();
        databasePath =
            EnvironmentVariables.getExternalStorageDirectory() + "/" + ownerId.toString();
      else databasePath = String.valueOf(EnvironmentVariables.getExternalStorageDirectory());

      File storagePath = new File(databasePath);
      if (!storagePath.exists()) {
        // storagePath.mkdirs();
        throw new DatabaseNotFoundException();
      } else {

        databasePath += "/" + databaseName.replace("-", "") + ".db";

        this.Database = DesktopDatabaseBridge.openDatabase(databasePath, null, 0, null);
      }

    } catch (Exception exception) {

      /**
       * Probably there is no distinctions between a database that it can not be opened and a one
       * that doesn't not exist. We will assume that if it didn't open it was because it didn't
       * exist. * *
       */
      throw new DatabaseNotFoundException();
      // TODO: NATALIA; Revisa si devuelve la misma exception cuando la base de datos no existe que
      // cuando simplement no la puede abrir por otra razon. Y avisame el resultado de la
      // investigacion esta.
    }
  }