ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
pool::DbStorageExplorer Class Referenceabstract

#include <StorageSvc/DbStorageExplorer.h>

Inheritance diagram for pool::DbStorageExplorer:
Collaboration diagram for pool::DbStorageExplorer:

Public Types

typedef std::pair< std::string, std::string > Parameter
 Database parameter definition. More...
 
typedef std::vector< ParameterParameters
 Database parameter container definition. More...
 

Public Member Functions

 DbStorageExplorer ()
 Standard Constructor: Constructs an object of type DbStorageExplorer. More...
 
 DbStorageExplorer (const std::string &name, DbDomain &domH, DbStorageSvc *pOuter)
 Initializing Constructor: Constructs an object of type DbStorageExplorer. More...
 
virtual ~DbStorageExplorer ()
 Standard destructor. More...
 
virtual DbStatus containers (FileDescriptor &refDB, std::vector< const Token * > &conts, bool intern=false)=0
 Access the containers in a given database. More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 
IStorageExplorer interface


virtual DbStatus queryInterface (const Guid &riid, void **ppvUnknown)
 IInterface implementation: Query interfaces of Interface. More...
 
virtual unsigned int addRef ()
 IInterface implementation: Reference Interface instance
More...
 
virtual unsigned int release ()
 IInterface implementation: Release Interface instance
More...
 
virtual DbStatus startSession (int mode, int tech, SessionH &session)
 Start a new Database Session. More...
 
virtual DbStatus endSession (const SessionH session)
 End the Database session. More...
 
virtual DbStatus connect (const SessionH sessionH, int mode, FileDescriptor &refDB)
 Connect to a logical Database unit. More...
 
virtual DbStatus disconnect (FileDescriptor &refDB)
 Disconnect from a logical Database unit. More...
 
virtual DbStatus containers (FileDescriptor &refDB, TokenVec &conts, bool intern)
 Access the containers in a given database. More...
 
virtual DbStatus dbParam (FileDescriptor &refDB, const std::string &nam, std::string &val)
 Retrieve existing parameter by name. More...
 
virtual DbStatus getDomainOption (const SessionH sessionH, DbOption &opt)
 Access options for a given database domain. More...
 
virtual DbStatus setDomainOption (const SessionH sessionH, const DbOption &opt)
 Set options for a given database domain. More...
 
virtual DbStatus getDatabaseOption (FileDescriptor &refDB, DbOption &opt)
 Access options for a given database. More...
 
virtual DbStatus setDatabaseOption (FileDescriptor &refDB, const DbOption &opt)
 Set options for a given database. More...
 
virtual DbStatus getContainerOption (FileDescriptor &refDB, const std::string &cntName, DbOption &opt)
 Access options for a given database container. More...
 
virtual DbStatus setContainerOption (FileDescriptor &refDB, const std::string &cntName, const DbOption &opt)
 Set options for a given database container. More...
 
virtual DbStatus select (FileDescriptor &refDB, const std::string &cntName, DbSelect &sel)
 Initiate a selection on a given container. More...
 
virtual DbStatus next (DbSelect &context, Token *&refpTok)
 Access the next token of a sequence. More...
 

Static Public Member Functions

static const GuidinterfaceID ()
 Retrieve interface ID. More...
 

Private Types

typedef std::vector< const Token * > TokenVec
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

DbStorageSvcm_pOuter
 Reference to outer interface. More...
 
DbDomainm_domH
 Reference to domain handle. More...
 
std::string m_name
 Explorer name. More...
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

The DbStorageExplorer class is able to handle user request for accessing database information such as the container information and to issue scans over database containers.

This functionality is defined in the IStorageExplorer interface and implemented in the DbStorageExplorer class. Please refer to the header file IStorageExplorer for further details.

Author
Markus Frank
Version
1.0

Definition at line 35 of file DbStorageExplorer.h.

Member Typedef Documentation

◆ Parameter

typedef std::pair<std::string, std::string> pool::IStorageExplorer::Parameter
inherited

Database parameter definition.

Definition at line 60 of file IStorageExplorer.h.

◆ Parameters

typedef std::vector< Parameter > pool::IStorageExplorer::Parameters
inherited

Database parameter container definition.

