00001 #ifndef CondCore_Utilities_CondPyInterface_h 00002 #define CondCore_Utilities_CondPyInterface_h 00003 00004 /* common utilities of the CondCore Python buiding 00005 * 00006 */ 00007 00008 #include "CondCore/IOVService/interface/IOVProxy.h" 00009 #include "CondCore/DBCommon/interface/LogDBEntry.h" 00010 00011 00012 #include<boost/shared_ptr.hpp> 00013 #include<string> 00014 00015 namespace cond { 00016 00017 class DBSession; 00018 class Connection; 00019 class Logger; 00020 00021 namespace impl { 00022 struct FWMagic; 00023 } 00024 00025 // initialize framework 00026 class FWIncantation { 00027 public: 00028 FWIncantation(); 00029 // FWIncantation(FWIncantation const & other ); 00030 ~FWIncantation(); 00031 00032 private: 00033 boost::shared_ptr<impl::FWMagic> magic; 00034 }; 00035 00036 // a readonly CondDB and its transaction 00037 class CondDB { 00038 public: 00039 CondDB(); 00040 CondDB(const CondDB & other); 00041 CondDB & operator=(const CondDB & other); 00042 CondDB(Connection * conn, boost::shared_ptr<cond::Logger> ilog ); 00043 ~CondDB(); 00044 std::string allTags() const; 00045 00046 IOVProxy iov(std::string const & tag) const; 00047 IOVProxy iovWithLib(std::string const & tag) const; 00048 00049 IOVElement payLoad(std::string const & token) const; 00050 00051 std::string iovToken(std::string const & tag) const; 00052 00053 cond::LogDBEntry lastLogEntry(std::string const & tag) const; 00054 cond::LogDBEntry lastLogEntryOK(std::string const & tag) const; 00055 00056 private: 00057 mutable Connection * me; 00058 boost::shared_ptr<cond::Logger> logger; 00059 }; 00060 00061 // initializ cond, coral etc 00062 class RDBMS { 00063 public: 00064 RDBMS(); 00065 ~RDBMS(); 00066 explicit RDBMS(std::string const & authPath); 00067 RDBMS(std::string const & user,std::string const & pass); 00068 void setLogger(std::string const & connstr); 00069 00070 CondDB getDB(std::string const & db); 00071 00072 private: 00073 boost::shared_ptr<DBSession> session; 00074 boost::shared_ptr<cond::Logger> logger; 00075 00076 }; 00077 00078 00079 } 00080 00081 00082 #endif // CondCore_Utilities_CondPyInterface_h