ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
pool::CollectionFactory Class Reference

#include <CollectionFactory/CollectionFactory.h>

Inheritance diagram for pool::CollectionFactory:
Collaboration diagram for pool::CollectionFactory:

Public Member Functions

virtual ICollectioncreate (const ICollectionDescription &description, ICollection::OpenMode openMode, ISession *session=0) const
 Creates an instance of a collection or collection fragment, given its storage technology type. More...
 
virtual ICollectioncreateAndRegister (const ICollectionDescription &description, IFileCatalog *collectionCatalog, bool overwrite=false, std::string logicalName="", ISession *session=0) const
 Creates or overwrites a collection given a description of its properties, and registers it in a collection catalog. More...
 
virtual bool registerExisting (const ICollectionDescription &description, IFileCatalog *collectionCatalog, std::string logicalName="", ISession *session=0) const
 Registers an existing collection in a collection catalog, given a specification of its properties. More...
 
virtual bool registerExisting (ICollection *collection, bool overwrite, IFileCatalog *collectionCatalog, std::string logicalName="", ISession *session=0) const
 Registers an existing collection in a collection catalog, but uses user-supplied exiting collection object. More...
 
virtual ICollectionopenWithPhysicalName (const std::string &physicalName, IFileCatalog *collectionCatalog, ICollection::OpenMode openMode=pool::ICollection::READ, ISession *session=0) const
 Opens an existing collection for read or update transactions, given its physical name. More...
 
virtual ICollectionopenWithLogicalName (const std::string &logicalName, IFileCatalog *collectionCatalog, bool readOnly=true, ISession *session=0) const
 Opens an existing collection for read or update transactions, given a logical name assigned to it in a collection catalog. More...
 
virtual ICollectionopenWithGuid (const FileCatalog::FileID &guid, IFileCatalog *collectionCatalog, bool readOnly=true, ISession *session=0) const
 Opens an existing collection for read or update transactions, given the globally unique identifier used to register it in a collection catalog. More...
 
virtual void resolveDescription (CollectionDescription &description, bool readOnly=true) const
 
virtual CollectionDescription descFromPhysicalName (const std::string &physicalName, IFileCatalog *collectionCatalog, bool readOnly) const
 
virtual CollectionDescription descFromLogicalName (const std::string &logicalName, IFileCatalog *collectionCatalog, bool readOnly) const
 
virtual CollectionDescription descFromGuid (const FileCatalog::FileID &guid, IFileCatalog *collectionCatalog, bool readOnly) const
 
void setDefaultCatalog (pool::IFileCatalog *catalog)
 set external file catalog (it will not be deleted) pass 0 to reset the existing file catalog More...
 
void setWriteCatalog (const std::string &cat)
 set write catalog (once it is set, it can only be changed by resetting) More...
 
IFileCataloggetDefaultCatalog () const
 get the default file catalog if there was no file catalog, new one will be created according to environment variables POOL_COLLECTION_[WRITE|READ]_CATALOG 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...
 

Static Public Member Functions

static CollectionFactoryget ()
 Retrieves the collection factory singleton. More...
 

Protected Attributes

bool m_myOwnCatalog
 
IFileCatalogm_catalog
 

Private Member Functions

 CollectionFactory ()
 Default constructor. More...
 
virtual ~CollectionFactory ()
 Default destructor. More...
 
bool isUnique (const FileCatalog::FileID &guid, IFileCatalog &collectionCatalog) const
 Indicates whether the GUID of a collection is unique in a collection catalog. More...
 
void extract (const std::string &physicalName, std::string &type, std::string &connection, std::string &name) const
 Extracts the collection storage technology type and database connection string and name from the physical name of a collection used to store it in a collection catalog. More...
 
ICollectioncreate_callPlugin (const ICollectionDescription &description, ICollection::OpenMode openMode, ISession *session=0) const
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

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

Static Private Attributes

static const std::string c_fileType
 Definition of file catalog entry type for collections registered in catalog. More...
 

Detailed Description

