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 coralConfig.setAuthenticationService( authServiceName );
131 coral::ConnectionService connServ;
138 coral::ConnectionService connServ;
139 std::pair<std::string,std::string> fullConnectionPars =
getConnectionParams( connectionString, transactionId );
140 if( !fullConnectionPars.second.empty() ) {
143 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_1 );
144 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_2 );
145 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_3 );
147 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second,
TAG::tname, 1 );
148 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second,
IOV::tname, 1 );
149 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second,
PAYLOAD::tname, 3 );
152 return boost::shared_ptr<coral::ISessionProxy>( connServ.connect( fullConnectionPars.first,
154 writeCapable?coral::Update:coral::ReadOnly ) );
161 coral::ConnectionService connServ;
162 std::pair<std::string,std::string> fullConnectionPars =
getConnectionParams( connectionString, transactionId );
163 if( !fullConnectionPars.second.empty() ) {
166 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_1 );
167 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_2 );
168 connServ.webCacheControl().refreshTable( fullConnectionPars.second,
ORA_IOV_TABLE_3 );
170 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second,
TAG::tname, 1 );
171 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second,
IOV::tname, 1 );
172 connServ.webCacheControl().setTableTimeToLive( fullConnectionPars.second,
PAYLOAD::tname, 3 );
175 boost::shared_ptr<coral::ISessionProxy> coralSession =
createCoralSession( connectionString, transactionId, writeCapable );
178 auto it =
m_dbTypes.find( connectionString);
181 if( bt ==
UNKNOWN_DB && writeCapable) bt = backType;
182 m_dbTypes.insert( std::make_pair( connectionString, bt ) );
187 std::shared_ptr<SessionImpl> impl(
new SessionImpl( coralSession, connectionString, bt ) );
192 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
boost::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
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)
static char const * tname
std::pair< std::string, std::string > getConnectionParams(const std::string &connectionString, const std::string &transactionId)
static char const * tname
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")
static char const * tname
void setAuthenticationPath(const std::string &p)