Commits

Anonymous committed 1730734

ClassIDSvc::fillDB): use DirSearchPath instead of
PathResolver. Loop over all clid db files in DATAPATH

Comments (0)

Files changed (5)

+2007-10-04  Paolo Calafiura 
+	* src/ClassIDSvc.cxx (ClassIDSvc::fillDB): use DirSearchPath instead of
+	PathResolver. Loop over all clid db files in DATAPATH
+	tag CLIDComps-00-02-00
+
 2007-09-28  Paolo Calafiura  <calaf@0-11-25-81-1e-12.dhcp.lbl.gov>
 	* src/ClassIDSvc.cxx: add clid.db to CLIDDBFiles default value
 	tag CLIDComps-00-01-00
 use GaudiInterface GaudiInterface-* External
 use AthenaKernel   AthenaKernel-*   Control
 use CLIDSvc        CLIDSvc-*        Control
-use PathResolver   PathResolver-*   Tools
 
 library CLIDComps *.cxx -s=components *.cxx
 apply_pattern component_library

share/ClassIDSvc_test.ref

 JobOptionsSvc        INFO Job options successfully read in from ../share/ClassIDSvc_test.txt
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr $Revision: 1.2 $
-                                          running on lxplus099.cern.ch on Fri Mar  2 22:19:05 2007
+                                                   Welcome to ApplicationMgr $Revision: 1.3 $
+                                          running on lxplus217.cern.ch on Thu Oct  4 01:34:39 2007
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : 
 ApplicationMgr       INFO Application Manager Configured successfully
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
-ClassIDSvc           INFO Initializing ClassIDSvc - package version CLIDSvc-00-02-12
-ClassIDSvc        WARNING Could not resolve file name notthere.db using PathResolver DATAPATH [/afs/cern.ch/user/c/calaf/scratch0/AtlasOffline-rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasOffline/rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasAnalysis/rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasTrigger/rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasReconstruction/rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasEvent/rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasConditions/rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasCore/rel_5/InstallArea/share:/afs/cern.ch/atlas/offline/external/Gaudi/v19r2/InstallArea/share:/afs/cern.ch/atlas/offline/external/LCGCMT/LCGCMT_50a/InstallArea/share:/afs/cern.ch/atlas/project/tdaq/cmt/tdaq-common/pre-common-01-06-01/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/DetCommon/rel_5/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasSimulation/rel_5/InstallArea/share:/afs/cern.ch/atlas/offline/data:/afs/cern.ch/atlas/offline/data/testfile:/afs/cern.ch/atlas/project/magfield/CTB] ----- SKIPPING
-ClassIDSvc          DEBUG processCLIDDB: read 1069 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasCore/rel_5/InstallArea/share/clid.db
+ClassIDSvc           INFO Initializing ClassIDSvc - package version CLIDComps-00-00-04
+ClassIDSvc        WARNING Could not resolve clid DB path notthere.db using DATAPATH [/afs/cern.ch/user/c/calaf/scratch0/cliddb/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasOffline/rel_3/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasSimulation/rel_3/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasEvent/rel_3/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasConditions/rel_3/InstallArea/share:/afs/cern.ch/atlas/project/tdaq/prod/tdaq-common/tdaq-common-01-08-00/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasCore/rel_3/InstallArea/share:/afs/cern.ch/atlas/offline/external/GAUDI/v19r4p3/InstallArea/share:/afs/cern.ch/atlas/offline/external/LCGCMT/LCGCMT_53b/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasAnalysis/rel_3/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasTrigger/rel_3/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasReconstruction/rel_3/InstallArea/share:/afs/cern.ch/atlas/software/builds/nightlies/dev/DetCommon/rel_3/InstallArea/share:/afs/cern.ch/atlas/project/tdaq/prod/dqm-common/dqm-common-00-03-00/InstallArea/share:/afs/cern.ch/sw/lcg/external/MCGenerators/lhapdf/5.3.0/share:/afs/cern.ch/atlas/offline/external/GAUDI/v19r4p3/PartPropSvc/share:/afs/cern.ch/atlas/offline/data:/afs/cern.ch/atlas/offline/data/testfile:/afs/cern.ch/atlas/project/magfield/CTB] ----- SKIPPING
 ClassIDSvc           INFO  getRegistryEntries: read 2 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO ClassIDSvc Initialized successfully 
+ClassIDSvc          DEBUG processCLIDDB: read 726 entries from CLIDDB file: /afs/cern.ch/user/c/calaf/scratch0/cliddb/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 481 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasOffline/rel_3/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 479 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasSimulation/rel_3/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 448 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasEvent/rel_3/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 242 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasConditions/rel_3/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 33 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasCore/rel_3/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 713 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasAnalysis/rel_3/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 700 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasTrigger/rel_3/InstallArea/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 582 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasReconstruction/rel_3/InstallArea/share/clid.db
+ClassIDSvc           INFO  getRegistryEntries: read 2 CLIDRegistry entries for module ALL
 Now we expect to see an error message:
 ----Error Message Starts--->>
 ClassIDSvc          ERROR setTypeNameForID: input id 128 is out of allowed range 256 : 2147483647
 <<---Error Message Ends-------
 Now we expect to see an error message:
 ----Error Message Starts--->>
-ClassIDSvc          ERROR uncheckedSetTypePackageForID: CLIDComps-00-00-00 can not set type name <Ble> for CLID 7890: Known name for this ID <Bla> It was set by APack-00-39-98
+ClassIDSvc          ERROR uncheckedSetTypePackageForID: CLIDComps-00-00-04 can not set type name <Ble> for CLID 7890: Known name for this ID <Bla> It was set by APack-00-39-98
 <<---Error Message Ends-------
 Now we expect to see an error message:
 ----Error Message Starts--->>
