#include <MetaData.h>
Public Member Functions | |
bool | addMapping (const std::string &name, const std::string &token, cond::TimeType timetype=cond::runnumber) |
void | deleteAllEntries () |
void | deleteEntryByTag (const std::string &tag) |
const std::string | getToken (const std::string &tagname) const |
bool | hasTag (const std::string &name) const |
void | listAllTags (std::vector< std::string > &result) const |
MetaData (cond::DbSession &userSession) | |
~MetaData () | |
Private Attributes | |
cond::DbSession | m_userSession |
Definition at line 19 of file MetaData.h.
MetaData::MetaData | ( | cond::DbSession & | userSession | ) | [explicit] |
Definition at line 32 of file MetaData.cc.
:m_userSession( userSession ){ }
MetaData::~MetaData | ( | ) |
Definition at line 34 of file MetaData.cc.
{ }
bool MetaData::addMapping | ( | const std::string & | name, |
const std::string & | token, | ||
cond::TimeType | timetype = cond::runnumber |
||
) |
Definition at line 37 of file MetaData.cc.
References cont, exception, cond::parseToken(), and ora::Container::setItemName().
Referenced by cond::service::PoolDBOutputService::createNewIOV().
{ try{ std::pair<std::string,int> oid = parseToken( iovtoken ); ora::Container cont = m_userSession.storage().containerHandle( oid.first ); cont.setItemName( name, oid.second ); }catch( const coral::DuplicateEntryInUniqueKeyException& er ){ mdDuplicateEntryError("addMapping",name); }catch(std::exception& er){ mdError("MetaData::addMapping",name,er.what()); } return true; }
void MetaData::deleteAllEntries | ( | ) |
Definition at line 95 of file MetaData.cc.
References exception, and Exception.
{ try{ m_userSession.storage().eraseAllNames(); }catch(const std::exception& er){ throw cond::Exception( std::string("MetaData::deleteAllEntries: " )+er.what() ); } }
void MetaData::deleteEntryByTag | ( | const std::string & | tag | ) |
Definition at line 103 of file MetaData.cc.
References exception, and Exception.
{ try{ m_userSession.storage().eraseObjectName( tag ); }catch(const std::exception& er){ throw cond::Exception( std::string("MetaData::deleteEntryByTag: " )+er.what() ); } }
const std::string MetaData::getToken | ( | const std::string & | tagname | ) | const |
Definition at line 53 of file MetaData.cc.
References ora::Container::className(), cont, ora::OId::containerId(), exception, ora::OId::itemId(), ora::Container::name(), convertSQLiteXML::ok, and cond::writeToken().
Referenced by CondDBESSource::CondDBESSource(), HcalO2OManager::getListOfPoolIovs(), cond::service::PoolDBOutputService::initDB(), cond::CondDB::iovToken(), and l1t::DataWriter::payloadToken().
{ bool ok=false; std::string iovtoken(""); if(!m_userSession.storage().exists()) return iovtoken; try{ ora::OId oid; ok = m_userSession.storage().getItemId( name, oid ); if(ok) { ora::Container cont = m_userSession.storage().containerHandle( oid.containerId() ); iovtoken = writeToken( cont.name(), oid.containerId(), oid.itemId(), cont.className() ); } }catch(const std::exception& er){ mdError("MetaData::getToken", name,er.what() ); } if (!ok) mdNoEntry("MetaData::getToken", name); return iovtoken; }
bool MetaData::hasTag | ( | const std::string & | name | ) | const |
Definition at line 72 of file MetaData.cc.
References exception, and query::result.
Referenced by HcalO2OManager::getListOfPoolIovs(), cond::service::PoolDBOutputService::initDB(), and l1t::DataWriter::payloadToken().
{ bool result=false; if(!m_userSession.storage().exists()) return result; try{ ora::OId oid; result = m_userSession.storage().getItemId( name, oid ); }catch(const std::exception& er){ mdError("MetaData::hasTag", name, er.what() ); } return result; }
void MetaData::listAllTags | ( | std::vector< std::string > & | result | ) | const |
Definition at line 86 of file MetaData.cc.
References exception, and Exception.
Referenced by cond::CondDB::allTags(), and HcalO2OManager::getListOfPoolTags().
{ try{ m_userSession.storage().listObjectNames( result ); }catch(const std::exception& er){ throw cond::Exception( std::string("MetaData::listAllTags: " )+er.what() ); } }
cond::DbSession cond::MetaData::m_userSession [mutable, private] |
Definition at line 48 of file MetaData.h.