41 openConnection_(
false) {
44 <<
" Constructing database service..."
45 <<
" (Class instance: " <<
count <<
")";
61 <<
" Destructing object...";
100 <<
" Opening connection to database...";
105 <<
" Connection already open!";
121 std::stringstream
ss;
122 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
123 <<
" Database connection parameters: " << std::endl
131 <<
" Opened connection to database!";
138 <<
" Closing connection to database...";
143 <<
" No connection open!";
156 handleException(__func__,
"Attempting to delete DeviceFactory object...");
170 <<
" Closed connection to database...";
177 <<
" Clearing local caches...";
195 if (!method_name.empty()) {
197 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
198 <<
" NULL pointer to DeviceFactory requested by"
199 <<
" method SiStripConfigDb::" << method_name <<
"()!";
212 if (!method_name.empty()) {
214 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
215 <<
" NULL pointer to DbClient requested by"
216 <<
" method SiStripConfigDb::" << method_name <<
"()!";
230 DbAccess::getDbConfiguration(
user, passwd,
path);
231 if (!
user.empty() && !passwd.empty() && !
path.empty()) {
232 std::stringstream
ss;
233 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
234 <<
" Setting \"user/passwd@path\" to \"" <<
user <<
"/" << passwd <<
"@" <<
path
235 <<
"\" using 'CONFDB' environmental variable";
244 std::stringstream
ss;
245 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
247 <<
dbParams_.
path() <<
"\" using 'ConfDb' configurable read from .cfg file";
252 <<
" Unable to retrieve 'user/passwd@path' parameters"
253 <<
" from 'CONFDB' environmental variable or .cfg file"
254 <<
" (present value is \"" <<
user <<
"/" << passwd <<
"@" <<
path
255 <<
"\"). Aborting connection to database...";
261 std::string tns_admin =
"/afs/cern.ch/project/oracle/admin";
262 if (std::getenv(
pattern.c_str()) !=
nullptr) {
263 tns_admin = std::getenv(
pattern.c_str());
265 <<
" TNS_ADMIN is set to: \"" << tns_admin <<
"\"";
268 <<
" TNS_ADMIN is not set!"
269 <<
" Trying to use /afs and setting to: \"" << tns_admin <<
"\"";
274 std::stringstream
ss;
275 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
276 <<
" Overriding TNS_ADMIN value using cfg file!" << std::endl
277 <<
" Original value : \"" << tns_admin <<
"\"!" << std::endl
284 if (tns_admin.empty()) {
289 tns_admin = tns_admin.substr(0, tns_admin.size() - 1);
291 setenv(
pattern.c_str(), tns_admin.c_str(), 1);
295 std::ifstream tnsnames_ora(
filename.c_str());
297 if (tnsnames_ora.is_open()) {
299 while (!tnsnames_ora.eof()) {
300 getline(tnsnames_ora,
line);
307 <<
" Cannot open file \"" <<
filename <<
"\"";
315 <<
" Cannot find database account \"" <<
dbParams_.
path() <<
"\" in file \""
317 <<
" Aborting connection to database...";
324 <<
" Creating DeviceFactory object...";
327 <<
" Created DeviceFactory object!";
329 std::stringstream
ss;
338 std::stringstream
ss;
339 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
340 <<
" DeviceFactory created at address 0x" << std::hex << std::setw(8) << std::setfill(
'0') <<
factory_
346 <<
" NULL pointer to DeviceFactory!"
347 <<
" Unable to connect to database using connection parameters '" <<
dbParams_.
user()
361 if (std::getenv(partition.c_str()) !=
nullptr) {
362 std::stringstream
ss;
363 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
364 <<
" Setting \"partitions\" to \"" << std::getenv(partition.c_str())
365 <<
"\" using 'ENV_CMS_TK_PARTITION' environmental variable";
368 <<
"\" read from .cfg file)";
376 std::vector<std::string>::iterator
ii =
partitions.begin();
377 std::vector<std::string>::iterator
jj =
partitions.end();
385 std::stringstream
ss;
386 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
388 <<
"\" using 'PartitionName' configurables read from .cfg file";
392 <<
" Unable to retrieve 'partition' parameter"
393 <<
" from 'CONFDB' environmental variable or .cfg file!"
394 <<
" Aborting connection to database...";
401 for (; ip != jp; ++ip) {
402 ip->second.update(
this);
422 std::stringstream
ss;
423 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
424 <<
" Empty string for shared memory name!"
425 <<
" Cannot accept shared memory!";
433 <<
" Creating DbClient object...";
436 <<
" Created DbClient object...";
438 std::stringstream
ss;
446 std::stringstream
ss;
447 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
448 <<
" DbClient object created at address 0x" << std::hex << std::setw(8) << std::setfill(
'0') <<
dbCache_
453 <<
" NULL pointer to DbClient object!"
454 <<
" Unable to connect to database cache using shared memory name '"
463 handleException(__func__,
"Attempted to called DbClient::parse() method");
471 <<
" Using XML description files...";
477 handleException(__func__,
"Attempting to create DeviceFactory for use with xml files");
482 std::stringstream
ss;
483 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
484 <<
" DeviceFactory created at address 0x" << std::hex << std::setw(8) << std::setfill(
'0') <<
factory_
485 <<
std::dec <<
", using XML description files";
489 <<
" NULL pointer to DeviceFactory!"
490 <<
" Unable to connect to database!";
503 for (; ip != jp; ++ip) {
505 if (ip->second.inputModuleXml().empty()) {
507 <<
" NULL path to input 'module.xml' file!";
511 deviceFactory(__func__)->addConnectionFileName(ip->second.inputModuleXml());
516 <<
" Added input 'module.xml' file: " << ip->second.inputModuleXml();
519 <<
" No 'module.xml' file found at " << ip->second.inputModuleXml();
520 ip->second.inputModuleXml() =
"";
525 if (ip->second.inputDcuInfoXml().empty()) {
527 <<
" NULL path to input 'dcuinfo.xml' file!";
531 deviceFactory(__func__)->addTkDcuInfoFileName(ip->second.inputDcuInfoXml());
536 <<
" Added 'dcuinfo.xml' file: " << ip->second.inputDcuInfoXml();
539 <<
" No 'dcuinfo.xml' file found at " << ip->second.inputDcuInfoXml();
540 ip->second.inputDcuInfoXml() =
"";
545 if (ip->second.inputFecXml().empty()) {
547 <<
" NULL paths to input 'fec.xml' files!";
549 for (
const auto& iter : ip->second.inputFecXml()) {
552 <<
" NULL path to input 'fec.xml' file!";
561 <<
" Added 'fec.xml' file: " << iter;
564 <<
" No 'fec.xml' file found at " << iter;
571 if (ip->second.inputFedXml().empty()) {
573 <<
" NULL paths to input 'fed.xml' files!";
575 for (
const auto& iter : ip->second.inputFedXml()) {
578 <<
" NULL path to input 'fed.xml' file!";
587 <<
" Added 'fed.xml' file: " << iter;
590 <<
" No 'fed.xml' file found at " << iter;
600 <<
" NULL path to output 'module.xml' file!"
601 <<
" Setting to '/tmp/module.xml'...";
608 handleException(__func__,
"Problems setting output 'module.xml' file!");
615 <<
" NULL path to output 'dcuinfo.xml' file!"
616 <<
" Setting to '/tmp/dcuinfo.xml'...";
623 handleException(__func__,
"Problems setting output 'dcuinfo.xml' file!");
630 <<
" NULL path to output 'fec.xml' file!"
631 <<
" Setting to '/tmp/fec.xml'...";
645 <<
" NULL path to output 'fed.xml' file!"
646 <<
" Setting to '/tmp/fed.xml'...";
650 Fed9U::Fed9UDeviceFactory* factory =
deviceFactory(__func__);
661 std::stringstream
ss;
667 ss <<
" Caught cms::Exception in method " << method_name <<
" with message: " << std::endl <<
e.what();
668 if (!extra_info.empty()) {
669 ss <<
"Additional info: " << extra_info << std::endl;
674 catch (
const oracle::occi::SQLException&
e) {
675 ss <<
" Caught oracle::occi::SQLException in method " << method_name <<
" with message: " << std::endl
677 if (!extra_info.empty()) {
678 ss <<
"Additional info: " << extra_info << std::endl;
683 catch (
const FecExceptionHandler&
e) {
684 ss <<
" Caught FecExceptionHandler exception in method " << method_name <<
" with message: " << std::endl
685 << const_cast<FecExceptionHandler&>(
e).what();
686 if (!extra_info.empty()) {
687 ss <<
"Additional info: " << extra_info << std::endl;
700 catch (
const ICUtils::ICException&
e) {
701 ss <<
" Caught ICUtils::ICException in method " << method_name <<
" with message: " << std::endl <<
e.what();
702 if (!extra_info.empty()) {
703 ss <<
"Additional info: " << extra_info << std::endl;
709 ss <<
" Caught std::exception in method " << method_name <<
" with message: " << std::endl <<
e.what();
710 if (!extra_info.empty()) {
711 ss <<
"Additional info: " << extra_info << std::endl;
717 ss <<
" Caught unknown exception in method " << method_name <<
" (No message) " << std::endl;
718 if (!extra_info.empty()) {
719 ss <<
"Additional info: " << extra_info << std::endl;
749 <<
" NULL pointer to DeviceFactory object!";
755 all =
df->getAllRuns();
758 tkRunVector::const_iterator
ii =
all.begin();
759 tkRunVector::const_iterator
jj =
all.end();
764 uint16_t
type = (*ii)->getModeId((*ii)->getMode());
768 }
else if (
type == 2) {
770 }
else if (
type == 3) {
772 }
else if (
type == 33) {
774 }
else if (
type == 4) {
776 }
else if (
type == 5) {
778 }
else if (
type == 6) {
780 }
else if (
type == 7) {
782 }
else if (
type == 10) {
784 }
else if (
type == 8) {
786 }
else if (
type == 12) {
788 }
else if (
type == 13) {
790 }
else if (
type == 14) {
792 }
else if (
type == 15) {
794 }
else if (
type == 16) {
796 }
else if (
type == 17) {
798 }
else if (
type == 18) {
800 }
else if (
type == 19) {
802 }
else if (
type == 20) {
804 }
else if (
type == 21) {
806 }
else if (
type == 0) {
815 r.partition_ = (*ii)->getPartitionName();
816 r.number_ = (*ii)->getRunNumber();
821 <<
" NULL pointer to TkRun object!";
834 if (!optional_partition.empty()) {
835 SiStripDbParams::SiStripPartitions::const_iterator iter =
dbParams_.
partition(optional_partition);
838 <<
" Partition name not found!";
844 Runs::const_iterator
ii =
in.begin();
845 Runs::const_iterator
jj =
in.end();
848 if (
ii->partition_ == optional_partition || optional_partition.empty()) {
854 if (
out.find(
ii->type_) !=
out.end()) {
855 Runs::const_iterator irun =
out[
ii->type_].begin();
856 Runs::const_iterator jrun =
out[
ii->type_].end();
857 while (!
found && irun != jrun) {
858 if (irun->number_ ==
ii->number_) {
898 Runs::const_iterator
ii =
in.begin();
899 Runs::const_iterator
jj =
in.end();
902 if (!
ii->partition_.empty()) {
908 if (
out.find(
ii->partition_) !=
out.end()) {
909 Runs::const_iterator irun =
out[
ii->partition_].begin();
910 Runs::const_iterator jrun =
out[
ii->partition_].end();
911 while (!
found && irun != jrun) {
912 if (irun->number_ ==
ii->number_) {
920 out[
ii->partition_].push_back(*
ii);
953 <<
" NULL pointer to DeviceFactory object!";