Definition at line 62 of file IStorageExplorer.h.

◆ TokenVec

typedef std::vector<const Token*> pool::DbStorageExplorer::TokenVec
private

Definition at line 37 of file DbStorageExplorer.h.

Constructor & Destructor Documentation

◆ DbStorageExplorer() [1/2]

pool::DbStorageExplorer::DbStorageExplorer ( )

Standard Constructor: Constructs an object of type DbStorageExplorer.

◆ DbStorageExplorer() [2/2]

pool::DbStorageExplorer::DbStorageExplorer ( const std::string &  name,
DbDomain domH,
DbStorageSvc pOuter 
)

Initializing Constructor: Constructs an object of type DbStorageExplorer.

Once a proper framework exists, most of these arguments will go away.

◆ ~DbStorageExplorer()

virtual pool::DbStorageExplorer::~DbStorageExplorer ( )
virtual

Standard destructor.

Member Function Documentation

◆ addRef()

virtual unsigned int pool::DbStorageExplorer::addRef ( )
virtual

IInterface implementation: Reference Interface instance

Implements pool::IStorageExplorer.

◆ connect()

virtual DbStatus pool::DbStorageExplorer::connect ( const SessionH  sessionH,
int  mode,
FileDescriptor refDB 
)
virtual

Connect to a logical Database unit.

A connection is equivalent to the triple (OCISession, OCIServer, OCISvcCtx) in ORACLE, a login to a datasource using ODBC, or a single federation for Objectivity. For file based technologies, such as root, MS Access, ODBC/Text etc., this is involves the opening of the requested file.

Parameters
sessionH[IN] Session context to be used to open the Database.
mode[IN] Flag to indicate the accessmode of the session. READ, NEW/CREATE/WRITE, UPDATE, RECREATE.
refDB[I/O] Descriptor of the Database to be opened. On successful return the Database handle is valid.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ containers() [1/2]

virtual DbStatus pool::IStorageExplorer::containers ( FileDescriptor refDB,
std::vector< const Token * > &  conts,
bool  intern = false 
)
pure virtualinherited

Access the containers in a given database.

Parameters
refDB[IN] Reference to Database descriptor
conts[OUT] Vector with tokens to used containers.
intern[IN] Flag to access also internal containers
Returns
DbStatus code indicating success or failure.

◆ containers() [2/2]

virtual DbStatus pool::DbStorageExplorer::containers ( FileDescriptor refDB,
TokenVec conts,
bool  intern 
)
virtual

Access the containers in a given database.

Parameters
refDB[IN] Reference to Database descriptor
conts[OUT] Vector with tokens to used containers.
intern[IN] Flag to access also internal containers
Returns
DbStatus code indicating success or failure.

◆ dbParam()

virtual DbStatus pool::DbStorageExplorer::dbParam ( FileDescriptor refDB,
const std::string &  nam,
std::string &  val 
)
virtual

Retrieve existing parameter by name.

Retrieve single user specified parameter from the database.

Parameters
refDB[IN] Reference to Database descriptor
nam[IN] Name of the user parameter to be retrieved.
val[OUT] Value of the user parameter to be retrieved.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ disconnect()

virtual DbStatus pool::DbStorageExplorer::disconnect ( FileDescriptor refDB)
virtual

Disconnect from a logical Database unit.

The request for disconnect requires, that all pending Transactions are already commited. Otherwise data are lost. On disconnection the access to the Database is finalized, closed. The token will be invalidated may not be used at any longer after disconnection.

Parameters
refDB[IN] Descriptor of the Database access. This handle was retrieved when connecting to the logical Database. On successful return the Database handle will be invalidated.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ endSession()

virtual DbStatus pool::DbStorageExplorer::endSession ( const SessionH  session)
virtual

End the Database session.

The request to end a Database session requires, that all pending Transactions and connections are closed. Otherwise internally the close will be forced and potentially data on pending Transactions will be lost. The token will be invalidated may not be used at any longer once the session ended.

Parameters
session[IN] Handle to the Database session. This handle was retrieved when starting the session.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ getContainerOption()

virtual DbStatus pool::DbStorageExplorer::getContainerOption ( FileDescriptor refDB,
const std::string &  cntName,
DbOption opt 
)
virtual

