ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Types | 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...
 
virtual DbStatus associations (FileDescriptor &refDB, std::vector< const Token * > &assocs)=0
 Access the container level associations between objects. 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 long long int databaseSize (FileDescriptor &refDB) const
 Access the size of the database: May be undefined for some technologies. More...
 
virtual DbStatus containers (FileDescriptor &refDB, TokenVec &conts, bool intern)
 Access the containers in a given database. More...
 
virtual DbStatus associations (FileDescriptor &refDB, TokenVec &assocs)
 Access the container level associations between objects. More...
 
virtual DbStatus shapes (FileDescriptor &refDB, std::vector< ShapeH > &shapes)
 Access Shapes known to the database. More...
 
virtual DbStatus addDbParam (FileDescriptor &refDB, const std::string &nam, const std::string &val)
 Add a persistent parameter to the database. More...
 
virtual DbStatus dbParam (FileDescriptor &refDB, const std::string &nam, std::string &val)
 Retrieve existing parameter by name. More...
 
virtual DbStatus dbParams (FileDescriptor &refDB, Parameters &vals)
 Retrieve all parameters. 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 Attributes

DbStorageSvcm_pOuter
 Reference to outer interface. More...
 
DbDomainm_domH
 Reference to domain handle. More...
 
std::string m_name
 Explorer name. 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

◆ addDbParam()

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

Add a persistent parameter to the database.

Add a user specified parameter to the database. The database must be open in CREATE or UPDATE mode.

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

Implements pool::IStorageExplorer.

◆ addRef()

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

IInterface implementation: Reference Interface instance

Implements pool::IStorageExplorer.

◆ associations() [1/2]

virtual DbStatus pool::IStorageExplorer::associations ( FileDescriptor refDB,
std::vector< const Token * > &  assocs 
)
pure virtualinherited

Access the container level associations between objects.

Parameters
refDB[IN] Reference to Database descriptor
assocs[OUT] Vector with tokens to used containers.
Returns
DbStatus code indicating success or failure.

◆ associations() [2/2]

virtual DbStatus pool::DbStorageExplorer::associations ( FileDescriptor refDB,
TokenVec assocs 
)
virtual

Access the container level associations between objects.

Parameters
refDB[IN] Reference to Database descriptor
assocs[OUT] Vector with tokens to used containers.
Returns
DbStatus code indicating success or failure.

◆ 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.

◆ databaseSize()

virtual long long int pool::DbStorageExplorer::databaseSize ( FileDescriptor refDB) const
virtual

Access the size of the database: May be undefined for some technologies.

Parameters
refDB[IN] Descriptor of the Database access. This handle was retrieved when connecting to the logical Database.
Returns
Database size. std::string::npos in case of failure.

Implements pool::IStorageExplorer.

◆ 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.

◆ dbParams()

virtual DbStatus pool::DbStorageExplorer::dbParams ( FileDescriptor refDB,
Parameters vals 
)
virtual

Retrieve all parameters.

Retrieve all user parameters from the database.

Parameters
refDB[IN] Reference to Database descriptor
vals[OUT] Vector containing all parameter nam/value pairs.
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.

◆ interfaceID()

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

Retrieve interface ID.

◆ 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.

The criteria according to which the selection is supposed to be executed must be present in the passed criteria. Empty criteria will select all entries in the container.

Parameters
refDB[IN] Reference to Database descriptor
cntName[IN] Container name to be scanned.
sel[IN/OUT] Selection criteria
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.

◆ shapes()

virtual DbStatus pool::DbStorageExplorer::shapes ( FileDescriptor refDB,
std::vector< ShapeH > &  shapes 
)
virtual

Access Shapes known to the database.

Parameters
refDB[IN] Reference to Database descriptor
shapes[OUT] Vector with shapes to used within the database.
Returns
DbStatus code indicating success or failure.

Implements pool::IStorageExplorer.

◆ 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

◆ m_domH

DbDomain& pool::DbStorageExplorer::m_domH
private

Reference to domain handle.

Definition at line 43 of file DbStorageExplorer.h.

◆ m_name

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

Explorer name.

Definition at line 46 of file DbStorageExplorer.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: