test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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_conn(),
50  buff_conn(),
51  omds_session(),
52  buff_session() {
53  std::cout << " PopCon application for DT DCS data (CCB status) export "
54  << std::endl;
55 }
56 
57 //--------------
58 // Destructor --
59 //--------------
61 }
62 
63 //--------------
64 // Operations --
65 //--------------
67 
68  // online DB connection
69  std::cout << "configure omds DbConnection" << std::endl;
70  // conn->configure( cond::CmsDefaults );
73  std::cout << "create omds DbSession" << std::endl;
75  std::cout << "open omds session" << std::endl;
77  std::cout << "start omds transaction" << std::endl;
79  std::cout << "" << std::endl;
80 
81  // buffer DB connection
82  std::cout << "configure buffer DbConnection" << std::endl;
85  std::cout << "create buffer DbSession" << std::endl;
87  std::cout << "open buffer session" << std::endl;
88  buff_session.open( bufferConnect );
89  std::cout << "start buffer transaction" << std::endl;
90  buff_session.transaction().start();
91 
92  // offline info
93 
94  //to access the information on the tag inside the offline database:
95  cond::TagInfo const & ti = tagInfo();
96  unsigned int last = ti.lastInterval.first;
97  std::cout << "latest DCS data (CCB status) already copied for run: "
98  << last << std::endl;
99 
100  if ( last == 0 ) {
101  DTLVStatus* dummyConf = new DTLVStatus( dataTag );
102  cond::Time_t snc = 1;
103  m_to_transfer.push_back( std::make_pair( dummyConf, snc ) );
104  }
105 
106  //to access the information on last successful log entry for this tag:
107 // cond::LogDBEntry const & lde = logDBEntry();
108 
109  //to access the lastest payload (Ref is a smart pointer)
110 // Ref payload = lastPayload();
111 
112  unsigned lastRun = last;
113  std::cout << "check for new runs since " << lastRun << std::endl;
114 
115  buff_session.transaction().commit();
116  buff_session.close();
118 
119  return;
120 
121 }
122 
123 
125  return dataTag;
126 }
127 
128 
virtual ~DTLVStatusHandler()
DbTransaction & transaction()
Definition: DbSession.cc:208
void open(const std::string &connectionString, bool readOnly=false)
Definition: DbSession.cc:159
int commit()
commit transaction.
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:83
std::string id() const
cond::DbConnection buff_conn
cond::ValidityInterval lastInterval
Definition: Types.h:75
int start(bool readOnly=false)
start transaction
unsigned long long Time_t
Definition: Time.h:16
cond::DbSession omds_session
cond::DbSession buff_session
DTLVStatusHandler(const edm::ParameterSet &ps)
cond::DbConnection omds_conn
DbSession createSession() const
Definition: DbConnection.cc:66
std::string onlineAuthentication
void setAuthenticationPath(const std::string &p)
std::string onlineConnect
tuple cout
Definition: gather_cfg.py:121
std::string bufferConnect
cond::TagInfo_t const & tagInfo() const