All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::MultiFileCatalog Class Reference

This class constitutes the core of the XML based FileCatalog API for using POOL within Gaudi. More...

#include <src/component/MultiFileCatalog.h>

Inheritance diagram for Gaudi::MultiFileCatalog:
Collaboration diagram for Gaudi::MultiFileCatalog:

Public Types

typedef Service::Factory Factory
 
- Public Types inherited from extends2< Service, IFileCatalog, IFileCatalogMgr >
typedef extends2 base_class
 Typedef to this class. More...
 
typedef extend_interfaces2
< IFileCatalog,
IFileCatalogMgr > 
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory2
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces2< IFileCatalog, IFileCatalogMgr >
typedef mpl::fold< typename
IFileCatalog::iid::iids::type,
typename
IFileCatalogMgr::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 

Public Member Functions

 MultiFileCatalog (const std::string &nam, ISvcLocator *svc)
 Create a catalog file, initialization of XercesC. More...
 
virtual ~MultiFileCatalog ()
 Destructor,. More...
 
virtual StatusCode initialize ()
 IService implementation. More...
 
virtual StatusCode finalize ()
 Finalize service object. More...
 
virtual std::string createFID () const
 Catalog interface. More...
 
virtual CSTR connectInfo () const
 Access to connect string. More...
 
virtual void init ()
 Parse the DOM tree of the XML catalog. More...
 
virtual void commit ()
 Save DOM catalog to file. More...
 
virtual void rollback ()
 Save DOM catalog to file. More...
 
virtual bool readOnly () const
 Check if the catalog is read-only. More...
 
virtual bool dirty () const
 Check if the catalog should be updated. More...
 
virtual bool existsPFN (CSTR pfn) const
 Return the status of physical file name. More...
 
virtual std::string lookupPFN (CSTR pfn) const
 Lookup file identifier by physical file name. More...
 
virtual bool existsLFN (CSTR lfn) const
 Return the status of a logical file name. More...
 
virtual std::string lookupLFN (CSTR lfn) const
 Lookup file identifier by logical file name. More...
 
virtual bool existsFID (CSTR fid) const
 Return the status of a FileID. More...
 
virtual void getPFN (CSTR fid, Files &files) const
 Dump all physical file names of the catalog and their attributes associate to the FileID. More...
 
virtual void getLFN (CSTR fid, Files &files) const
 Dump all logical file names of the catalog associate to the FileID. More...
 
virtual void getFID (Strings &fids) const
 Dump all file Identifiers. More...
 
virtual void deleteFID (CSTR fid) const
 Delete FileID from the catalog. More...
 
virtual void registerPFN (CSTR fid, CSTR pfn, CSTR ftype) const
 Create a FileID and DOM Node of the PFN with all the attributes. More...
 
virtual void registerLFN (CSTR fid, CSTR lfn) const
 Create a FileID and DOM Node of the LFN with all the attributes. More...
 
virtual void registerFID (CSTR fid) const
 Create a FileID and DOM Node. More...
 
virtual void getMetaData (CSTR fid, Attributes &attr) const
 Dump all MetaData of the catalog for a given file ID. More...
 
virtual std::string getMetaDataItem (CSTR fid, CSTR name) const
 Access metadata item. More...
 
virtual void setMetaData (CSTR fid, CSTR attr, CSTR val) const
 Insert/update metadata item. More...
 
virtual void dropMetaData (CSTR fid) const
 Drop all metadata of one FID. More...
 
virtual void dropMetaData (CSTR fid, CSTR attr) const
 Drop specified metadata item. More...
 
virtual IFileCatalogfindCatalog (CSTR connect, bool must_be_writable) const
 Catalog management. More...
 
virtual void addCatalog (CSTR connect)
 Add new catalog identified by name to the existing ones. More...
 
virtual void addCatalog (IFileCatalog *cat)
 Add new catalog identified by reference to the existing ones. More...
 
virtual void removeCatalog (CSTR connect)
 Remove catalog identified by name from the existing ones. More...
 
virtual void removeCatalog (const IFileCatalog *cat)
 Remove catalog identified by reference from the existing ones. More...
 
virtual Catalogscatalogs ()
 Access catalog container. More...
 
virtual const Catalogscatalogs () const
 Access catalog container (CONST) More...
 
