Class MongoDB

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, Serializable

    public class MongoDB
    extends adams.opt.genetic.setupupload.AbstractSetupUpload
    Stores the setup information in the specified MongoDB collection.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String KEY_SUCCESSFUL  
      protected com.mongodb.client.MongoDatabase m_Database
      the database instance.
      protected MongoDbConnection m_DatabaseConnection
      the database connection.
      • Fields inherited from class adams.opt.genetic.setupupload.AbstractSetupUpload

        KEY_FITNESS, KEY_MEASURE, m_Experiment, m_FlowContext
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      MongoDB()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doFinish​(adams.opt.genetic.AbstractGeneticAlgorithm algorithm, String error, Map<String,​Object> params)
      Finishing up the genetic algorithm run.
      protected void doStart​(adams.opt.genetic.AbstractGeneticAlgorithm algorithm)
      Before Starting the uploads, ie the genetic algorithm run.
      protected String doUpload​(Map<String,​Object> setup)
      Uploads the setup.
      String globalInfo()
      Returns a string describing the object.
      protected String initCollection()
      Initializes the table.
      protected String initDatabase()
      Initializes the database connection, if necessary.
      boolean requiresFlowContext()
      Returns whether flow context is required.
      protected void reset()
      Resets the scheme.
      • Methods inherited from class adams.opt.genetic.setupupload.AbstractSetupUpload

        defineOptions, experimentTipText, finish, getExperiment, getFlowContext, setExperiment, setFlowContext, start, toProperties, upload
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_DatabaseConnection

        protected MongoDbConnection m_DatabaseConnection
        the database connection.
      • m_Database

        protected com.mongodb.client.MongoDatabase m_Database
        the database instance.
    • Constructor Detail

      • MongoDB

        public MongoDB()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class adams.core.option.AbstractOptionHandler
      • requiresFlowContext

        public boolean requiresFlowContext()
        Returns whether flow context is required.
        Specified by:
        requiresFlowContext in class adams.opt.genetic.setupupload.AbstractSetupUpload
        Returns:
        true if required
      • initDatabase

        protected String initDatabase()
        Initializes the database connection, if necessary.
        Returns:
        null if successful or already initialized, otherwise error message
      • initCollection

        protected String initCollection()
        Initializes the table.
        Returns:
        null if successful or already initialized, otherwise error message
      • doStart

        protected void doStart​(adams.opt.genetic.AbstractGeneticAlgorithm algorithm)
        Before Starting the uploads, ie the genetic algorithm run.
        Specified by:
        doStart in class adams.opt.genetic.setupupload.AbstractSetupUpload
        Parameters:
        algorithm - the algorithm initiating the run
      • doUpload

        protected String doUpload​(Map<String,​Object> setup)
        Uploads the setup.
        Specified by:
        doUpload in class adams.opt.genetic.setupupload.AbstractSetupUpload
        Parameters:
        setup - the setup data to upload
        Returns:
        null if successful, otherwise error message
      • doFinish

        protected void doFinish​(adams.opt.genetic.AbstractGeneticAlgorithm algorithm,
                                String error,
                                Map<String,​Object> params)
        Finishing up the genetic algorithm run.
        Specified by:
        doFinish in class adams.opt.genetic.setupupload.AbstractSetupUpload
        Parameters:
        algorithm - the algorithm that initiated the run
        error - null if successful, otherwise error message
        params - the parameters to store