11 #include "RelationalAccess/ConnectionService.h"
12 #include "RelationalAccess/IWebCacheControl.h"
13 #include "RelationalAccess/ISessionProxy.h"
14 #include "RelationalAccess/IConnectionServiceConfiguration.h"
15 #include "CoralKernel/Context.h"
16 #include "CoralKernel/IProperty.h"
17 #include "CoralKernel/IPropertyManager.h"
19 #include <boost/filesystem/operations.hpp>
23 namespace persistency {
55 coral::MsgLevel
level = coral::Error;
56 switch (messageLevel) {
61 level = coral::Warning;
82 coralConfig.disablePoolAutomaticCleanUp();
83 coralConfig.disableConnectionSharing();
86 std::string authServiceName(
"CORAL/Services/EnvironmentAuthenticationService");
89 if( authPath.empty() ){
100 authSys = ::atoi( authSysEnv );
108 if( authPath.empty() ){
109 const char* authEnv = ::getenv(
"HOME");
114 servName =
"COND/Services/RelationalAuthenticationService";
116 if( authPath.empty() ){
119 servName =
"COND/Services/XMLAuthenticationService";
121 if( !authPath.empty() ){
122 authServiceName = servName;
127 std::cout <<
"==> using " << servName <<
" for auth, sys " << authSys << std::endl;
129 coralConfig.setAuthenticationService( authServiceName );
133 coral::ConnectionService connServ;
141 coral::ConnectionService connServ;
142 std::pair<std::string,std::string> fullConnectionPars =
getConnectionParams( connectionString, transactionId );
143 if( !fullConnectionPars.second.empty() ) {
146 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_1 );
147 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_2 );
148 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_3 );
150 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second, TAG::tname, 1 );
151 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second, IOV::tname, 1 );
152 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second, PAYLOAD::tname, 3 );
155 boost::shared_ptr<coral::ISessionProxy> coralSession( connServ.connect( fullConnectionPars.first,
157 writeCapable?coral::Update:coral::ReadOnly ) );
159 auto it =
m_dbTypes.find( connectionString);
162 if( bt ==
UNKNOWN_DB && writeCapable) bt = backType;
163 m_dbTypes.insert( std::make_pair( connectionString, bt ) );
168 std::shared_ptr<SessionImpl> impl(
new SessionImpl( coralSession, connectionString, bt ) );
173 return createSession( connectionString,
"", writeCapable, backType );
static const std::string ORA_IOV_TABLE_1("ORA_C_COND_IOVSEQUENCE")
BackendType checkBackendType(boost::shared_ptr< coral::ISessionProxy > &coralSession, const std::string &connectionString)
T getUntrackedParameter(std::string const &, T const &) const
static PFTauRenderPlugin instance
static const std::string COND_AUTH_PATH_PROPERTY
static const std::string ORA_IOV_TABLE_3("ORA_C_COND_IOVSEQU_A1")
void setParameters(const edm::ParameterSet &connectionPset)
std::pair< std::string, std::string > getConnectionParams(const std::string &connectionString, const std::string &transactionId)
void setAuthenticationSystem(int authSysCode)
static const char * COND_AUTH_SYS
Session createSession(const std::string &connectionString, bool writeCapable=false, BackendType backType=DEFAULT_DB)
static const std::string COND_WRITER_ROLE
void setLogging(bool flag)
bool isLoggingEnabled() const
void setMessageVerbosity(coral::MsgLevel level)
coral::MsgLevel m_messageLevel
std::map< std::string, int > m_dbTypes
static const std::string COND_READER_ROLE
static const std::string POOL_IOV_TABLE_DATA("IOV_DATA")
static const char * COND_AUTH_PATH
Session createReadOnlySession(const std::string &connectionString, const std::string &transactionId)
cond::CoralServiceManager * m_pluginManager
static const std::string ORA_IOV_TABLE_2("ORA_C_COND_IOVSEQU_A0")
void setAuthenticationPath(const std::string &p)