21 const std::string& name,
56 throw std::runtime_error(
"PFN \"" +
m_name +
"\" is not existing (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
62 throw std::runtime_error(
"FID \"" +
m_name +
"\" is not existing in the catalog (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
69 throw std::runtime_error(
"LFN \"" +
m_name +
"\" is not existing in the catalog (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
77 throw std::runtime_error(
"Unknown database name type (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
91 throw std::runtime_error(
"Could not connect to the file (APR: \" UserDatabase::connectForRead \" from \" PersistencySvc \")" );
102 throw std::runtime_error(
"Could not open a database for read object. (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
113 throw std::runtime_error(
"Could not open a database for write outside an update transaction. (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
118 throw std::runtime_error(
"Could not open a database for write that is already connected for read. (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
122 bool dbRegistered =
false;
129 throw std::runtime_error(
"The back end technology has not been specified (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
142 throw std::runtime_error(
"Could not find the FID \"" +
m_name +
"\" in the file catalog (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
149 throw std::runtime_error(
"Could not find the LFN \"" +
m_name +
"\" in the file catalog (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
157 throw std::runtime_error(
"Unknown database name type (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
166 throw std::runtime_error(
"Could not connect to the file (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
177 long minorTechnology,
182 throw std::runtime_error(
"Could not open a database for write object. (APR: \" UserDatabase::connectForWrite \" from \" PersistencySvc \")" );
214 std::string technology;
218 if( technology.empty() ) {
220 ATH_MSG_DEBUG(
"Retrying 'connect' using assumed PFN " <<
m_name <<
" as LFN (no tech found in PFC)" );
237 std::string
pfn, tech;
241 <<
"' (GUID " <<
m_the_fid <<
") - this is not supported and may even lead to a crash!" );
279 std::string technology;
304std::vector< std::string >
341 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
This class provides a token that identifies in a unique way objects on the persistent storage.
APRMessaging(const std::string &name)
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.
Token * writeObject(const std::string &containerName, long minorTechnology, const void *object, const RootType &type)
Writes an object and returns a token.
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).
virtual FileDescriptor * fileDescriptor() override final
Expose FileDescriptor object for the technology specific DB implementation.
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 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 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.
void * readObject(const Token &token, void *object=0)
Reads an object given a token.
virtual ~UserDatabase()
Destructor.
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...