@Override
 public void stop() {
   try {
     processorAgent.stop();
     this.serviceStatus = ServiceStatus.STOPPED;
   } catch (Exception exception) {
     reportError(
         DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, FermatException.wrapException(exception));
   }
 }
  @Override
  public void start() throws CantStartPluginException {
    try {

      /** Initialize database */
      initializeDb();

      /*
       * Initialize Developer Database Factory
       */
      brokerSubmitOnlineMerchandiseBusinessTransactionDeveloperDatabaseFactory =
          new BrokerSubmitOnlineMerchandiseBusinessTransactionDeveloperDatabaseFactory(
              pluginDatabaseSystem, pluginId);
      brokerSubmitOnlineMerchandiseBusinessTransactionDeveloperDatabaseFactory.initializeDatabase();

      /** Initialize Dao */
      BrokerSubmitOnlineMerchandiseBusinessTransactionDao
          brokerSubmitOnlineMerchandiseBusinessTransactionDao =
              new BrokerSubmitOnlineMerchandiseBusinessTransactionDao(
                  pluginDatabaseSystem, pluginId, database, this);

      /** Init the plugin manager */
      // TODO: the following two lines are only for testing, please, comment them when the testing
      // is finished.
      // customerBrokerContractSaleManager=new CustomerBrokerContractSaleManagerMock();
      // customerBrokerSaleNegotiationManager=new SaleNegotiationManagerMock();
      this.brokerSubmitOnlineMerchandiseTransactionManager =
          new BrokerSubmitOnlineMerchandiseTransactionManager(
              brokerSubmitOnlineMerchandiseBusinessTransactionDao,
              this.customerBrokerContractSaleManager,
              this.customerBrokerSaleNegotiationManager,
              this.cryptoBrokerWalletManager,
              this);

      /** Init event recorder service. */
      BrokerSubmitOnlineMerchandiseRecorderService brokerSubmitOnlineMerchandiseRecorderService =
          new BrokerSubmitOnlineMerchandiseRecorderService(
              brokerSubmitOnlineMerchandiseBusinessTransactionDao, eventManager, this);
      brokerSubmitOnlineMerchandiseRecorderService.start();

      /** Init monitor Agent */
      /*BrokerSubmitOnlineMerchandiseMonitorAgent brokerSubmitOnlineMerchandiseMonitorAgent = new BrokerSubmitOnlineMerchandiseMonitorAgent(
              pluginDatabaseSystem,
              logManager,
              this,
              eventManager,
              pluginId,
              transactionTransmissionManager,
              customerBrokerContractPurchaseManager,
              customerBrokerContractSaleManager,
              outgoingIntraActorManager,
              cryptoMoneyDeStockManager,
              intraWalletUserIdentityManager,
              customerBrokerPurchaseNegotiationManager);

      brokerSubmitOnlineMerchandiseMonitorAgent.start();*/

      // New Agent starting
      processorAgent =
          new BrokerSubmitOnlineMerchandiseMonitorAgent2(
              SLEEP_TIME,
              TIME_UNIT,
              DELAY_TIME,
              this,
              eventManager,
              brokerSubmitOnlineMerchandiseBusinessTransactionDao,
              transactionTransmissionManager,
              customerBrokerContractPurchaseManager,
              customerBrokerContractSaleManager,
              customerBrokerPurchaseNegotiationManager,
              outgoingIntraActorManager,
              cryptoMoneyDeStockManager,
              intraWalletUserIdentityManager);
      processorAgent.start();

      this.serviceStatus = ServiceStatus.STARTED;
      // System.out.println("Broker submit online merchandise starting");
      // Todo: Test method, please comment it when the test is finish.
      // testSubmit();
    } catch (
        CantInitializeBrokerSubmitOnlineMerchandiseBusinessTransactionDatabaseException exception) {
      reportError(DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, exception);
      throw new CantStartPluginException(
          FermatException.wrapException(exception),
          "Starting Broker Submit Offline Merchandise Plugin",
          "Cannot initialize the plugin database factory");
    } catch (CantInitializeDatabaseException exception) {
      reportError(DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, exception);
      throw new CantStartPluginException(
          FermatException.wrapException(exception),
          "Starting Broker Submit Offline Merchandise Plugin",
          "Cannot initialize the database plugin");
    } catch (CantStartAgentException exception) {
      reportError(DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, exception);
      throw new CantStartPluginException(
          FermatException.wrapException(exception),
          "Starting Broker Submit Offline Merchandise Plugin",
          "Cannot initialize the plugin monitor agent");
    } catch (CantStartServiceException exception) {
      reportError(DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, exception);
      throw new CantStartPluginException(
          FermatException.wrapException(exception),
          "Starting Broker Submit Offline Merchandise Plugin",
          "Cannot initialize the plugin recorder service");
    } catch (CantSetObjectException exception) {
      reportError(DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, exception);
      throw new CantStartPluginException(
          FermatException.wrapException(exception),
          "Starting Broker Submit Offline Merchandise Plugin",
          "Cannot set an object in Monitor Agent constructor");
    } catch (Exception exception) {
      this.reportError(DISABLES_THIS_PLUGIN, exception);
      throw new CantStartPluginException(
          FermatException.wrapException(exception),
          "Starting Broker Submit Offline Merchandise Plugin",
          "Unexpected error");
    }
  }