#include <config.hpp>
Public Member Functions | |
| Config () | |
| bool | ParseOptions (int argc, char *argv[]) override |
| void | LoadConfig (const std::string &filename="", bool reset=false) override |
| virtual | ~Config ()=default |
| const std::string | GetServerId () const override |
| const std::string | GetMsgReplierEndpoint () const override |
| const std::string | GetMsgPubEndpoint () const override |
| const timeval | GetDbTimeout () const override |
| const unsigned int | GetDbConnTimeout () const override |
| const unsigned int | GetDbTaskPeriod () const override |
| const std::string | GetSmScxmlFilename () const override |
| const std::string | GetConfigFilename () const override |
| const std::string | GetLogProperties () const override |
| const std::string | GetLogLevel () const override |
| const unsigned int | GetReqTout () const override |
| Get the command timeout. | |
| const unsigned int | GetMonTout () const override |
| Get the wait timeout. | |
| const std::string | GetOldbPrefix () const |
| Get OLDB prefix. | |
| const std::string | GetFitsPrefix () const |
| Get FITS prefix. | |
| const std::string | GetConfigAsString () const override |
| Get the actual configuration as a string. | |
| void | SetConfigAsString (const std::string &config) override |
| Load a configuration as string. | |
| std::string | GetResolvedFilename (const std::string &config) |
| Resolve file name. | |
| const elt::configng::CiiConfigInstanceNamespace & | GetInstance () const |
| Merges an existing configuration with another config document. | |
| ifw::core::dit::did::Did & | GetDid () |
| virtual void | GetConfigList (DbVector &cfg_list) |
| CliConfig & | GetCliCfg () |
| void | SetConfigFilename (const std::string cfg_file) |
| const std::string | GetVersion () const |
| GetVersion. | |
Protected Member Functions | |
| void | MergeConfig (const elt::configng::CiiConfigDocument &doc, bool check=true) |
| Merges a configuration file. | |
| void | CheckConfig (const elt::configng::CiiConfigDocument &doc) const |
| Validates the document configuration. | |
Protected Attributes | |
| std::unique_ptr< elt::configng::CiiConfigDocument > | m_config_doc |
| Internal configuration document object. | |
| CliConfig | m_cli_config |
| Command line parameters. | |
| boost::posix_time::ptime | m_file_utc |
| std::string | m_config_filename |
| ifw::core::dit::did::Did | m_did |
| log4cplus::Logger | m_logger |
This class provide access to the command line options and the configuration parameters stored in a configuration file.
It uses the new CII Config service.
The basic schema for the configuration is found in file definitions.yaml.
The supported command line parameters are:
Options: -h [ –help ] Print help messages -i [ –server-id ] arg Server ID -l [ –log-level ] arg Log level: ERROR, INFO, DEBUG, TRACE -p [ –log-prop-file ] arg Log property filename -c [ –config ] arg Configuration filename -r [ –req-endpoint ] arg Req/Rep endpoint (zpb.rr://<ipaddr>:<port>/) -d [ –db-endpoint ] arg Redis DB endpoint (<ipaddr>:<port>)
| ifw::core::utils::bat::Config::Config | ( | ) |
Default constructor.
Initialize application configuration attributes by
|
virtualdefault |
Default destructor.
|
protected |
Validates the document configuration.
| doc | Config document object to be validated |
| std::runtime_error | in case check reported issues. |
| CliConfig & ifw::core::utils::bat::Config::GetCliCfg | ( | ) |
|
overridevirtual |
Get the actual configuration as a string.
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
|
virtual |
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
| ifw::core::dit::did::Did & ifw::core::utils::bat::Config::GetDid | ( | ) |
| const std::string ifw::core::utils::bat::Config::GetFitsPrefix | ( | ) | const |
Get FITS prefix.
| const elt::configng::CiiConfigInstanceNamespace & ifw::core::utils::bat::Config::GetInstance | ( | ) | const |
Merges an existing configuration with another config document.
| doc | Config document object to be merged |
| check | Flag to perform a check once is merged. |
| std::runtime_error | in case merge reported issues. |
Get object document instance
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
| const std::string ifw::core::utils::bat::Config::GetOldbPrefix | ( | ) | const |
Get OLDB prefix.
|
overridevirtual |
| std::string ifw::core::utils::bat::Config::GetResolvedFilename | ( | const std::string & | config = "" | ) |
Resolve file name.
| config | Configurtion filename |
| standard | exception if file cannot be found. |
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
Implements ifw::core::utils::bat::IConfig.
| const std::string ifw::core::utils::bat::Config::GetVersion | ( | ) | const |
GetVersion.
|
overridevirtual |
This method load from a configuration file the application configuration overriding the initialization done in the constructor and the command line options.
| [in] | filename | Application configuration filename. |
Implements ifw::core::utils::bat::IConfig.
|
protected |
Merges a configuration file.
| doc | Config document object to be validated. |
| check | Flag to verify after the merge. |
| std::runtime_error | in case check reported issues. |
|
overridevirtual |
This method parses the command line parameters overriding the initialization done in the constructor.
| [in] | argc | Number of command line options. |
| [in] | argv | Pointer to the array of command line options. |
Implements ifw::core::utils::bat::IConfig.
|
overridevirtual |
Load a configuration as string.
| config | configuration as string to be loaded. |
Implements ifw::core::utils::bat::IConfig.
| void ifw::core::utils::bat::Config::SetConfigFilename | ( | const std::string | cfg_file | ) |
Set the internal configuration filename.
|
protected |
Command line parameters.
|
protected |
Internal configuration document object.
|
protected |
|
protected |
|
protected |
|
protected |