00001 #include "CondCore/PopCon/interface/PopCon.h"
00002 #include "CondCore/PopCon/interface/Exception.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005
00006 #include<iostream>
00007
00008 namespace popcon {
00009
00010 PopCon::PopCon(const edm::ParameterSet& pset):
00011 m_record(pset.getParameter<std::string> ("record")),
00012 m_payload_name(pset.getUntrackedParameter<std::string> ("name","")),
00013 m_since(pset.getParameter<bool> ("SinceAppendMode")),
00014 m_LoggingOn(pset.getUntrackedParameter< bool > ("loggingOn",true)),
00015 m_IsDestDbCheckedInQueryLog(pset.getUntrackedParameter< bool > ("IsDestDbCheckedInQueryLog","True"))
00016 {
00017
00018
00019
00020 edm::LogInfo ("PopCon") << "This is PopCon (Populator of Condition) V2.00\n"
00021 << "It is still in active developement\n"
00022 << "We apologise for the verbosity of the output, for the criptic messages, for the limited functionalities and the poor documentation\n"<<
00023 "Please report any problem and feature request through the savannah portal under the category conditions\n" ;
00024
00025 }
00026
00027 PopCon::~PopCon(){}
00028
00029
00030 void PopCon::initialize() {
00031 edm::LogInfo ("PopCon")<<"payload name "<<m_payload_name<<std::endl;
00032 if(!m_dbService.isAvailable() ) throw Exception("DBService not available");
00033
00034 m_tag = m_dbService->tag(m_record);
00035 if (!m_dbService->isNewTagRequest(m_record) ) {
00036 m_dbService->tagInfo(m_record,m_tagInfo);
00037
00038 if (m_IsDestDbCheckedInQueryLog ) {
00039 const std::string & connectionStr =m_dbService->connection().connectStr(); m_dbService->queryLog().LookupLastEntryByTag(m_tag, connectionStr , m_logDBEntry);
00040 std::cout << " ------ log info searched in the same db: " << connectionStr << "------" <<std::endl;
00041 } else {
00042 m_dbService->queryLog().LookupLastEntryByTag(m_tag , m_logDBEntry);
00043 std::cout << " ------ log info found in another db " << "------" <<std::endl;
00044 }
00045
00046 edm::LogInfo ("PopCon") << "TAG, last since/till, size " << m_tag
00047 << ", " << m_tagInfo.lastInterval.first
00048 << "/" << m_tagInfo.lastInterval.second
00049 << ", " << m_tagInfo.size << "\n" <<
00050 "Last writer, size " << m_logDBEntry.provenance
00051 << ", " << m_logDBEntry.payloadIdx+1 << std::endl;
00052 }
00053 }
00054
00055
00056 void PopCon::finalize() {
00057 }
00058
00059 }