Package adams.opt.genetic.setupupload
Class MongoDB
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.opt.genetic.setupupload.AbstractSetupUpload
-
- adams.opt.genetic.setupupload.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.
-
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
-
-
-
-
Field Detail
-
KEY_SUCCESSFUL
public static final String KEY_SUCCESSFUL
- See Also:
- Constant Field Values
-
m_DatabaseConnection
protected MongoDbConnection m_DatabaseConnection
the database connection.
-
m_Database
protected com.mongodb.client.MongoDatabase m_Database
the database instance.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classadams.core.option.AbstractOptionHandler
-
requiresFlowContext
public boolean requiresFlowContext()
Returns whether flow context is required.- Specified by:
requiresFlowContext
in classadams.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 classadams.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 classadams.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 classadams.opt.genetic.setupupload.AbstractSetupUpload
- Parameters:
algorithm
- the algorithm that initiated the runerror
- null if successful, otherwise error messageparams
- the parameters to store
-
-