10 using namespace Gaudi;
16 template <
class V,
class F>
17 bool _findX0Bool(V&
array, F pmf,
bool invert) {
18 for(
typename V::const_iterator
i=array.begin();
i != array.end(); ++
i) {
19 bool res = invert ? !((*i)->*pmf)() : ((*i)->*pmf)();
20 if ( !res )
return false;
27 :
base_class(nam, svc), m_started(false), m_oldNames()
38 CatalogNames::const_iterator
i;
39 std::string current =
"";
41 printError(
"Failed to initialize service base class.",
false);
52 catch(
const std::exception& ) {
53 printError(
"Cannot add file catalog:"+current,
false);
72 static string s(
"MultiCatalog");
86 else if ( fid.empty() )
88 else if ( !fid.empty() && c->
existsFID(fid) )
93 printError(
"No writable file catalog found which contains FID:"+fid,throw_if_not);
97 log <<
MSG::DEBUG <<
"No writable file catalog found which contains FID:" << fid <<
endmsg;
104 if ( connect == (*i)->connectInfo() )
105 return (must_be_writable && (*i)->readOnly()) ? 0 : *
i;
110 MultiFileCatalog::Catalogs::iterator
113 if ( connect == (*i)->connectInfo() ) {
114 return (must_be_writable && (*i)->readOnly()) ?
m_catalogs.end() :
i;
124 throw runtime_error(
"Catalog> "+msg);
130 if ( !con.empty() ) {
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);
137 if ( strncasecmp(
"xml",typ.c_str(),3) == 0 ) {
138 cat = IFileCatalog::Factory::create(xml_typ,url,
msgSvc().
get());
142 Registry&
registry = Registry::instance();
143 if (registry.getInfo(typ).type ==
144 typeid(Service::Factory::FuncType).
name()) {
146 }
else if (registry.getInfo(typ).type ==
147 typeid(IFileCatalog::Factory::FuncType).
name()) {
148 cat = IFileCatalog::Factory::create(typ,url,
msgSvc().
get());
159 printError(
"Failed to create catalog connection:"+con,
true);
164 printError(
"Got invalid (empty) catalog connection string.",
true);
173 printError(
"Got invalid catalog to be added to multi catalog.",
true);
177 if ( con.empty() || con ==
"*" ) {
193 printError(
"Unknown file catalog -- cannot be removed.",
true);
227 if ( !(result= (*i)->getMetaDataItem(fid,attr)).empty() )
break;
259 for ( CatalogNames::const_iterator inew =
m_catalogNames.begin() ;
266 <<
"New catalogs to be used: "
Definition of the MsgStream class used to transmit messages.
MultiFileCatalog(const std::string &nam, ISvcLocator *svc)
Create a catalog file, initialization of XercesC.
virtual bool existsFID(const std::string &fid) const =0
Return the status of a FileID.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
bool m_started
Flag to indicate if catalog is started.
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.
virtual void commit()
Save DOM catalog to file.
virtual StatusCode initialize()
IService implementation.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
virtual std::string getMetaDataItem(CSTR fid, CSTR name) const
Access metadata item.
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
virtual ~MultiFileCatalog()
Destructor,.
void printError(CSTR msg, bool throw_exc=true) const
virtual void removeCatalog(CSTR connect)
Remove catalog identified by name from the existing ones.
void propHandler(Property &)
simple property handle to allow interactive modification of list of the file catalogs ...
virtual StatusCode finalize()
Finalize service object.
virtual const std::string & connectInfo() const =0
Access to connect string.
#define DECLARE_COMPONENT(type)
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.
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
CatalogNames m_catalogNames
Property : Container with catalog names.
Catalogs m_catalogs
Container with references to known catalogs.
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
virtual IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const
Catalog management.
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.
virtual const std::string & name() const
Retrieve name of the service.
virtual bool dirty() const
Check if the catalog should be updated.
Property base class allowing Property* collections to be "homogeneous".
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
virtual unsigned long release()=0
Release Interface instance.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
std::string createGuidAsString()
Create file identifier using UUID mechanism.
virtual void addCatalog(CSTR connect)
Add new catalog identified by name to the existing ones.
virtual CSTR connectInfo() const
Access to connect string.
CatalogNames m_oldNames
BACKUP:: Container with catalog names.
virtual bool readOnly() const
Check if the catalog is read-only.
Templated class to add the standard messaging functionalities.
virtual std::string createFID() const
Catalog interface.
In-memory database of the loaded factories.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual bool readOnly() const =0
Check if the catalog is read-only.
virtual void init()
Parse the DOM tree of the XML catalog.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
This is a number of static methods for bootstrapping the Gaudi framework.
virtual void registerLFN(CSTR fid, CSTR lfn) const
Create a FileID and DOM Node of the LFN with all the attributes.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
virtual void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const
Create a FileID and DOM Node of the PFN with all the attributes.
virtual bool dirty() const =0
Check if the catalog should be updated.
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
This class constitutes the core of the XML based FileCatalog API for using POOL within Gaudi...