@Override
 public List<DeveloperDatabaseTableRecord> getDatabaseTableContent(
     DeveloperObjectFactory developerObjectFactory,
     DeveloperDatabase developerDatabase,
     DeveloperDatabaseTable developerDatabaseTable) {
   return chatMiddlewareDeveloperDatabaseFactory.getDatabaseTableContent(
       developerObjectFactory, developerDatabaseTable);
 }
 @Override
 public List<DeveloperDatabaseTable> getDatabaseTableList(
     DeveloperObjectFactory developerObjectFactory, DeveloperDatabase developerDatabase) {
   return chatMiddlewareDeveloperDatabaseFactory.getDatabaseTableList(developerObjectFactory);
 }
  @Override
  public void start() throws CantStartPluginException {
    try {

      /** Initialize database */
      // System.out.println("OPEN_CONTRACT DB");
      initializeDb();

      /*
       * Initialize Developer Database Factory
       */
      // System.out.println("OPEN_CONTRACT Facti");
      chatMiddlewareDeveloperDatabaseFactory =
          new ChatMiddlewareDeveloperDatabaseFactory(pluginDatabaseSystem, pluginId);
      chatMiddlewareDeveloperDatabaseFactory.initializeDatabase();

      /** Initialize Dao */
      ChatMiddlewareDatabaseDao chatMiddlewareDatabaseDao =
          new ChatMiddlewareDatabaseDao(pluginDatabaseSystem, pluginId, database);
      // chatMiddlewareDatabaseDao.initialize();
      /** Initialize manager */
      chatMiddlewareManager = new ChatMiddlewareManager(chatMiddlewareDatabaseDao);

      /** Init event recorder service. */
      ChatMiddlewareRecorderService chatMiddlewareRecorderService =
          new ChatMiddlewareRecorderService(chatMiddlewareDatabaseDao, eventManager);
      chatMiddlewareRecorderService.start();

      /** Init developer database factory */
      chatMiddlewareDeveloperDatabaseFactory =
          new ChatMiddlewareDeveloperDatabaseFactory(pluginDatabaseSystem, pluginId);
      chatMiddlewareDeveloperDatabaseFactory.initializeDatabase();
      /** Init monitor Agent */
      ChatMiddlewareMonitorAgent openContractMonitorAgent =
          new ChatMiddlewareMonitorAgent(
              pluginDatabaseSystem, logManager, errorManager, eventManager, pluginId, chatManager);
      openContractMonitorAgent.start();

      this.serviceStatus = ServiceStatus.STARTED;
      // Test method
      // sendMessageTest();
      // receiveMessageTest();
      // testPublicKeys();
    } catch (CantInitializeDatabaseException exception) {
      throw new CantStartPluginException(
          CantStartPluginException.DEFAULT_MESSAGE,
          FermatException.wrapException(exception),
          "Starting open contract plugin",
          "Cannot initialize plugin database");
    } catch (CantInitializeChatMiddlewareDatabaseException exception) {
      throw new CantStartPluginException(
          CantStartPluginException.DEFAULT_MESSAGE,
          exception,
          "Starting open contract plugin",
          "Unexpected Exception");
    } catch (CantStartServiceException exception) {
      throw new CantStartPluginException(
          CantStartPluginException.DEFAULT_MESSAGE,
          exception,
          "Starting open contract plugin",
          "Cannot start recorder service");
    } catch (CantSetObjectException exception) {
      throw new CantStartPluginException(
          CantStartPluginException.DEFAULT_MESSAGE,
          exception,
          "Starting open contract plugin",
          "Cannot set an object");
    } catch (CantStartAgentException exception) {
      throw new CantStartPluginException(
          CantStartPluginException.DEFAULT_MESSAGE,
          FermatException.wrapException(exception),
          "Starting open contract plugin",
          "Cannot start the monitor agent");
    } catch (Exception exception) {
      throw new CantStartPluginException(
          CantStartPluginException.DEFAULT_MESSAGE,
          FermatException.wrapException(exception),
          "Starting open contract plugin",
          "Unexpected Exception");
    }
  }