A plugin factory for the creation of storage technology specific collections or collection fragments.

Definition at line 30 of file CollectionFactory.h.

Constructor & Destructor Documentation

◆ CollectionFactory()

pool::CollectionFactory::CollectionFactory ( )
private

Default constructor.

◆ ~CollectionFactory()

virtual pool::CollectionFactory::~CollectionFactory ( )
privatevirtual

Default destructor.

Member Function Documentation

◆ create()

virtual ICollection* pool::CollectionFactory::create ( const ICollectionDescription description,
ICollection::OpenMode  openMode,
ISession session = 0 
) const
virtual

Creates an instance of a collection or collection fragment, given its storage technology type.

If the collection or collection fragment does not exist a new one can be created. If it already exists it may be overwritten or opened for read or update transactions.

Parameters
typeStorage technology type of collection or collection fragment.
descriptionSpecification of collection or collection fragment properties.
openModeOpen mode for collection or collection fragment (CREATE, CREATE_AND_OVERWRITE, READ or UPDATE).
sessionReference to database session (only needed for implicit collections).

◆ create_callPlugin()

ICollection* pool::CollectionFactory::create_callPlugin ( const ICollectionDescription description,
ICollection::OpenMode  openMode,
ISession session = 0 
) const
private

◆ createAndRegister()

virtual ICollection* pool::CollectionFactory::createAndRegister ( const ICollectionDescription description,
IFileCatalog collectionCatalog,
bool  overwrite = false,
std::string  logicalName = "",
ISession session = 0 
) const
virtual

Creates or overwrites a collection given a description of its properties, and registers it in a collection catalog.

Throws an exception if the collection has been replicated, if an attempt is being made to overwrite an existing collection in CREATE open mode or if the object being registered is a collection fragment.

Parameters
descriptionSpecification of collection properties.
collectionCatalogCollection catalog manager.
overwriteFlag indicating whether to overwrite existing collection.
logicalNameOptional logical name assigned to collection in collection catalog.
sessionReference to database session (place holder for factory).

◆ descFromGuid()

virtual CollectionDescription pool::CollectionFactory::descFromGuid ( const FileCatalog::FileID guid,
IFileCatalog collectionCatalog,
bool  readOnly 
) const
virtual

◆ descFromLogicalName()

virtual CollectionDescription pool::CollectionFactory::descFromLogicalName ( const std::string &  logicalName,
IFileCatalog collectionCatalog,
bool  readOnly 
) const
virtual

◆ descFromPhysicalName()

virtual CollectionDescription pool::CollectionFactory::descFromPhysicalName ( const std::string &  physicalName,
IFileCatalog collectionCatalog,
bool  readOnly 
) const
virtual

◆ extract()

void pool::CollectionFactory::extract ( const std::string &  physicalName,
std::string &  type,
std::string &  connection,
std::string &  name 
) const
private

Extracts the collection storage technology type and database connection string and name from the physical name of a collection used to store it in a collection catalog.

Parameters
typeStorage technology type of collection.
connectionConnection to database containing collection.
nameName of collection.
physicalNamephysical name of collection in catalog.

◆ get()

static CollectionFactory* pool::CollectionFactory::get ( )
static

Retrieves the collection factory singleton.

◆ getDefaultCatalog()

IFileCatalog* pool::CollectionFactory::getDefaultCatalog ( ) const

get the default file catalog if there was no file catalog, new one will be created according to environment variables POOL_COLLECTION_[WRITE|READ]_CATALOG

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

◆ isUnique()

bool pool::CollectionFactory::isUnique ( const FileCatalog::FileID guid,
IFileCatalog collectionCatalog 
) const
private

Indicates whether the GUID of a collection is unique in a collection catalog.

Parameters
guidGUID of collection in collection catalog.
collectionCatalogCollection catalog manager.

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

◆ openWithGuid()

virtual ICollection* pool::CollectionFactory::openWithGuid ( const FileCatalog::FileID guid,
IFileCatalog collectionCatalog,
bool  readOnly = true,
ISession session = 0 
) const
virtual

