#include <Utilities.h>
Public Member Functions | |
void | addAuthenticationOptions () |
void | addConfigFileOption () |
void | addConnectOption (std::string const &fullName, std::string const &shortName, std::string const &helpEntry) |
template<typename T > | |
void | addOption (const std::string &fullName, const std::string &shortName, const std::string &helpEntry) |
template<> | |
void | addOption (const std::string &fullName, const std::string &shortName, const std::string &helpEntry) |
virtual int | execute () |
std::string | getAuthenticationPathValue () |
std::string | getConfigFileValue () |
std::string | getConnectValue () |
std::string | getDictionaryValue () |
std::string | getLogDBValue () |
template<typename T > | |
T | getOptionValue (const std::string &fullName) |
std::string | getPasswordValue () |
std::string | getUserValue () |
bool | hasDebug () |
bool | hasOptionValue (const std::string &fullName) |
void | initializePluginManager () |
void | parseCommand (int argc, char **argv) |
int | run (int argc, char **argv) |
Utilities (const std::string &commandName, std::string positionalParameter=std::string("")) | |
virtual | ~Utilities () |
Protected Attributes | |
edm::ServiceToken * | m_currentToken = 0 |
Private Member Functions | |
std::string | getValueIfExists (const std::string &fullName) |
void | sendError (const std::string &message) |
void | sendException (const std::string &message) |
Private Attributes | |
std::string | m_name |
boost::program_options::options_description | m_options |
boost::program_options::positional_options_description | m_positionalOptions |
boost::program_options::variables_map | m_values |
Definition at line 22 of file Utilities.h.
cond::Utilities::Utilities | ( | const std::string & | commandName, |
std::string | positionalParameter = std::string("") |
||
) |
Definition at line 25 of file Utilities.cc.
References m_options, and m_positionalOptions.
|
virtual |
Definition at line 43 of file Utilities.cc.
void cond::Utilities::addAuthenticationOptions | ( | ) |
Definition at line 89 of file Utilities.cc.
void cond::Utilities::addConfigFileOption | ( | ) |
Definition at line 96 of file Utilities.cc.
void cond::Utilities::addConnectOption | ( | std::string const & | fullName, |
std::string const & | shortName, | ||
std::string const & | helpEntry | ||
) |
Definition at line 82 of file Utilities.cc.
|
inline |
Definition at line 81 of file Utilities.h.
References newFWLiteAna::fullName, and m_options.
|
inline |
Definition at line 91 of file Utilities.h.
References newFWLiteAna::fullName.
|
virtual |
Definition at line 46 of file Utilities.cc.
std::string cond::Utilities::getAuthenticationPathValue | ( | ) |
Definition at line 114 of file Utilities.cc.
std::string cond::Utilities::getConfigFileValue | ( | ) |
Definition at line 138 of file Utilities.cc.
std::string cond::Utilities::getConnectValue | ( | ) |
Definition at line 126 of file Utilities.cc.
std::string cond::Utilities::getDictionaryValue | ( | ) |
Definition at line 134 of file Utilities.cc.
std::string cond::Utilities::getLogDBValue | ( | ) |
Definition at line 130 of file Utilities.cc.
|
inline |
Definition at line 104 of file Utilities.h.
References newFWLiteAna::found, newFWLiteAna::fullName, m_options, m_values, python.rootplot.argparse::message, sendError(), and sendException().
std::string cond::Utilities::getPasswordValue | ( | ) |
Definition at line 122 of file Utilities.cc.
std::string cond::Utilities::getUserValue | ( | ) |
Definition at line 118 of file Utilities.cc.
|
private |
void cond::Utilities::initializeForDbConnection(){ if(!m_dbConnection){ m_dbConnection = new cond::DbConnection(); if( hasDebug() ){ m_dbConnection->configuration().setMessageLevel(coral::Debug); } else { m_dbConnection->configuration().setMessageLevel(coral::Error); } m_dbConnection->configuration().setPoolAutomaticCleanUp( false ); m_dbConnection->configuration().setConnectionTimeOut(0);
if(m_options.find_nothrow("authPath", false) && m_options.find_nothrow("user",false) && m_options.find_nothrow("pass",false)){ std::string authPath = getValueIfExists("authPath"); std::string user = getValueIfExists("user"); std::string pass = getValueIfExists("pass"); if( !authPath.empty() ){ m_dbConnection->configuration().setAuthenticationPath(authPath); } else { if( !user.empty() && !pass.empty() ){ std::string userenv(std::string("CORAL_AUTH_USER=")+user); std::string passenv(std::string("CORAL_AUTH_PASSWORD=")+pass); ::putenv(const_cast<char*>(userenv.c_str())); ::putenv(const_cast<char*>(passenv.c_str())); } } } if(m_options.find_nothrow("sql",false)){ if(m_values.count("sql")) { m_dbConnection->configuration().setSQLMonitoring( true ); } } m_dbConnection->configure();
}
}
cond::DbSession cond::Utilities::newDbSession( const std::string& connectionString, bool readOnly ){ initializeForDbConnection(); cond::DbSession session = m_dbConnection->createSession(); session.open( connectionString, readOnly ); return session; } cond::DbSession cond::Utilities::newDbSession( const std::string& connectionString, const std::string& role, bool readOnly ){ initializeForDbConnection(); cond::DbSession session = m_dbConnection->createSession(); session.open( connectionString, role, readOnly ); return session; } cond::DbSession cond::Utilities::openDbSession( const std::string& connectionParameterName, const std::string& role, bool readOnly ){ std::string connectionString = getOptionValue<std::string>( connectionParameterName ); return newDbSession( connectionString, role, readOnly ); }
cond::DbSession cond::Utilities::openDbSession( const std::string& connectionParameterName, bool readOnly ){ std::string connectionString = getOptionValue<std::string>( connectionParameterName ); return newDbSession( connectionString, readOnly ); }
Definition at line 230 of file Utilities.cc.
References newFWLiteAna::fullName, and AlCaHLTBitMon_QueryRunRegistry::string.
bool cond::Utilities::hasDebug | ( | ) |
Definition at line 153 of file Utilities.cc.
bool cond::Utilities::hasOptionValue | ( | const std::string & | fullName | ) |
Definition at line 143 of file Utilities.cc.
References newFWLiteAna::found, and python.rootplot.argparse::message.
void cond::Utilities::initializePluginManager | ( | ) |
Definition at line 157 of file Utilities.cc.
void cond::Utilities::parseCommand | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 100 of file Utilities.cc.
References HDQMDatabaseProducer::configFile, recoMuon::in, AlCaHLTBitMon_ParallelJobs::options, DTTTrigCorrFirst::run, and AlCaHLTBitMon_QueryRunRegistry::string.
int cond::Utilities::run | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 50 of file Utilities.cc.
References edm::ParameterSet::addParameter(), edmplugin::standard::config(), mps_alisetup::config, edmplugin::PluginManager::configure(), gather_cfg::cout, edm::ServiceRegistry::createSet(), cppFunctionSkipper::exception, cmsIgProf_Analysis::execute(), cmsPerfStripChart::operate(), runTheMatrix::ret, AlCaHLTBitMon_QueryRunRegistry::string, and cms::Exception::what().
Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().
|
private |
Definition at line 238 of file Utilities.cc.
Referenced by getOptionValue().
|
private |
|
protected |
Definition at line 67 of file Utilities.h.
|
private |
Definition at line 71 of file Utilities.h.
|
private |
Definition at line 73 of file Utilities.h.
Referenced by addOption(), getOptionValue(), and Utilities().
|
private |
Definition at line 74 of file Utilities.h.
Referenced by Utilities().
|
private |
Definition at line 75 of file Utilities.h.
Referenced by getOptionValue().