21 const std::string& name,
62 throw std::runtime_error(
"PFN \"" +
m_name +
"\" is not existing (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
68 throw std::runtime_error(
"FID \"" +
m_name +
"\" is not existing in the catalog (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
75 throw std::runtime_error(
"LFN \"" +
m_name +
"\" is not existing in the catalog (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
83 throw std::runtime_error(
"Unknown database name type (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
97 throw std::runtime_error(
"Could not connect to the file (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
109 throw std::runtime_error(
"Could not open a database for write outside an update transaction. (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
114 throw std::runtime_error(
"Could not open a database for write that is already connected for read. (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
118 bool dbRegistered =
false;
125 throw std::runtime_error(
"The back end technology has not been specified (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
138 throw std::runtime_error(
"Could not find the FID \"" +
m_name +
"\" in the file catalog (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
145 throw std::runtime_error(
"Could not find the LFN \"" +
m_name +
"\" in the file catalog (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
153 throw std::runtime_error(
"Unknown database name type (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
162 throw std::runtime_error(
"Could not connect to the file (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
203 ATH_MSG_DEBUG(
"Retrying 'connect' using assumed PFN " <<
m_name <<
" as LFN (no tech found in PFC)" );
220 std::string
pfn, tech;
224 <<
"' (GUID " <<
m_the_fid <<
") - this is not supported and may even lead to a crash!" );
295std::vector< std::string >
332 throw std::runtime_error(
"Only PFN, LFN and FID database types are currently supported (APR: \" UserDatabase::checkInRegistry \" from \" PersistencySvc \")" );
365 const std::type_info& typeInfo,
366 const std::string& option )
369 else return m_databaseHandler->attribute( attributeName, data, typeInfo, option );
376 const std::type_info& typeInfo,
377 const std::string& option )
380 else return m_databaseHandler->setAttribute( attributeName, data, typeInfo, option );
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
static const std::string & emptyString
static const Attributes_t empty
APRMessaging(const std::string &name)
DatabaseHandler is a class taking care of the micro-connections and the micro transactions for a give...
const std::string storageName() const
Human readable storage type.
int majorType() const
Access to major type.
static DbType getType(const std::string &name)
Access known storage type object by name.
IContainer is the base class for container objects.
ITechnologySpecificAttributes is the interface for an object holding technology-specific attributes.
virtual const std::string & pfn() override
Returns the physical file name of this database.
UserDatabase(UserSession &session, const std::string &name, const DatabaseSpecification::NameType nameType)
Constructor.
std::string m_the_fid
Other names used.
Io::IoFlag m_transactionType
Transaction type (read/update).
DatabaseHandler & databaseHandler()
Returns the database handler.
virtual ITechnologySpecificAttributes & technologySpecificAttributes() override
Returns the object holding the technology specific attributes.
virtual void disconnect() override
Disconnects from the database.
std::string m_name
The database name.
virtual bool attributeOfType(const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option) override
The actual method returning the attribute data given a name.
virtual void connectForWrite() override
Connects explicitly to the database for write/update operations.
virtual bool setAttributeOfType(const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option) override
The actual method setting the attribute data given a name.
DatabaseRegistry & m_registry
Reference to the database registry.
bool m_alreadyConnected
Flag indicating whether a connection has been already made once.
bool checkInRegistry()
Checks in the registry if the database handler already exists.
virtual std::vector< std::string > containers() override
Returns the names of the containers in this database.
IFileCatalog & m_catalog
Reference to the file catalog.
UserSession & m_session
Reference to the session.
DatabaseSpecification::NameType m_nameType
The database name spacification.
long m_technology
The technology identifier of the database.
virtual Io::IoFlag openMode() const override
Returns the opening mode. It can be used to check whether the database is connected.
virtual IContainer * containerHandle(const std::string &name) override
Returns a pointer to a container object. The user acquires ownership of that object.
virtual ~UserDatabase()
Destructor.
virtual long technology() const override
Returns the technology identifier for this database.
virtual bool setTechnology(long technology) override
Sets the technology identifier for this database.
Io::IoFlag m_openMode
Current open mode.
virtual const std::string & fid() override
Returns the file identifier of this database.
bool m_technologySet
Checks if the technology identifier has been set.
virtual void connectForRead() override
Connects explicitly to the database for read operations.
DatabaseHandler * m_databaseHandler
The underlying database handler.
UserSession is an implementation of the ISession interface.
static const long long int INVALID
static const DbType ROOT_StorageType
NameType
Enumeration type specifying the database name field, wherever the latter is used in methods accessing...