Opens an existing collection for read or update transactions, given the globally unique identifier used to register it in a collection catalog.

Throws an exception if a collection with this GUID cannot be found in the catalog.

Parameters
guidGlobally unique identifier of collection in collection catalog.
catalogCollection catalog manager.
readOnlyFlag indicating whether collection is opened for read or update.
sessionReference to database session (place holder for factory).

◆ openWithLogicalName()

virtual ICollection* pool::CollectionFactory::openWithLogicalName ( const std::string &  logicalName,
IFileCatalog collectionCatalog,
bool  readOnly = true,
ISession session = 0 
) const
virtual

Opens an existing collection for read or update transactions, given a logical name assigned to it in a collection catalog.

Throws an exception if a collection with this logical name cannot be found in the catalog.

Parameters
LogicalNameLogical name of collection in collection catalog.
collectionCatalogCollection catalog manager.
readOnlyFlag indicating whether collection is opened for read or update.
sessionReference to database session (place holder for factory).

◆ openWithPhysicalName()

virtual ICollection* pool::CollectionFactory::openWithPhysicalName ( const std::string &  physicalName,
IFileCatalog collectionCatalog,
ICollection::OpenMode  openMode = pool::ICollection::READ,
ISession session = 0 
) const
virtual

Opens an existing collection for read or update transactions, given its physical name.

Throws an exception if a collection with this physical name cannot be found in the catalog.

Parameters
physicalNamePhysical name of collection in collection catalog.
collectionCatalogCollection catalog manager.
openModeThe mode in which to open the collection
sessionReference to database session (place holder for factory).

◆ registerExisting() [1/2]

virtual bool pool::CollectionFactory::registerExisting ( const ICollectionDescription description,
IFileCatalog collectionCatalog,
std::string  logicalName = "",
ISession session = 0 
) const
virtual

Registers an existing collection in a collection catalog, given a specification of its properties.

Throws an exception if the collection does not exist, if a collection has already been registered in the catalog with identical physical name, or if the object being registered is a collection fragment. NOTE: will open the collection - do NOT use if you opened the collection for update

Parameters
descriptionSpecification of collection properties.
collectionCatalogCollection catalog manager.
logicalNameOptional logical name assigned to collection in collection catalog.
sessionReference to database session (place holder for factory).

◆ registerExisting() [2/2]

virtual bool pool::CollectionFactory::registerExisting ( ICollection collection,
bool  overwrite,
IFileCatalog collectionCatalog,
std::string  logicalName = "",
ISession session = 0 
) const
virtual

Registers an existing collection in a collection catalog, but uses user-supplied exiting collection object.

Parameters
collectionThe collection to register
overwriteIf true overwrite catalog entry for the same collection name
collectionCatalogCollection catalog manager.
logicalNameOptional logical name assigned to collection in collection catalog.
sessionReference to database session (place holder for factory).

◆ resolveDescription()

virtual void pool::CollectionFactory::resolveDescription ( CollectionDescription description,
bool  readOnly = true 
) const
virtual

◆ setDefaultCatalog()

void pool::CollectionFactory::setDefaultCatalog ( pool::IFileCatalog catalog)

set external file catalog (it will not be deleted) pass 0 to reset the existing file catalog

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

◆ setWriteCatalog()

void pool::CollectionFactory::setWriteCatalog ( const std::string &  cat)

set write catalog (once it is set, it can only be changed by resetting)

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.

◆ c_fileType

const std::string pool::CollectionFactory::c_fileType
staticprivate

Definition of file catalog entry type for collections registered in catalog.

Definition at line 184 of file CollectionFactory.h.

◆ m_catalog

IFileCatalog* pool::CollectionFactory::m_catalog
mutableprotected

Definition at line 217 of file CollectionFactory.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_myOwnCatalog

bool pool::CollectionFactory::m_myOwnCatalog
mutableprotected

Definition at line 216 of file CollectionFactory.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.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