Public Member Functions | |
std::string | connect () |
template<class T> | |
bool | getObject (const std::string &fToken, pool::Ref< T > *fObject) |
template<class T> | |
bool | getObject (const pool::Ref< cond::IOV > &fIOV, unsigned fRun, pool::Ref< T > *fObject) |
PoolData (const std::string &fConnect) | |
pool::IDataSvc * | service () |
template<class T> | |
bool | storeIOV (const pool::Ref< T > &fObject, unsigned fMaxRun, pool::Ref< cond::IOV > *fIov) |
template<class T> | |
bool | storeObject (T *fObject, const std::string &fContainer, pool::Ref< T > *fObject) |
template<class T> | |
bool | updateObject (pool::Ref< T > *fUpdate) |
template<class T> | |
bool | updateObject (T *fObject, pool::Ref< T > *fUpdate) |
~PoolData () | |
Private Attributes | |
pool::IFileCatalog | mCatalog |
std::string | mConnect |
pool::Placement | mPlacement |
pool::IDataSvc * | mService |
Definition at line 80 of file hcalCalibrationsDbTool.cc.
PoolData::PoolData | ( | const std::string & | fConnect | ) |
Definition at line 400 of file hcalCalibrationsDbTool.cc.
References GenMuonPlsPt100GeV_cfg::cout, DBSPlugin::get(), mCatalog, mConnect, mPlacement, mService, indexGen::parser, and UPDATE.
00401 : mConnect (fConnect) 00402 { 00403 std::cout << "PoolData-> Using DB connection: " << fConnect << std::endl; 00404 seal::PluginManager::get()->initialise(); 00405 pool::POOLContext::loadComponent( "SEAL/Services/MessageService" ); 00406 pool::POOLContext::loadComponent( "POOL/Services/EnvironmentAuthenticationService" ); 00407 00408 pool::URIParser parser; 00409 parser.parse(); 00410 00411 // mCatalog.setWriteCatalog (parser.contactstring ()); 00412 mCatalog.setWriteCatalog(parser.contactstring()); 00413 mCatalog.connect(); 00414 mCatalog.start(); 00415 00416 mService = pool::DataSvcFactory::create (&mCatalog); 00417 00418 pool::DatabaseConnectionPolicy policy; 00419 policy.setWriteModeForNonExisting(pool::DatabaseConnectionPolicy::CREATE); 00420 policy.setWriteModeForExisting(pool::DatabaseConnectionPolicy::UPDATE); 00421 mService->session().setDefaultConnectionPolicy(policy); 00422 mPlacement.setDatabase(mConnect, pool::DatabaseSpecification::PFN); 00423 mPlacement.setTechnology(pool::POOL_RDBMS_StorageType.type()); 00424 }
PoolData::~PoolData | ( | ) |
std::string PoolData::connect | ( | ) | [inline] |
Definition at line 104 of file hcalCalibrationsDbTool.cc.
References mConnect.
00104 {return mConnect;}
bool PoolData::getObject | ( | const std::string & | fToken, | |
pool::Ref< T > * | fObject | |||
) | [inline] |
Definition at line 507 of file hcalCalibrationsDbTool.cc.
References TestMuL1L2Filter_cff::cerr, e, Exception, mService, and service().
00507 { 00508 try { 00509 *fObject = pool::Ref <T> (service (), fToken); 00510 service ()->transaction().start(pool::ITransaction::READ); 00511 fObject->isNull (); 00512 mService->transaction().commit(); 00513 } 00514 catch(const coral::TableNotExistingException& e) { 00515 std::cerr << "PoolData::getObject-> coral::TableNotExisting Exception" << std::endl; 00516 } 00517 catch (const seal::Exception& e) { 00518 std::cerr<<"PoolData::getObject-> seal exception: " << e.what() << std::endl; 00519 } 00520 catch(...){ 00521 std::cerr << "PoolData::getObject-> Funny error" << std::endl; 00522 } 00523 return !(fObject->isNull ()); 00524 }
bool PoolData::getObject | ( | const pool::Ref< cond::IOV > & | fIOV, | |
unsigned | fRun, | |||
pool::Ref< T > * | fObject | |||
) | [inline] |
Definition at line 488 of file hcalCalibrationsDbTool.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, and first.
Referenced by main().
00488 { 00489 if (!fIOV.isNull ()) { 00490 // scan IOV, search for valid data 00491 for (std::map<unsigned long,std::string>::iterator iovi = fIOV->iov.begin (); iovi != fIOV->iov.end (); iovi++) { 00492 std::cout << "PoolData::getObject-> size: " << fIOV->iov.size () << " run:" << iovi->first << std::endl; 00493 if (fRun <= iovi->first) { 00494 std::string token = iovi->second; 00495 return getObject (token, fObject); 00496 } 00497 } 00498 std::cerr << "PoolData::getObject-> no object for run " << fRun << " is found" << std::endl; 00499 } 00500 else { 00501 std::cerr << "PoolData::getObject-> IOV reference is not set" << std::endl; 00502 } 00503 return false; 00504 }
pool::IDataSvc* PoolData::service | ( | ) | [inline] |
Definition at line 103 of file hcalCalibrationsDbTool.cc.
References mService.
Referenced by getObject().
00103 {return mService;}
bool PoolData::storeIOV | ( | const pool::Ref< T > & | fObject, | |
unsigned | fMaxRun, | |||
pool::Ref< cond::IOV > * | fIov | |||
) | [inline] |
Definition at line 474 of file hcalCalibrationsDbTool.cc.
References cond::IOV::iov, storeObject(), and updateObject().
Referenced by main().
00474 { 00475 unsigned maxRun = fMaxRun == 0 ? 0xffffffff : fMaxRun; 00476 if (fIov->isNull ()) { 00477 cond::IOV* newIov = new cond::IOV (); 00478 newIov->iov.insert (std::make_pair (maxRun, fObject.toString ())); 00479 return storeObject (newIov, "IOV", fIov); 00480 } 00481 else { 00482 (*fIov)->iov.insert (std::make_pair (maxRun, fObject.toString ())); 00483 return updateObject (fIov); 00484 } 00485 }
bool PoolData::storeObject | ( | T * | fObject, | |
const std::string & | fContainer, | |||
pool::Ref< T > * | fObject | |||
) | [inline] |
Definition at line 434 of file hcalCalibrationsDbTool.cc.
References TestMuL1L2Filter_cff::cerr, mPlacement, mService, and UPDATE.
Referenced by main(), and storeIOV().
00434 { 00435 if (!fRef->isNull ()) { 00436 std::cerr << "PoolData::storeObject-> Ref is not empty. Ignore." << std::endl; 00437 return false; 00438 } 00439 try { 00440 mService->transaction().start(pool::ITransaction::UPDATE); 00441 *fRef = pool::Ref <T> (mService, fObject); 00442 mPlacement.setContainerName (fContainer); 00443 fRef->markWrite (mPlacement); 00444 mService->transaction().commit(); 00445 } 00446 catch (...) { 00447 std::cerr << "PoolData::storeObject error " << std::endl; 00448 return false; 00449 } 00450 return true; 00451 }
bool PoolData::updateObject | ( | pool::Ref< T > * | fUpdate | ) | [inline] |
Definition at line 469 of file hcalCalibrationsDbTool.cc.
References updateObject().
00469 { 00470 return updateObject ((T*)0, fUpdate); 00471 }
bool PoolData::updateObject | ( | T * | fObject, | |
pool::Ref< T > * | fUpdate | |||
) | [inline] |
Definition at line 454 of file hcalCalibrationsDbTool.cc.
References TestMuL1L2Filter_cff::cerr, mService, and UPDATE.
Referenced by storeIOV(), and updateObject().
00454 { 00455 try { 00456 mService->transaction().start(pool::ITransaction::UPDATE); 00457 if (fObject) *(fUpdate->ptr ()) = *fObject; // update object 00458 fUpdate->markUpdate(); 00459 mService->transaction().commit(); 00460 } 00461 catch (...) { 00462 std::cerr << "PoolData::updateObject error " << std::endl; 00463 return false; 00464 } 00465 return true; 00466 }
pool::IFileCatalog PoolData::mCatalog [private] |
Definition at line 107 of file hcalCalibrationsDbTool.cc.
Referenced by PoolData(), and ~PoolData().
std::string PoolData::mConnect [private] |
pool::Placement PoolData::mPlacement [private] |
Definition at line 109 of file hcalCalibrationsDbTool.cc.
Referenced by PoolData(), and storeObject().
pool::IDataSvc* PoolData::mService [private] |
Definition at line 108 of file hcalCalibrationsDbTool.cc.
Referenced by getObject(), PoolData(), service(), storeObject(), updateObject(), and ~PoolData().