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

#include <CollectionFactory/CollectionFactory.h>

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

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
 

Static Private Attributes

static CollectionFactory s_instance
 Collection factory singleton. More...
 
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 29 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

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

◆ 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

◆ 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

◆ c_fileType

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

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

Definition at line 186 of file CollectionFactory.h.

◆ m_catalog

IFileCatalog* pool::CollectionFactory::m_catalog
mutableprotected

Definition at line 219 of file CollectionFactory.h.

◆ m_myOwnCatalog

bool pool::CollectionFactory::m_myOwnCatalog
mutableprotected

Definition at line 218 of file CollectionFactory.h.

◆ s_instance

CollectionFactory pool::CollectionFactory::s_instance
staticprivate

Collection factory singleton.

Definition at line 183 of file CollectionFactory.h.


The documentation for this class was generated from the following file: