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  * $Date: 2010/09/14 13:54:17 $
5  * $Revision: 1.5 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //-----------------------
11 // This Class' Header --
12 //-----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
19 
20 
22 
23 #include "RelationalAccess/ISchema.h"
24 #include "RelationalAccess/ITable.h"
25 #include "RelationalAccess/ICursor.h"
26 #include "RelationalAccess/IQuery.h"
27 #include "CoralBase/AttributeList.h"
28 #include "CoralBase/AttributeSpecification.h"
29 #include "CoralBase/Attribute.h"
30 
31 //---------------
32 // C++ Headers --
33 //---------------
34 
35 
36 //-------------------
37 // Initializations --
38 //-------------------
39 
40 
41 //----------------
42 // Constructors --
43 //----------------
45  dataTag( ps.getParameter<std::string> ( "tag" ) ),
46  onlineConnect( ps.getParameter<std::string> ( "onlineDB" ) ),
47  onlineAuthentication( ps.getParameter<std::string> (
48  "onlineAuthentication" ) ),
49  bufferConnect( ps.getParameter<std::string> ( "bufferDB" ) ),
50  omds_conn(),
51  buff_conn(),
52  omds_session(),
53  buff_session() {
54  std::cout << " PopCon application for DT DCS data (CCB status) export "
55  << std::endl;
56 }
57 
58 //--------------
59 // Destructor --
60 //--------------
62 }
63 
64 //--------------
65 // Operations --
66 //--------------
68 
69  // online DB connection
70  std::cout << "configure omds DbConnection" << std::endl;
71  // conn->configure( cond::CmsDefaults );
74  std::cout << "create omds DbSession" << std::endl;
76  std::cout << "open omds session" << std::endl;
78  std::cout << "start omds transaction" << std::endl;
80  std::cout << "" << std::endl;
81 
82  // buffer DB connection
83  std::cout << "configure buffer DbConnection" << std::endl;
86  std::cout << "create buffer DbSession" << std::endl;
88  std::cout << "open buffer session" << std::endl;
89  buff_session.open( bufferConnect );
90  std::cout << "start buffer transaction" << std::endl;
91  buff_session.transaction().start();
92 
93  // offline info
94 
95  //to access the information on the tag inside the offline database:
96  cond::TagInfo const & ti = tagInfo();
97  unsigned int last = ti.lastInterval.first;
98  std::cout << "latest DCS data (CCB status) already copied for run: "
99  << last << std::endl;
100 
101  if ( last == 0 ) {
102  DTLVStatus* dummyConf = new DTLVStatus( dataTag );
103  cond::Time_t snc = 1;
104  m_to_transfer.push_back( std::make_pair( dummyConf, snc ) );
105  }
106 
107  //to access the information on last successful log entry for this tag:
108 // cond::LogDBEntry const & lde = logDBEntry();
109 
110  //to access the lastest payload (Ref is a smart pointer)
111 // Ref payload = lastPayload();
112 
113  unsigned lastRun = last;
114  std::cout << "check for new runs since " << lastRun << std::endl;
115 
116  buff_session.transaction().commit();
117  buff_session.close();
119 
120  return;
121 
122 }
123 
124 
125 std::string DTLVStatusHandler::id() const {
126  return dataTag;
127 }
128 
129 
virtual ~DTLVStatusHandler()
DbTransaction & transaction()
Definition: DbSession.cc:189
void open(const std::string &connectionString, bool readOnly=false)
Definition: DbSession.cc:144
int commit()
commit transaction.
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:89
std::string id() const
cond::DbConnection buff_conn
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:72
std::string onlineAuthentication
void setAuthenticationPath(const std::string &p)
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
std::string onlineConnect
tuple cout
Definition: gather_cfg.py:121
std::string bufferConnect