CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

cond::FrontierProxy Class Reference

Inheritance diagram for cond::FrontierProxy:
cond::TechnologyProxy

List of all members.

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 ()

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.

                                :
  m_dbConnection(0),
  m_refreshtablelist(){
  m_refreshtablelist.reserve(10);
  //table names for IOVSequence in the old POOL mapping
  m_refreshtablelist.push_back(cond::IOVNames::iovTableName());
  m_refreshtablelist.push_back(cond::IOVNames::iovDataTableName());
  //table names for IOVSequence in ORA
  //FIXME: do not use hard-coded names, ORA should provide them for a given container...
  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQUENCE");
  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQU_A0");
  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQU_A1");
  // do not refesh tag table in production...
  // m_refreshtablelist.push_back(cond::MetaDataNames::metadataTable());
}
cond::FrontierProxy::~FrontierProxy ( )

Definition at line 50 of file FrontierProxy.cc.

                                 {
  m_refreshtablelist.clear();
}

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().

                                                                           {
  if( ! m_dbConnection ){
    throwException("The Technology Proxy has not been initialized.","FrontierProxy::getRealConnectString");
  }
  return makeRealConnectString(  userconnect, m_dbConnection->configuration().transactionId() );
}
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().

                                                                                                    {
  if( ! m_dbConnection ){
    throwException("The Technology Proxy has not been initialized.","FrontierProxy::getRealConnectString");
  }
  const std::string* tId = &transId;
  if( transId.empty() ) tId = &m_dbConnection->configuration().transactionId();
  return makeRealConnectString(  userconnect, *tId );
}
void cond::FrontierProxy::initialize ( const DbConnection connection) [virtual]

Implements cond::TechnologyProxy.

Definition at line 143 of file FrontierProxy.cc.

                                                              {
  m_dbConnection = &connection;  
}
bool cond::FrontierProxy::isTransactional ( ) const [inline, virtual]

Implements cond::TechnologyProxy.

Definition at line 22 of file FrontierProxy.cc.

{ 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(), Exception, edm::Service< T >::isAvailable(), and prof2calltree::l.

                                                                                     {
    std::string realConn = initialConnection;
    // for testing
    //std::string res = initialConnection;
    std::string proto("frontier://");
    std::string::size_type fpos=initialConnection.find(proto);
    unsigned int nslash=countslash(initialConnection.substr(proto.size(),initialConnection.size()-fpos));
    if(nslash==1){
      edm::Service<edm::SiteLocalConfig> localconfservice;
      if( !localconfservice.isAvailable() ){
        throw cms::Exception("edm::SiteLocalConfigService is not available");       
      }
      realConn=localconfservice->lookupCalibConnect(initialConnection);
      //res=localconfservice->lookupCalibConnect(initialConnection);
    }
    if (!transactionId.empty()) {
      size_t l = realConn.rfind('/');
      realConn.insert(l,"(freshkey="+transactionId+')');
      //size_t l = res.rfind('/');
      //res.insert(l,"(freshkey="+transactionId+')');
    }

    std::string refreshConnect;
    std::string::size_type startRefresh = realConn.find("://");
    if (startRefresh != std::string::npos){
      startRefresh += 3;
    }
    std::string::size_type endRefresh=realConn.rfind("/", std::string::npos);
    if (endRefresh == std::string::npos){
      refreshConnect = realConn;
    }else{
      refreshConnect = realConn.substr(startRefresh, endRefresh-startRefresh);
      if(refreshConnect.substr(0,1) != "("){
        //if the connect string is not a complicated parenthesized string,
        // an http:// needs to be at the beginning of it
        refreshConnect.insert(0, "http://");
      }
    }
    std::vector<std::string>::const_iterator ibeg=m_refreshtablelist.begin();
    std::vector<std::string>::const_iterator iend=m_refreshtablelist.end();
    for(std::vector<std::string>::const_iterator it=ibeg; it!=iend; ++it){
      m_dbConnection->webCacheControl().refreshTable(refreshConnect,*it );
    }

    //std::cout << "***** frontier connection string " << std::endl;
    //std::cout << res << std::endl;
    return realConn;
  }

Member Data Documentation

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().