CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cond::FrontierProxy Class Reference
Inheritance diagram for cond::FrontierProxy:
cond::TechnologyProxy

Public Member Functions

 FrontierProxy ()
 
std::string getRealConnectString (const std::string &userconnect) const
 
std::string getRealConnectString (const std::string &userconnect, const std::string &transactionId) const
 
void initialize (const DbConnection &connection)
 
bool isTransactional () const
 
 ~FrontierProxy ()
 
- Public Member Functions inherited from cond::TechnologyProxy
 TechnologyProxy ()
 
virtual ~TechnologyProxy ()
 

Private Member Functions

std::string makeRealConnectString (const std::string &initialConnection, const std::string &transactionId) const
 

Private Attributes

const DbConnectionm_dbConnection
 
std::vector< std::string > m_refreshtablelist
 

Detailed Description

Definition at line 15 of file FrontierProxy.cc.

Constructor & Destructor Documentation

cond::FrontierProxy::FrontierProxy ( )

Definition at line 34 of file FrontierProxy.cc.

References cond::IOVNames::iovDataTableName(), cond::IOVNames::iovTableName(), and m_refreshtablelist.

34  :
35  m_dbConnection(0),
37  m_refreshtablelist.reserve(10);
38  //table names for IOVSequence in the old POOL mapping
41  //table names for IOVSequence in ORA
42  //FIXME: do not use hard-coded names, ORA should provide them for a given container...
43  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQUENCE");
44  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQU_A0");
45  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQU_A1");
46  // do not refesh tag table in production...
47  // m_refreshtablelist.push_back(cond::MetaDataNames::metadataTable());
48 }
const DbConnection * m_dbConnection
std::vector< std::string > m_refreshtablelist
static std::string iovDataTableName()
Definition: IOVNames.h:13
static std::string iovTableName()
Definition: IOVNames.h:10
cond::FrontierProxy::~FrontierProxy ( )

Definition at line 50 of file FrontierProxy.cc.

50  {
51  m_refreshtablelist.clear();
52 }
std::vector< std::string > m_refreshtablelist

Member Function Documentation

std::string cond::FrontierProxy::getRealConnectString ( const std::string &  userconnect) const
virtual

Implements cond::TechnologyProxy.

Definition at line 125 of file FrontierProxy.cc.

References cond::throwException().

125  {
126  if( ! m_dbConnection ){
127  throwException("The Technology Proxy has not been initialized.","FrontierProxy::getRealConnectString");
128  }
130 }
const std::string & transactionId() const
std::string makeRealConnectString(const std::string &initialConnection, const std::string &transactionId) const
const DbConnection * m_dbConnection
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:89
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
std::string cond::FrontierProxy::getRealConnectString ( const std::string &  userconnect,
const std::string &  transactionId 
) const
virtual

Implements cond::TechnologyProxy.

Definition at line 133 of file FrontierProxy.cc.

References cond::throwException().

133  {
134  if( ! m_dbConnection ){
135  throwException("The Technology Proxy has not been initialized.","FrontierProxy::getRealConnectString");
136  }
137  const std::string* tId = &transId;
138  if( transId.empty() ) tId = &m_dbConnection->configuration().transactionId();
139  return makeRealConnectString( userconnect, *tId );
140 }
const std::string & transactionId() const
std::string makeRealConnectString(const std::string &initialConnection, const std::string &transactionId) const
const DbConnection * m_dbConnection
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:89
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
void cond::FrontierProxy::initialize ( const DbConnection connection)
virtual

Implements cond::TechnologyProxy.

Definition at line 143 of file FrontierProxy.cc.

143  {
144  m_dbConnection = &connection;
145 }
const DbConnection * m_dbConnection
bool cond::FrontierProxy::isTransactional ( ) const
inlinevirtual

Implements cond::TechnologyProxy.

Definition at line 22 of file FrontierProxy.cc.

22 { return false;}
std::string cond::FrontierProxy::makeRealConnectString ( const std::string &  initialConnection,
const std::string &  transactionId 
) const
private

Definition at line 72 of file FrontierProxy.cc.

References cond::countslash(), edm::hlt::Exception, edm::Service< T >::isAvailable(), prof2calltree::l, and edm::SiteLocalConfig::lookupCalibConnect().

73  {
74  std::string realConn = initialConnection;
75  // for testing
76  //std::string res = initialConnection;
77  std::string proto("frontier://");
78  std::string::size_type fpos=initialConnection.find(proto);
79  unsigned int nslash=countslash(initialConnection.substr(proto.size(),initialConnection.size()-fpos));
80  if(nslash==1){
81  edm::Service<edm::SiteLocalConfig> localconfservice;
82  if( !localconfservice.isAvailable() ){
83  throw cms::Exception("edm::SiteLocalConfigService is not available");
84  }
85  realConn=localconfservice->lookupCalibConnect(initialConnection);
86  //res=localconfservice->lookupCalibConnect(initialConnection);
87  }
88  if (!transactionId.empty()) {
89  size_t l = realConn.rfind('/');
90  realConn.insert(l,"(freshkey="+transactionId+')');
91  //size_t l = res.rfind('/');
92  //res.insert(l,"(freshkey="+transactionId+')');
93  }
94 
95  std::string refreshConnect;
96  std::string::size_type startRefresh = realConn.find("://");
97  if (startRefresh != std::string::npos){
98  startRefresh += 3;
99  }
100  std::string::size_type endRefresh=realConn.rfind("/", std::string::npos);
101  if (endRefresh == std::string::npos){
102  refreshConnect = realConn;
103  }else{
104  refreshConnect = realConn.substr(startRefresh, endRefresh-startRefresh);
105  if(refreshConnect.substr(0,1) != "("){
106  //if the connect string is not a complicated parenthesized string,
107  // an http:// needs to be at the beginning of it
108  refreshConnect.insert(0, "http://");
109  }
110  }
111  std::vector<std::string>::const_iterator ibeg=m_refreshtablelist.begin();
112  std::vector<std::string>::const_iterator iend=m_refreshtablelist.end();
113  for(std::vector<std::string>::const_iterator it=ibeg; it!=iend; ++it){
114  m_dbConnection->webCacheControl().refreshTable(refreshConnect,*it );
115  }
116 
117  //std::cout << "***** frontier connection string " << std::endl;
118  //std::cout << res << std::endl;
119  return realConn;
120  }
const DbConnection * m_dbConnection
virtual std::string const lookupCalibConnect(std::string const &input) const =0
uint16_t size_type
coral::IWebCacheControl & webCacheControl() const
std::vector< std::string > m_refreshtablelist
bool isAvailable() const
Definition: Service.h:47
unsigned int countslash(const std::string &input)

Member Data Documentation

const DbConnection* cond::FrontierProxy::m_dbConnection
private

Definition at line 28 of file FrontierProxy.cc.

std::vector<std::string> cond::FrontierProxy::m_refreshtablelist
private

Definition at line 29 of file FrontierProxy.cc.

Referenced by FrontierProxy().