CMS 3D CMS Logo

DTLVStatusHandler.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
17 
18 
20 
21 #include "RelationalAccess/ISchema.h"
22 #include "RelationalAccess/ITable.h"
23 #include "RelationalAccess/ICursor.h"
24 #include "RelationalAccess/IQuery.h"
25 #include "CoralBase/AttributeList.h"
26 #include "CoralBase/AttributeSpecification.h"
27 #include "CoralBase/Attribute.h"
28 
29 //---------------
30 // C++ Headers --
31 //---------------
32 
33 #include <iostream>
34 
35 //-------------------
36 // Initializations --
37 //-------------------
38 
39 
40 //----------------
41 // Constructors --
42 //----------------
44  dataTag( ps.getParameter<std::string> ( "tag" ) ),
45  onlineConnect( ps.getParameter<std::string> ( "onlineDB" ) ),
46  onlineAuthentication( ps.getParameter<std::string> (
47  "onlineAuthentication" ) ),
48  bufferConnect( ps.getParameter<std::string> ( "bufferDB" ) ),
49  omds_session(),
50  buff_session() {
51  std::cout << " PopCon application for DT DCS data (CCB status) export "
52  << std::endl;
53 }
54 
55 //--------------
56 // Destructor --
57 //--------------
59 }
60 
61 //--------------
62 // Operations --
63 //--------------
65 
66  // online DB connection
67  std::cout << "configure omds DbConnection" << std::endl;
70  connection.configure();
71  std::cout << "create omds DbSession" << std::endl;
73  std::cout << "start omds transaction" << std::endl;
75  std::cout << "" << std::endl;
76 
77  // buffer DB connection
78  std::cout << "create buffer DbSession" << std::endl;
80  std::cout << "start buffer transaction" << std::endl;
81  buff_session.transaction().start();
82 
83  // offline info
84 
85  //to access the information on the tag inside the offline database:
86  cond::TagInfo const & ti = tagInfo();
87  unsigned int last = ti.lastInterval.first;
88  std::cout << "latest DCS data (CCB status) already copied for run: "
89  << last << std::endl;
90 
91  if ( last == 0 ) {
92  DTLVStatus* dummyConf = new DTLVStatus( dataTag );
93  cond::Time_t snc = 1;
94  m_to_transfer.push_back( std::make_pair( dummyConf, snc ) );
95  }
96 
97  //to access the information on last successful log entry for this tag:
98 // cond::LogDBEntry const & lde = logDBEntry();
99 
100  //to access the lastest payload (Ref is a smart pointer)
101 // Ref payload = lastPayload();
102 
103  unsigned lastRun = last;
104  std::cout << "check for new runs since " << lastRun << std::endl;
105 
106  buff_session.transaction().commit();
107  buff_session.close();
109 
110  return;
111 
112 }
113 
114 
116  return dataTag;
117 }
118 
119 
cond::persistency::Session buff_session
virtual ~DTLVStatusHandler()
void start(bool readOnly=true)
Definition: Session.cc:22
std::string id() const
Transaction & transaction()
Definition: Session.cc:66
cond::ValidityInterval lastInterval
Definition: Types.h:74
unsigned long long Time_t
Definition: Time.h:16
Session createSession(const std::string &connectionString, bool writeCapable=false)
DTLVStatusHandler(const edm::ParameterSet &ps)
std::string onlineAuthentication
cond::persistency::Session omds_session
std::string onlineConnect
std::string bufferConnect
void setAuthenticationPath(const std::string &p)
cond::TagInfo_t const & tagInfo() const