-ClassIDSvc          ERROR uncheckedSetTypePackageForID: CLIDComps-00-00-00 can not set CLID <9945> for type name Bli: Known CLID for this name <9942>
-ClassIDSvc          ERROR  It was set by CLIDComps-00-00-00
+ClassIDSvc          ERROR uncheckedSetTypePackageForID: CLIDComps-00-00-04 can not set CLID <9945> for type name Bli: Known CLID for this name <9942>
+ClassIDSvc          ERROR  It was set by CLIDComps-00-00-04
 <<---Error Message Ends-------
-ClassIDSvc          DEBUG finalize: wrote 1072 entries to output CLIDDB file: CLIDTestOut.db
+ClassIDSvc           INFO finalize: wrote 730 entries to output CLIDDB file: CLIDTestOut.db
 *** ClassIDSvc_test OK ***

src/ClassIDSvc.cxx

 #include "GaudiKernel/IIncidentSvc.h"
 #include "GaudiKernel/Incident.h"
 #include "GaudiKernel/ModuleIncident.h"
+#include "GaudiKernel/System.h"
 #include "GaudiKernel/MsgStream.h"
 #include "CLIDSvc/tools/CLIDRegistry.h"
-#include "PathResolver/PathResolver.h"
 
 #include "ClassIDSvc.h"
 
 /// Standard Constructor
 ClassIDSvc::ClassIDSvc(const std::string& name,ISvcLocator* svc)
   : Service(name,svc), m_outputFileName("NULL"),
-    m_lastBegin (CLIDRegistry::begin()),
-    m_lastEnd (CLIDRegistry::begin())
+    m_lastBegin(CLIDRegistry::begin()),
+    m_lastEnd(CLIDRegistry::begin()),
+    m_clidDBPath(System::getEnv("DATAPATH"))
 {
   // Property Default values
   m_DBFiles.push_back("clid.db");
 ClassIDSvc::processCLIDDB(const char* fileName) {
   maybeRescan();
   bool allOK(true);
+  MsgStream log(messageService(), name());
   ifstream ifile(fileName);
   if (!ifile) {
-    MsgStream log(messageService(), name());
-    log << MSG::WARNING << "processCLIDDB: unable to open input CLIDDB " 
+    log << MSG::WARNING << "processCLIDDB: unable to open " 
 	<< fileName << endreq;
   } else {
 #ifndef NDEBUG
 	if ((readOK = !typeName.empty())) {
 	  if (uncheckedSetTypePackageForID(id, typeName, info).isSuccess()) {
 #ifndef	 NDEBUG
-	    MsgStream log(messageService(), name());
 	    log << MSG::VERBOSE 
 		<< "processCLIDDB(" << fileName 
 		<< ")\n    added entry for CLID <" << id 
 StatusCode
 ClassIDSvc::fillDB() {
   // Process the various clid dbs according to user's request
-  vector< string >::const_iterator i(m_DBFiles.begin()), iE(m_DBFiles.end());
+  vector< string >::const_iterator f(m_DBFiles.begin()), fE(m_DBFiles.end());
   bool allOK(true);
-  while (i != iE) {
-    std::string filepath(PathResolver::find_file(*i, "DATAPATH"));
-    if (filepath.empty()) {
-      MsgStream log(messageService(), name());
-      log << MSG::WARNING << "Could not resolve file name " 
-	  << *i << " using PathResolver DATAPATH [" 
-	  << getenv("DATAPATH") << "] ----- SKIPPING" << endmsg;
+  while (f != fE) {
+    DirSearchPath::path clidDB(*f++);
+    const std::string& clidDBFileName(clidDB.native_file_string());
+    if (clidDB.is_complete()) {
+      allOK = processCLIDDB(clidDBFileName.c_str());
     } else {
-      allOK &= processCLIDDB(filepath.c_str());
+      std::list<DirSearchPath::path> paths(m_clidDBPath.find_all(clidDBFileName));
+      if (paths.empty()) {
+	MsgStream log(messageService(), name());
+	log << MSG::WARNING << "Could not resolve clid DB path " 
+	    << clidDBFileName << " using DATAPATH [" 
+	    << System::getEnv("DATAPATH") << "] ----- SKIPPING" << endmsg;
+      } else {
+	std::list<DirSearchPath::path>::const_iterator p(paths.begin()), pe(paths.end());
+	while (p!=pe) allOK &= processCLIDDB((*p++).native_file_string().c_str());
+      }
     }
-    ++i;
   }
-  
-  return (allOK && getRegistryEntries("ALL")) ? 
+  return (getRegistryEntries("ALL") && allOK) ?  
     StatusCode::SUCCESS :
     StatusCode::FAILURE;
 }
  * @brief a service to manage and verify CLID assignments in athena
 
  * @author Paolo Calafiura <pcalafiura@lbl.gov> - ATLAS Collaboration
- *$Id: ClassIDSvc.h,v 1.4 2007-09-19 16:26:34 calaf Exp $
+ *$Id: ClassIDSvc.h,v 1.5 2007-10-04 18:12:25 calaf Exp $
  */
 
 #ifndef _CPP_MAP
 #endif
 #include "CLIDSvc/tools/CLIDRegistry.h"
 
+#include "AthenaKernel/DirSearchPath.h"
+
 template <class TYPE> class SvcFactory;
 
 /** @class ClassIDSvc 
   /// The last registry iterator values, for @c maybeRescan.
   CLIDRegistry::const_iterator m_lastBegin;
   CLIDRegistry::const_iterator m_lastEnd;
+
+  /// The path is which clid db files are to be searched (DATAPATH)
+  DirSearchPath m_clidDBPath;
 };
 
 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>