virtual IFileCatalogwriteCatalog (CSTR fid="") const
 Access to the (first) writable file catalog. More...
 
virtual void setWriteCatalog (IFileCatalog *cat)
 Define the writable catalog identified by reference. More...
 
virtual void setWriteCatalog (CSTR connect)
 Define the writable catalog identified by name. More...
 
- Public Member Functions inherited from extends2< Service, IFileCatalog, IFileCatalogMgr >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends2 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends2 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces2< IFileCatalog, IFileCatalogMgr >
virtual ~extend_interfaces2 ()
 Virtual destructor. More...
 

Protected Types

typedef const std::string & CSTR
 
typedef std::vector
< IFileCatalog * > 
Catalogs
 
typedef std::vector< std::string > CatalogNames
 

Protected Member Functions

template<class T >
void _exec (T pmf) const
 
template<class A1 , class F >
std::string _find (A1 &arg1, F pmf) const
 
template<class A1 , class F >
void _collect (A1 arg1, F pmf) const
 
template<class A1 , class A2 , class F >
void _collect (A1 arg1, A2 &arg2, F pmf) const
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Member Functions

IFileCataloggetCatalog (CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
 Find catalog containing a given file identifier. More...
 
Catalogs::iterator i_findCatalog (CSTR connect, bool must_be_writable)
 Find catalog by connect string. More...
 
void propHandler (Property &)
 simple property handle to allow interactive modification of list of the file catalogs More...
 
void printError (CSTR msg, bool throw_exc=true) const
 
std::string lookupFID (CSTR lfn) const
 

Private Attributes

Catalogs m_catalogs
 Container with references to known catalogs. More...
 
CatalogNames m_catalogNames
 Property : Container with catalog names. More...
 
bool m_started
 Flag to indicate if catalog is started. More...
 
CatalogNames m_oldNames
 BACKUP:: Container with catalog names. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Detailed Description

This class constitutes the core of the XML based FileCatalog API for using POOL within Gaudi.

This class manages multiple file catalogs.

Definition at line 20 of file MultiFileCatalog.h.

Member Typedef Documentation

typedef std::vector<std::string> Gaudi::MultiFileCatalog::CatalogNames
protected

Definition at line 29 of file MultiFileCatalog.h.

typedef std::vector<IFileCatalog*> Gaudi::MultiFileCatalog::Catalogs
protected

Definition at line 28 of file MultiFileCatalog.h.

typedef const std::string& Gaudi::MultiFileCatalog::CSTR
protected

Definition at line 27 of file MultiFileCatalog.h.

typedef Service::Factory Gaudi::MultiFileCatalog::Factory

Definition at line 24 of file MultiFileCatalog.h.

Constructor & Destructor Documentation

MultiFileCatalog::MultiFileCatalog ( const std::string &  nam,
ISvcLocator svc 
)

Create a catalog file, initialization of XercesC.

Definition at line 26 of file MultiFileCatalog.cpp.

27  : base_class(nam, svc), m_started(false), m_oldNames()
28 {
29  declareProperty("Catalogs", m_catalogNames, "The list of Catalogs")
30  -> declareUpdateHandler ( &Gaudi::MultiFileCatalog::propHandler, this ) ;
31  m_catalogNames.push_back("xmlcatalog_file:test_catalog.xml");
32 }
bool m_started
Flag to indicate if catalog is started.
extends2 base_class
Typedef to this class.
Definition: extends.h:77
void propHandler(Property &)
simple property handle to allow interactive modification of list of the file catalogs ...
CatalogNames m_catalogNames
Property : Container with catalog names.
CatalogNames m_oldNames
BACKUP:: Container with catalog names.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:209
MultiFileCatalog::~MultiFileCatalog ( )
virtual

Destructor,.

Definition at line 34 of file MultiFileCatalog.cpp.

34  {
35 }

Member Function Documentation

template<class A1 , class F >
void Gaudi::MultiFileCatalog::_collect ( A1  arg1,
pmf 
) const
inlineprotected

Definition at line 41 of file MultiFileCatalog.h.

41  {
42  A1 tmp;
43  for(Catalogs::const_iterator i=m_catalogs.begin();i!=m_catalogs.end();++i,tmp.clear()) {
44  ((*i)->*pmf)(tmp);
45  arg1.insert(arg1.end(),tmp.begin(),tmp.end());
46  }
47  }
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
template<class A1 , class A2 , class F >
void Gaudi::MultiFileCatalog::_collect ( A1  arg1,
A2 &  arg2,
pmf 
) const
inlineprotected

Definition at line 48 of file MultiFileCatalog.h.

48  {
49  A2 tmp;
50  for(Catalogs::const_iterator i=m_catalogs.begin();i!=m_catalogs.end();++i,tmp.clear()) {
51  ((*i)->*pmf)(arg1,tmp);
52  arg2.insert(arg2.end(),tmp.begin(),tmp.end());
53  }
54  }
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
template<class T >
void Gaudi::MultiFileCatalog::_exec ( pmf) const
inlineprotected

Definition at line 31 of file MultiFileCatalog.h.

31  {
32  for(Catalogs::const_iterator i=m_catalogs.begin(); i != m_catalogs.end(); ++i)
33  ((*i)->*pmf)();
34  }
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
template<class A1 , class F >
std::string Gaudi::MultiFileCatalog::_find ( A1 &  arg1,
pmf 
) const
inlineprotected

Definition at line 35 of file MultiFileCatalog.h.

35  {
36  std::string result;
37  for(Catalogs::const_iterator i=m_catalogs.begin(); i != m_catalogs.end(); ++i)
38  if ( !(result= ((*i)->*pmf)(arg1)).empty() ) break;
39  return result;
40  }
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
void MultiFileCatalog::addCatalog ( CSTR  connect)
virtual

Add new catalog identified by name to the existing ones.

Catalog is already present ... silently ignore request

Definition at line 129 of file MultiFileCatalog.cpp.

129  {
130  if ( !con.empty() ) {
131  if ( 0 == findCatalog(con,false) ) {
132  static const string xml_typ = "Gaudi::XMLFileCatalog";
133  string::size_type id0 = con.find("_");
134  string typ = con.substr(0,id0);
135  string url = con.substr(id0+1);
136  IInterface* cat = 0;
137  if ( strncasecmp("xml",typ.c_str(),3) == 0 ) {
138  cat = IFileCatalog::Factory::create(xml_typ,url,msgSvc().get());
139  }
140  else {
142  Registry& registry = Registry::instance();
143  if (registry.getInfo(typ).type ==
144  typeid(Service::Factory::FuncType).name()) {
145  cat = Service::Factory::create(typ,url,serviceLocator().get());
146  } else if (registry.getInfo(typ).type ==
147  typeid(IFileCatalog::Factory::FuncType).name()) {
148  cat = IFileCatalog::Factory::create(typ,url,msgSvc().get());
149  }
150  }
151  if ( cat ) {
152  IFileCatalog* fileCat = 0;
153  if ( cat->queryInterface(IFileCatalog::interfaceID(),pp_cast<void>(&fileCat)).isSuccess() ) {
154  addCatalog(fileCat);
155  cat->release();
156  return;
157  }
158  }
159  printError("Failed to create catalog connection:"+con,true);
160  }
162  return;
163  }
164  printError("Got invalid (empty) catalog connection string.",true);
165 }
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
void printError(CSTR msg, bool throw_exc=true) const
Definition of the basic interface.
Definition: IInterface.h:160
virtual IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const
Catalog management.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
File catalog interface.
Definition: IFileCatalog.h:24
virtual unsigned long release()=0
Release Interface instance.
virtual void addCatalog(CSTR connect)
Add new catalog identified by name to the existing ones.
In-memory database of the loaded factories.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
void MultiFileCatalog::addCatalog ( IFileCatalog cat)
virtual

Add new catalog identified by reference to the existing ones.

Definition at line 167 of file MultiFileCatalog.cpp.

167  {
168  if ( cat ) {
169  cat->addRef();
170  m_catalogs.push_back(cat);
171  return;
172  }
173  printError("Got invalid catalog to be added to multi catalog.",true);
174 }
void printError(CSTR msg, bool throw_exc=true) const
Catalogs m_catalogs
Container with references to known catalogs.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual Catalogs& Gaudi::MultiFileCatalog::catalogs ( )
inlinevirtual

Access catalog container.

Definition at line 145 of file MultiFileCatalog.h.

145 { return m_catalogs; }
Catalogs m_catalogs
Container with references to known catalogs.
virtual const Catalogs& Gaudi::MultiFileCatalog::catalogs ( ) const
inlinevirtual

Access catalog container (CONST)

Definition at line 147 of file MultiFileCatalog.h.

147 { return m_catalogs; }
Catalogs m_catalogs
Container with references to known catalogs.
virtual void Gaudi::MultiFileCatalog::commit ( )
inlinevirtual

Save DOM catalog to file.

Definition at line 76 of file MultiFileCatalog.h.

virtual void commit()=0
Save catalog to file.
void _exec(T pmf) const
MultiFileCatalog::CSTR MultiFileCatalog::connectInfo ( ) const
virtual

Access to connect string.

Definition at line 71 of file MultiFileCatalog.cpp.

71  {
72  static string s("MultiCatalog");
73  return s;
74 }
string s
Definition: gaudirun.py:210
std::string MultiFileCatalog::createFID ( ) const
virtual

Catalog interface.

Create file identifier using UUID mechanism.

Create file identifier using UUID mechanism

Definition at line 67 of file MultiFileCatalog.cpp.

67  {
68  return createGuidAsString();
69 }
std::string createGuidAsString()
Create file identifier using UUID mechanism.
virtual void Gaudi::MultiFileCatalog::deleteFID ( CSTR  fid) const
inlinevirtual

Delete FileID from the catalog.

Definition at line 109 of file MultiFileCatalog.h.

110  { writeCatalog(fid)->deleteFID(fid); }
virtual IFileCatalog * writeCatalog(CSTR fid="") const
Access to the (first) writable file catalog.
virtual void deleteFID(const std::string &FileID) const =0
Delete FileID Node from the catalog.
bool MultiFileCatalog::dirty ( ) const
virtual

Check if the catalog should be updated.

Definition at line 246 of file MultiFileCatalog.cpp.

247 { return _findX0Bool(m_catalogs,&IFileCatalog::dirty,true); }
Catalogs m_catalogs
Container with references to known catalogs.
virtual bool dirty() const =0
Check if the catalog should be updated.
virtual void Gaudi::MultiFileCatalog::dropMetaData ( CSTR  fid) const
inlinevirtual

Drop all metadata of one FID.

Definition at line 127 of file MultiFileCatalog.h.

128  { writeCatalog(fid)->dropMetaData(fid); }
virtual IFileCatalog * writeCatalog(CSTR fid="") const
Access to the (first) writable file catalog.
virtual void dropMetaData(const std::string &fid) const =0
Drop all metadata of one FID.
virtual void Gaudi::MultiFileCatalog::dropMetaData ( CSTR  fid,
CSTR  attr 
) const
inlinevirtual

Drop specified metadata item.

Definition at line 130 of file MultiFileCatalog.h.

131  { writeCatalog(fid)->dropMetaData(fid,attr); }
virtual IFileCatalog * writeCatalog(CSTR fid="") const
Access to the (first) writable file catalog.
virtual void dropMetaData(const std::string &fid) const =0
Drop all metadata of one FID.
virtual bool Gaudi::MultiFileCatalog::existsFID ( CSTR  fid) const
inlinevirtual

Return the status of a FileID.

Definition at line 96 of file MultiFileCatalog.h.

97  { return 0 != getCatalog(fid,false,false,false); }
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
virtual bool Gaudi::MultiFileCatalog::existsLFN ( CSTR  lfn) const
inlinevirtual

Return the status of a logical file name.

Definition at line 90 of file MultiFileCatalog.h.

91  { return !lookupLFN(lfn).empty(); }
virtual std::string lookupLFN(CSTR lfn) const
Lookup file identifier by logical file name.
virtual bool Gaudi::MultiFileCatalog::existsPFN ( CSTR  pfn) const
inlinevirtual

Return the status of physical file name.

Definition at line 84 of file MultiFileCatalog.h.

85  { return !lookupPFN(pfn).empty(); }
virtual std::string lookupPFN(CSTR pfn) const
Lookup file identifier by physical file name.
StatusCode MultiFileCatalog::finalize ( )
virtual

Finalize service object.

Reimplemented from Service.

Definition at line 58 of file MultiFileCatalog.cpp.

58  {
59  commit();
61  m_catalogs.clear();
62  m_started = false;
63  return Service::finalize();
64 }
bool m_started
Flag to indicate if catalog is started.
virtual void commit()
Save DOM catalog to file.
Catalogs m_catalogs
Container with references to known catalogs.
virtual unsigned long release()=0
Release Interface instance.
void _exec(T pmf) const
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
IFileCatalog * MultiFileCatalog::findCatalog ( CSTR  connect,
bool  must_be_writable 
) const
virtual

Catalog management.

Find catalog by connect string

Definition at line 102 of file MultiFileCatalog.cpp.

102  {
103  for(Catalogs::const_iterator i=m_catalogs.begin(); i != m_catalogs.end(); ++i) {
104  if ( connect == (*i)->connectInfo() )
105  return (must_be_writable && (*i)->readOnly()) ? 0 : *i;
106  }
107  return 0;
108 }
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
IFileCatalog * MultiFileCatalog::getCatalog ( CSTR  fid,
bool  throw_if_not,
bool  writable = true,
bool  prt = true 
) const
private

Find catalog containing a given file identifier.

Definition at line 76 of file MultiFileCatalog.cpp.

80 {
81  for(Catalogs::const_iterator i=m_catalogs.begin(); i != m_catalogs.end(); ++i) {
82  IFileCatalog* c = *i;
83  if ( c ) {
84  if ( writable && c->readOnly() )
85  continue;
86  else if ( fid.empty() )
87  return c;
88  else if ( !fid.empty() && c->existsFID(fid) )
89  return c;
90  }
91  }
92  if ( prt ) {
93  printError("No writable file catalog found which contains FID:"+fid,throw_if_not);
94  }
95  else {
96  MsgStream log(msgSvc(),name());
97  log << MSG::DEBUG << "No writable file catalog found which contains FID:" << fid << endmsg;
98  }
99  return 0;
100 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual bool existsFID(const std::string &fid) const =0
Return the status of a FileID.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
tuple c
Definition: gaudirun.py:341
void printError(CSTR msg, bool throw_exc=true) const
Catalogs m_catalogs
Container with references to known catalogs.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
File catalog interface.
Definition: IFileCatalog.h:24
virtual bool readOnly() const =0
Check if the catalog is read-only.
list i
Definition: ana.py:128
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
virtual void Gaudi::MultiFileCatalog::getFID ( Strings &  fids) const
inlinevirtual

Dump all file Identifiers.

Definition at line 106 of file MultiFileCatalog.h.

107  { _collect(fids,&IFileCatalog::getFID); }
void _collect(A1 arg1, F pmf) const
virtual void getFID(Strings &fids) const =0
Dump all file Identifiers.
virtual void Gaudi::MultiFileCatalog::getLFN ( CSTR  fid,
Files &  files 
) const
inlinevirtual

Dump all logical file names of the catalog associate to the FileID.

Definition at line 102 of file MultiFileCatalog.h.

103  { _collect(fid,files,&IFileCatalog::getLFN); }
void _collect(A1 arg1, F pmf) const
virtual void getLFN(const std::string &fid, Files &files) const =0
Dump all LFNames of the catalog associate to the FileID.
virtual void Gaudi::MultiFileCatalog::getMetaData ( CSTR  fid,
Attributes &  attr 
) const
inlinevirtual

Dump all MetaData of the catalog for a given file ID.

Definition at line 119 of file MultiFileCatalog.h.

120  { _collect(fid,attr,&IFileCatalog::getMetaData); }
void _collect(A1 arg1, F pmf) const
virtual void getMetaData(const std::string &fid, Attributes &attr) const =0
Dump all MetaData of the catalog for a given file ID.
string MultiFileCatalog::getMetaDataItem ( CSTR  fid,
CSTR  name 
) const
virtual

Access metadata item.

Definition at line 224 of file MultiFileCatalog.cpp.

224  {
225  std::string result;
226  for(Catalogs::const_iterator i=m_catalogs.begin(); i != m_catalogs.end(); ++i)
227  if ( !(result= (*i)->getMetaDataItem(fid,attr)).empty() ) break;
228  return result;
229 }
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
virtual void Gaudi::MultiFileCatalog::getPFN ( CSTR  fid,
Files &  files 
) const
inlinevirtual

Dump all physical file names of the catalog and their attributes associate to the FileID.

Definition at line 99 of file MultiFileCatalog.h.

100  { _collect(fid,files,&IFileCatalog::getPFN); }
virtual void getPFN(const std::string &fid, Files &files) const =0
Dump all PFNames of the catalog and their attributes associate to the FileID.
void _collect(A1 arg1, F pmf) const
MultiFileCatalog::Catalogs::iterator MultiFileCatalog::i_findCatalog ( CSTR  connect,
bool  must_be_writable 
)
private

Find catalog by connect string.

Definition at line 111 of file MultiFileCatalog.cpp.

111  {
112  for(Catalogs::iterator i=m_catalogs.begin(); i != m_catalogs.end(); ++i) {
113  if ( connect == (*i)->connectInfo() ) {
114  return (must_be_writable && (*i)->readOnly()) ? m_catalogs.end() : i;
115  }
116  }
117  return m_catalogs.end();
118 }
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
virtual void Gaudi::MultiFileCatalog::init ( )
inlinevirtual

Parse the DOM tree of the XML catalog.

Definition at line 73 of file MultiFileCatalog.h.

bool m_started
Flag to indicate if catalog is started.
virtual void init()=0
Parse the DOM tree of the XML catalog.
void _exec(T pmf) const
StatusCode MultiFileCatalog::initialize ( )
virtual

IService implementation.

Finalize service object

Reimplemented from Service.

Definition at line 37 of file MultiFileCatalog.cpp.

37  {
38  CatalogNames::const_iterator i;
39  std::string current = "";
40  if ( !Service::initialize().isSuccess() ) {
41  printError("Failed to initialize service base class.",false);
42  return StatusCode::SUCCESS;
43  }
44  try {
45  for(i=m_catalogNames.begin(); i != m_catalogNames.end(); ++i) {
46  current = *i;
47  addCatalog(*i);
48  }
49  init();
50  return StatusCode::SUCCESS;
51  }
52  catch(const std::exception& /* e */) {
53  printError("Cannot add file catalog:"+current,false);
54  }
55  return StatusCode::FAILURE;
56 }
void printError(CSTR msg, bool throw_exc=true) const
CatalogNames m_catalogNames
Property : Container with catalog names.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
virtual void addCatalog(CSTR connect)
Add new catalog identified by name to the existing ones.
virtual void init()
Parse the DOM tree of the XML catalog.
list i
Definition: ana.py:128
std::string Gaudi::MultiFileCatalog::lookupFID ( CSTR  lfn) const
private
virtual std::string Gaudi::MultiFileCatalog::lookupLFN ( CSTR  lfn) const
inlinevirtual

Lookup file identifier by logical file name.

Definition at line 93 of file MultiFileCatalog.h.

94  { return _find(lfn,&IFileCatalog::lookupLFN); }
virtual std::string lookupLFN(const std::string &lfn) const =0
Lookup file identifier by physical file name.
std::string _find(A1 &arg1, F pmf) const
virtual std::string Gaudi::MultiFileCatalog::lookupPFN ( CSTR  pfn) const
inlinevirtual

Lookup file identifier by physical file name.

Definition at line 87 of file MultiFileCatalog.h.

88  { return _find(pfn,&IFileCatalog::lookupPFN); }
virtual std::string lookupPFN(const std::string &lfn) const =0
Lookup file identifier by physical file name.
std::string _find(A1 &arg1, F pmf) const
void MultiFileCatalog::printError ( CSTR  msg,
bool  throw_exc = true 
) const
private

Definition at line 120 of file MultiFileCatalog.cpp.

120  {
121  MsgStream log(msgSvc(),name());
122  if ( rethrow ) {
123  log << MSG::FATAL << msg << endmsg;
124  throw runtime_error("Catalog> "+msg);
125  }
126  log << MSG::ERROR << msg << endmsg;
127 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
void MultiFileCatalog::propHandler ( Property )
private

simple property handle to allow interactive modification of list of the file catalogs

Definition at line 249 of file MultiFileCatalog.cpp.

250 {
251  // not yet initialized
252  if ( !m_started ) { m_oldNames = m_catalogNames; return; } // RETURN
253  // no real change - no action
254  if ( m_catalogNames == m_oldNames ) { return; }
256  // remove ALL catalogs
257  removeCatalog("") ;
258  // add new catalogs
259  for ( CatalogNames::const_iterator inew = m_catalogNames.begin() ;
260  m_catalogNames.end() != inew ; ++inew ) { addCatalog ( *inew ) ; }
261  // start
262  init() ;
263  //
264  MsgStream log ( msgSvc() , name() ) ;
265  log << MSG::DEBUG
266  << "New catalogs to be used: "
268 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool m_started
Flag to indicate if catalog is started.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:367
virtual void removeCatalog(CSTR connect)
Remove catalog identified by name from the existing ones.
CatalogNames m_catalogNames
Property : Container with catalog names.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
virtual void addCatalog(CSTR connect)
Add new catalog identified by name to the existing ones.
CatalogNames m_oldNames
BACKUP:: Container with catalog names.
virtual void init()
Parse the DOM tree of the XML catalog.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
bool MultiFileCatalog::readOnly ( ) const
virtual

Check if the catalog is read-only.

Definition at line 243 of file MultiFileCatalog.cpp.

244 { return _findX0Bool(m_catalogs,&IFileCatalog::readOnly,false); }
Catalogs m_catalogs
Container with references to known catalogs.
virtual bool readOnly() const =0
Check if the catalog is read-only.
virtual void Gaudi::MultiFileCatalog::registerFID ( CSTR  fid) const
inlinevirtual

Create a FileID and DOM Node.

Definition at line 116 of file MultiFileCatalog.h.

117  { writeCatalog()->registerFID(fid); }
virtual void registerFID(const std::string &fid) const =0
Create a Node for a FileID and DOM Node.
virtual IFileCatalog * writeCatalog(CSTR fid="") const
Access to the (first) writable file catalog.
void MultiFileCatalog::registerLFN ( CSTR  fid,
CSTR  lfn 
) const
virtual

Create a FileID and DOM Node of the LFN with all the attributes.

Definition at line 237 of file MultiFileCatalog.cpp.

237  {
238  IFileCatalog* c = getCatalog(fid,false,true,false);
239  if ( !c ) c = getCatalog("",true,true,true);
240  c->registerLFN(fid, lfn);
241 }
tuple c
Definition: gaudirun.py:341
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
virtual void registerLFN(const std::string &fid, const std::string &lfn) const =0
Create a Node for a FileID and DOM Node of the LFN with all the attributes.
File catalog interface.
Definition: IFileCatalog.h:24
void MultiFileCatalog::registerPFN ( CSTR  fid,
CSTR  pfn,
CSTR  ftype 
) const
virtual

Create a FileID and DOM Node of the PFN with all the attributes.

Definition at line 231 of file MultiFileCatalog.cpp.

231  {
232  IFileCatalog* c = getCatalog(fid,false,true,false);
233  if ( !c ) c = getCatalog("",true,true,true);
234  c->registerPFN(fid, pfn, ftype);
235 }
virtual void registerPFN(const std::string &fid, const std::string &pfn, const std::string &ftype) const =0
Create a Node for a FileID and DOM Node of the PFN with all the attributes.
tuple c
Definition: gaudirun.py:341
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
File catalog interface.
Definition: IFileCatalog.h:24
void MultiFileCatalog::removeCatalog ( CSTR  connect)
virtual

Remove catalog identified by name from the existing ones.

Definition at line 176 of file MultiFileCatalog.cpp.

176  {
177  if ( con.empty() || con == "*" ) {
179  m_catalogs.clear();
180  return;
181  }
182  removeCatalog(findCatalog(con,false));
183 }
virtual void removeCatalog(CSTR connect)
Remove catalog identified by name from the existing ones.
Catalogs m_catalogs
Container with references to known catalogs.
virtual IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const
Catalog management.
virtual unsigned long release()=0
Release Interface instance.
void _exec(T pmf) const
void MultiFileCatalog::removeCatalog ( const IFileCatalog cat)
virtual

Remove catalog identified by reference from the existing ones.

Definition at line 185 of file MultiFileCatalog.cpp.

185  {
186  if ( cat ) {
187  Catalogs::iterator i=find(m_catalogs.begin(),m_catalogs.end(),cat);
188  if ( i != m_catalogs.end() ) {
189  (*i)->release();
190  m_catalogs.erase(i);
191  return;
192  }
193  printError("Unknown file catalog -- cannot be removed.",true);
194  }
195  printError("Invalid file catalog.",true);
196 }
void printError(CSTR msg, bool throw_exc=true) const
Catalogs m_catalogs
Container with references to known catalogs.
list i
Definition: ana.py:128
virtual void Gaudi::MultiFileCatalog::rollback ( )
inlinevirtual

Save DOM catalog to file.

Definition at line 78 of file MultiFileCatalog.h.

virtual void rollback()=0
Save catalog to file.
void _exec(T pmf) const
virtual void Gaudi::MultiFileCatalog::setMetaData ( CSTR  fid,
CSTR  attr,
CSTR  val 
) const
inlinevirtual

Insert/update metadata item.

Definition at line 124 of file MultiFileCatalog.h.

125  { writeCatalog(fid)->setMetaData(fid,attr,val); }
virtual void setMetaData(const std::string &fid, const std::string &name, const std::string &value) const =0
Insert/update metadata item.
virtual IFileCatalog * writeCatalog(CSTR fid="") const
Access to the (first) writable file catalog.
void MultiFileCatalog::setWriteCatalog ( IFileCatalog cat)
virtual

Define the writable catalog identified by reference.

Definition at line 198 of file MultiFileCatalog.cpp.

198  {
199  if ( cat ) {
200  if ( !cat->readOnly() ) {
201  Catalogs::iterator i=find(m_catalogs.begin(),m_catalogs.end(),cat);
202  if ( i != m_catalogs.end() ) {
203  m_catalogs.erase(i);
204  m_catalogs.insert(m_catalogs.begin(),cat);
205  return;
206  }
207  printError("The catalog "+cat->connectInfo()+" is not known.",true);
208  }
209  printError("The catalog "+cat->connectInfo()+" is not writable.",true);
210  }
211  printError("Invalid file catalog.",true);
212 }
void printError(CSTR msg, bool throw_exc=true) const
virtual const std::string & connectInfo() const =0
Access to connect string.
Catalogs m_catalogs
Container with references to known catalogs.
virtual bool readOnly() const =0
Check if the catalog is read-only.
list i
Definition: ana.py:128
void MultiFileCatalog::setWriteCatalog ( CSTR  connect)
virtual

Define the writable catalog identified by name.

Definition at line 214 of file MultiFileCatalog.cpp.

214  {
215  Catalogs::iterator i = i_findCatalog(connect,true);
216  if ( i == m_catalogs.end() ) {
217  addCatalog(connect);
218  setWriteCatalog(findCatalog(connect,true));
219  return;
220  }
221  setWriteCatalog(*i);
222 }
virtual void setWriteCatalog(IFileCatalog *cat)
Define the writable catalog identified by reference.
Catalogs::iterator i_findCatalog(CSTR connect, bool must_be_writable)
Find catalog by connect string.
Catalogs m_catalogs
Container with references to known catalogs.
virtual IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const
Catalog management.
virtual void addCatalog(CSTR connect)
Add new catalog identified by name to the existing ones.
list i
Definition: ana.py:128
virtual IFileCatalog* Gaudi::MultiFileCatalog::writeCatalog ( CSTR  fid = "") const
inlinevirtual

Access to the (first) writable file catalog.

Definition at line 149 of file MultiFileCatalog.h.

150  { return getCatalog(fid,true,true,false); }
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.

Member Data Documentation

CatalogNames Gaudi::MultiFileCatalog::m_catalogNames
private

Property : Container with catalog names.

Definition at line 172 of file MultiFileCatalog.h.

Catalogs Gaudi::MultiFileCatalog::m_catalogs
private

Container with references to known catalogs.

Definition at line 170 of file MultiFileCatalog.h.

CatalogNames Gaudi::MultiFileCatalog::m_oldNames
private

BACKUP:: Container with catalog names.

Definition at line 176 of file MultiFileCatalog.h.

bool Gaudi::MultiFileCatalog::m_started
private

Flag to indicate if catalog is started.

Definition at line 174 of file MultiFileCatalog.h.


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