Access options for a given database container.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
refDB[IN] Reference to Database descriptor
cntName[IN] Name of the database container
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ getDatabaseOption()

virtual DbStatus pool::DbStorageExplorer::getDatabaseOption ( FileDescriptor refDB,
DbOption opt 
)
virtual

Access options for a given database.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
refDB[IN] Reference to Database descriptor
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ getDomainOption()

virtual DbStatus pool::DbStorageExplorer::getDomainOption ( const SessionH  sessionH,
DbOption opt 
)
virtual

Access options for a given database domain.

Domain options are global options, which refer to the database technology and not to a particular connection.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
sessionH[IN] Session context to be used to open the Database.
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ interfaceID()

static const Guid& pool::IStorageExplorer::interfaceID ( )
staticinherited

Retrieve interface ID.

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ next()

virtual DbStatus pool::DbStorageExplorer::next ( DbSelect context,
Token *&  refpTok 
)
virtual

Access the next token of a sequence.

The token to the next entry in the scanned container is returned. it is up to the user to release the allocated memory used by the token.

Parameters
context[IN] Reference to selection context.
refpTok[IN/OUT] Location to store pointer to token
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ queryInterface()

virtual DbStatus pool::DbStorageExplorer::queryInterface ( const Guid riid,
void **  ppvUnknown 
)
virtual

IInterface implementation: Query interfaces of Interface.

Implements pool::IStorageExplorer.

◆ release()

virtual unsigned int pool::DbStorageExplorer::release ( )
virtual

IInterface implementation: Release Interface instance

Implements pool::IStorageExplorer.

◆ select()

virtual DbStatus pool::DbStorageExplorer::select ( FileDescriptor refDB,
const std::string &  cntName,
DbSelect sel 
)
virtual

Initiate a selection on a given container.

Initiate a selection off all entries on a given container.

Parameters
refDB[IN] Reference to Database descriptor
cntName[IN] Container name to be scanned.
sel[IN/OUT] Selection
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ setContainerOption()

virtual DbStatus pool::DbStorageExplorer::setContainerOption ( FileDescriptor refDB,
const std::string &  cntName,
const DbOption opt 
)
virtual

Set options for a given database container.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
refDB[IN] Reference to Database descriptor
cntName[IN] Name of the database container
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ setDatabaseOption()

virtual DbStatus pool::DbStorageExplorer::setDatabaseOption ( FileDescriptor refDB,
const DbOption opt 
)
virtual

Set options for a given database.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
refDB[IN] Reference to Database descriptor
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ setDomainOption()

virtual DbStatus pool::DbStorageExplorer::setDomainOption ( const SessionH  sessionH,
const DbOption opt 
)
virtual

Set options for a given database domain.

Domain options are global options, which refer to the database technology and not to a particular connection.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
sessionH[IN] Session context to be used to open the Database.
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ startSession()

virtual DbStatus pool::DbStorageExplorer::startSession ( int  mode,
int  tech,
SessionH session 
)
virtual

Start a new Database Session.

The Database session handles Databases of one given type. This involves specific handling of a given domain represented by a technology type. All subsequent actions involving Database actions will re-use this technology identifier. The session is a purely logical concept, which typically cannot fail unless the underlying technology requires global initialization calls.

Parameters
mode[IN] Flag to indicate the accessmode of the session. READ, NEW/CREATE/WRITE, UPDATE, RECREATE
tech[IN] Flag indicating the technology type of the Database the user wants to connect to.
session[OUT] Token or handle to the Database session. This handle may later be used to open a new Database connection.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_domH

DbDomain& pool::DbStorageExplorer::m_domH
private

Reference to domain handle.

Definition at line 43 of file DbStorageExplorer.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_name

std::string pool::DbStorageExplorer::m_name
private

Explorer name.

Definition at line 46 of file DbStorageExplorer.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_pOuter

DbStorageSvc* pool::DbStorageExplorer::m_pOuter
private

Reference to outer interface.

Definition at line 40 of file DbStorageExplorer.h.


The documentation for this class was generated from the following file:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
python.SystemOfUnits.ms
float ms
Definition: SystemOfUnits.py:148