/**
   * This method initialize the database
   *
   * @throws CantInitializeDatabaseException
   */
  private void initializeDb() throws CantInitializeDatabaseException {

    try {
      /*
       * Open new database connection
       */
      this.database =
          this.pluginDatabaseSystem.openDatabase(
              pluginId, ChatMiddlewareDatabaseConstants.DATABASE_NAME);

    } catch (CantOpenDatabaseException cantOpenDatabaseException) {

      /*
       * The database exists but cannot be open. I can not handle this situation.
       */
      errorManager.reportUnexpectedPluginException(
          Plugins.CHAT_MIDDLEWARE,
          UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN,
          cantOpenDatabaseException);
      throw new CantInitializeDatabaseException(cantOpenDatabaseException.getLocalizedMessage());

    } catch (DatabaseNotFoundException e) {

      /*
       * The database no exist may be the first time the plugin is running on this device,
       * We need to create the new database
       */
      ChatMiddlewareDatabaseFactory chatMiddlewareDatabaseFactory =
          new ChatMiddlewareDatabaseFactory(pluginDatabaseSystem);

      try {

        /*
         * We create the new database
         */
        this.database =
            chatMiddlewareDatabaseFactory.createDatabase(
                pluginId, ChatMiddlewareDatabaseConstants.DATABASE_NAME);

      } catch (CantCreateDatabaseException cantOpenDatabaseException) {

        /*
         * The database cannot be created. I can not handle this situation.
         */
        errorManager.reportUnexpectedPluginException(
            Plugins.CHAT_MIDDLEWARE,
            UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN,
            cantOpenDatabaseException);
        throw new CantInitializeDatabaseException(cantOpenDatabaseException.getLocalizedMessage());
      }
    }
  }
  /**
   * This method initialize the database
   *
   * @throws CantInitializeDatabaseException
   */
  private void initializeDb() throws CantInitializeDatabaseException {

    try {
      /*
       * Open new database connection
       */
      this.database =
          this.pluginDatabaseSystem.openDatabase(
              pluginId,
              BrokerSubmitOnlineMerchandiseBusinessTransactionDatabaseConstants.DATABASE_NAME);

    } catch (CantOpenDatabaseException cantOpenDatabaseException) {

      /*
       * The database exists but cannot be open. I can not handle this situation.
       */
      reportError(DISABLES_THIS_PLUGIN, cantOpenDatabaseException);
      throw new CantInitializeDatabaseException(cantOpenDatabaseException.getLocalizedMessage());

    } catch (DatabaseNotFoundException e) {

      /*
       * The database no exist may be the first time the plugin is running on this device,
       * We need to create the new database
       */
      BrokerSubmitOnlineMerchandiseBusinessTransactionDatabaseFactory factory =
          new BrokerSubmitOnlineMerchandiseBusinessTransactionDatabaseFactory(pluginDatabaseSystem);

      try {

        /*
         * We create the new database
         */
        this.database =
            factory.createDatabase(
                pluginId,
                BrokerSubmitOnlineMerchandiseBusinessTransactionDatabaseConstants.DATABASE_NAME);

      } catch (CantCreateDatabaseException cantOpenDatabaseException) {
        reportError(DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, cantOpenDatabaseException);
        throw new CantInitializeDatabaseException(cantOpenDatabaseException.getLocalizedMessage());
      }
    }
  }