Commit 3cef3a73 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Added support for class aliases in the meta-module "Configurables"

From: Marco Clemencic <marco.clemencic@cern.ch>


git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/Gaudi/branches/GAUDI/GAUDI_newpack@6732 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent 4703c7d5
Package : Gaudi
Package manager : Marco Clemencic
! 2011-12-08 - Marco Clemencic
- Added support for class aliases in the meta-module "Configurables".
! 2011-11-01 - Marco Clemencic
- Moved core services out of GaudiSvc and into the new packages GaudiCoreSvc
and GaudiCommonSvc. (patch #1816)
......
......@@ -29,21 +29,32 @@ for package in packages :
pass
#--Fix some of the name idiosyncrasies in Gaudi
def addConfigurableAs(ori, new) :
gbl = globals()
if ori in gbl: # do the aliasing only if the original is available
gbl[new] = gbl[ori]
__all__.append(new)
gbl[new].DefaultedName = new
aliases = {
'EventDataSvc': 'EvtDataSvc',
'DetectorDataSvc': 'DetDataSvc',
'HistogramDataSvc': 'HistogramSvc',
'HbookHistSvc': 'HbookCnv__PersSvc',
'RootHistSvc': 'RootHistCnv__PersSvc',
'EventPersistencySvc': 'EvtPersistencySvc',
'DetectorPersistencySvc': 'DetPersistencySvc',
'HistogramPersistencySvc': 'HistogramPersistencySvc',
'FileRecordPersistencySvc': 'PersistencySvc',
addConfigurableAs('EvtDataSvc','EventDataSvc')
addConfigurableAs('DetDataSvc','DetectorDataSvc')
addConfigurableAs('HistogramSvc','HistogramDataSvc')
addConfigurableAs('HbookCnv__PersSvc','HbookHistSvc')
addConfigurableAs('RootHistCnv__PersSvc','RootHistSvc')
addConfigurableAs('EvtPersistencySvc','EventPersistencySvc')
addConfigurableAs('DetPersistencySvc','DetectorPersistencySvc')
addConfigurableAs('HistogramPersistencySvc','HistogramPersistencySvc')
'FileCatalog': 'Gaudi__MultiFileCatalog',
'IODataManager': 'Gaudi__IODataManager',
}
addConfigurableAs('Gaudi__MultiFileCatalog','FileCatalog')
addConfigurableAs('Gaudi__IODataManager','IODataManager')
_gbl = globals() # optimization
# This would be nicer with dict comprehension (http://www.python.org/dev/peps/pep-0274)
# but it is available only in Python 2.7
aliases = dict([(new, _gbl[old])
for new, old in aliases.items()
if old in _gbl]) # do the aliasing only if the original is available
# change the default name
for new in aliases:
aliases[new].DefaultedName = new
# update globals and __all__
_gbl.update(aliases)
__all__.extend(aliases)
# remove temporaries
del _gbl, new
......@@ -19,6 +19,7 @@ class _ConfigurablesModule(object):
def __getattr__(self, name):
# trigger the load of the configurables database
from Gaudi.Configuration import confDbGetConfigurable, cfgDb
from Gaudi.CommonGaudiConfigurables import aliases
# return value
retval = None
# handle the special cases (needed for modules): __all__, __path__
......@@ -28,6 +29,8 @@ class _ConfigurablesModule(object):
retval == None
elif name in cfgDb.keys(): # ignore private names
retval = confDbGetConfigurable(name)
elif name in aliases: # special case of aliases
retval = aliases[name]
elif self.ignoreMissingConfigurables:
import logging
logging.getLogger(__configurables_module_fullname__).warning('Configurable class %s not in database', name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment