|
Gaudi Framework, version v21r7 |
| Home | Generated: 22 Jan 2010 |
#include <ApplicationMgr.h>


Public Types | |
| typedef std::list< std::pair < IService *, int > > | ListSvc |
| typedef std::list< std::string > | ListName |
| typedef std::vector< std::string > | VectorName |
Public Member Functions | |
| ApplicationMgr (IInterface *=0) | |
| virtual | ~ApplicationMgr () |
| virtual StatusCode | queryInterface (const InterfaceID &iid, void **pinterface) |
| virtual StatusCode | run () |
| virtual StatusCode | configure () |
| virtual StatusCode | terminate () |
| virtual StatusCode | initialize () |
| virtual StatusCode | start () |
| virtual StatusCode | stop () |
| virtual StatusCode | finalize () |
| virtual StatusCode | nextEvent (int maxevt) |
| virtual const std::string & | name () const |
| This is needed to avoid ambiguous calls to name(). | |
| virtual StatusCode | executeEvent (void *par) |
| implementation of IEventProcessor::executeEvent(void*) | |
| virtual StatusCode | executeRun (int evtmax) |
| implementation of IEventProcessor::executeRun(int) | |
| virtual StatusCode | stopRun () |
| implementation of IEventProcessor::stopRun() | |
| virtual Gaudi::StateMachine::State | FSMState () const |
| virtual Gaudi::StateMachine::State | targetFSMState () const |
| virtual StatusCode | reinitialize () |
| virtual StatusCode | restart () |
| virtual StatusCode | sysInitialize () |
| virtual StatusCode | sysStart () |
| virtual StatusCode | sysStop () |
| virtual StatusCode | sysFinalize () |
| virtual StatusCode | sysReinitialize () |
| virtual StatusCode | sysRestart () |
| void | SIGoHandler (Property &theProp) |
| void | SIExitHandler (Property &theProp) |
| template<class I> | |
| SmartIF< IComponentManager > & | getManager () |
| SmartIF< ISvcManager > & | svcManager () |
| SmartIF< IAlgManager > & | algManager () |
| virtual SmartIF< ISvcLocator > & | serviceLocator () const |
| Needed to locate the message service. | |
Property handlers | |
| void | evtLoopPropertyHandler (Property &theProp) |
| StatusCode | decodeExtSvcNameList () |
| StatusCode | decodeCreateSvcNameList () |
| void | createSvcNameListHandler (Property &) |
| void | extSvcNameListHandler (Property &theProp) |
| StatusCode | decodeMultiThreadSvcNameList () |
| void | multiThreadSvcNameListHandler (Property &theProp) |
| StatusCode | decodeDllNameList () |
| void | dllNameListHandler (Property &theProp) |
| void | reflexDebugPropertyHandler (Property &theProp) |
| void | initLoopCheckHndlr (Property &) |
Protected Types | |
| typedef std::map< unsigned long, SmartIF < IComponentManager > > | ManagersMap |
| Typedef for the map of component managers, the key is the "id" field of the basic InterfaceID of the managed components. | |
Protected Member Functions | |
| StatusCode | declareMultiSvcType (const std::string &name, const std::string &type) |
| declare one or more copies of svc type/name as determined by NoOfThreads | |
| StatusCode | addMultiSvc (const Gaudi::Utils::TypeNameString &typeName, int prio) |
| add one or more copies of svc type/name as determined by NoOfThreads | |
| void | setServiceManager (ISvcManager *) |
| StatusCode | i_startup () |
| Internal startup routine. | |
| StatusCode | GoToState (Gaudi::StateMachine::State state, bool ignoreFailures=false) |
| Reach a state from current state (whichever it is) going through the correct transitions. | |
Protected Attributes | |
| ManagersMap | m_managers |
| Map of known component managers. | |
| StringArrayProperty | m_declaredManagers |
| Property to declare the list of known managers. | |
| SmartIF< ISvcManager > | m_svcManager |
| Cached pointer to the manager of services. | |
| SmartIF< IAlgManager > | m_algManager |
| Cached pointer to the manager of algorithms. | |
| DLLClassManager * | m_classManager |
| Reference to the class manager. | |
| SmartIF< ISvcLocator > | m_svcLocator |
| Reference to its own service locator. | |
| IntegerProperty | m_SIGo |
| For SI's "Go" command via callback. | |
| IntegerProperty | m_SIExit |
| For SI's "Exit" command via callback. | |
| StringArrayProperty | m_topAlgNameList |
| List of top level algorithms names. | |
| StringArrayProperty | m_outStreamNameList |
| List of output stream names. | |
| StringProperty | m_outStreamType |
| Output stream type (obsolete?). | |
| StringProperty | m_messageSvcType |
| MessageSvc type. | |
| StringProperty | m_jobOptionsSvcType |
| JobOptionsSvc type. | |
| ListSvc | m_topSvcList |
| List of top level services. | |
| ListName | m_topSvcNameList |
| List of top level services names. | |
| std::string | m_name |
| Name. | |
| Gaudi::StateMachine::State | m_state |
| Internal State. | |
| Gaudi::StateMachine::State | m_targetState |
| Internal State. | |
| VectorName | m_defServices |
| Vector default services names. | |
| VectorName | m_svcMapping |
| Default mapping of services. | |
| VectorName | m_svcOptMapping |
| Default mapping of services. | |
| PropertyMgr * | m_propertyMgr |
| Reference to Property Manager. | |
| SmartIF< IMessageSvc > | m_messageSvc |
| Reference to the message service. | |
| SmartIF< IRunable > | m_runable |
| Reference to the runable object. | |
| SmartIF< IEventProcessor > | m_processingMgr |
| Reference to processing manager object. | |
| SmartIF< IJobOptionsSvc > | m_jobOptionsSvc |
| Reference to JobOption service. | |
| int | m_evtMax |
| Number of events to be processed. | |
| StringArrayProperty | m_extSvcNameList |
| List of external services names. | |
| BooleanProperty | m_extSvcCreates |
| LHCb or ATLAS defn of "ExtSvc". | |
| StringArrayProperty | m_multiThreadSvcNameList |
| List of external services names for which we want a copy per evt thread. | |
| int | m_noOfEvtThreads |
| no of multiThreadSvc copies | |
| StringArrayProperty | m_dllNameList |
| List of DDL's names. | |
| std::string | m_jobOptionsType |
| Source type (e.g. dbase, file...). | |
| std::string | m_jobOptionsPath |
| The "file" to look for properties. | |
| std::string | m_runableType |
| Runable type. | |
| std::string | m_eventLoopMgr |
| Processing manager type. | |
| std::string | m_evtsel |
| Event selection. | |
| std::string | m_histPersName |
| CGL: Name of the Hist Pers Svc. | |
| int | m_outputLevel |
| Message output level. | |
| std::string | m_appName |
| The name of the application. | |
| std::string | m_appVersion |
| The version of the application. | |
| bool | m_actHistory |
| Activate HistorySvc. | |
| bool | m_codeCheck |
| Activate StatusCode checking. | |
| IntegerProperty | m_reflexDebugLevel |
| Debug level for the reflex plugin system. | |
| StringArrayProperty | m_createSvcNameList |
| BooleanProperty | m_auditTools |
| Defaults for auditors. | |
| BooleanProperty | m_auditSvcs |
| BooleanProperty | m_auditAlgs |
| std::map< std::string, std::string > | m_environment |
| Environment variables to set. | |
| BooleanProperty | m_loopCheck |
| For ServiceMgr initialization loop checking. | |
| bool | m_propertiesPrint |
| flag to activate the printout of properties | |
Private Types | |
| typedef CommonMessaging < implements4< IAppMgrUI, IEventProcessor, IService, IStateful > > | base_class |
| Typedef to this class. | |
Private Attributes | |
| std::vector< std::string > | m_okDlls |
| names of successfully loaded dlls | |
The main purpose of the Application Manager is to steer any data processing application. This includes all data processing applications for LHCb data in all stages: simulation, reconstruction, analysis, high level triggers, etc. Specific implementations of the ApplicationMgr will be developed to cope with the different environments (on-line, off-line, interactive, batch, etc.).
Definition at line 47 of file ApplicationMgr.h.
typedef CommonMessaging<implements4<IAppMgrUI, IEventProcessor, IService, IStateful> > ApplicationMgr::base_class [private] |
Typedef to this class.
Reimplemented from CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.
Definition at line 54 of file ApplicationMgr.h.
| typedef std::list<std::pair<IService*,int> > ApplicationMgr::ListSvc |
Definition at line 56 of file ApplicationMgr.h.
| typedef std::list<std::string> ApplicationMgr::ListName |
Definition at line 57 of file ApplicationMgr.h.
Definition at line 58 of file ApplicationMgr.h.
typedef std::map<unsigned long, SmartIF<IComponentManager> > ApplicationMgr::ManagersMap [protected] |
Typedef for the map of component managers, the key is the "id" field of the basic InterfaceID of the managed components.
Definition at line 184 of file ApplicationMgr.h.
| ApplicationMgr::ApplicationMgr | ( | IInterface * | = 0 |
) |
Definition at line 44 of file ApplicationMgr.cpp.
00044 : base_class() { 00045 // IInterface initialization 00046 addRef(); // Initial count set to 1 00047 00048 // Initialize two basic services: messagesvc & joboptions 00049 m_messageSvc = 0; 00050 m_jobOptionsSvc = 0; 00051 00052 // Instantiate component managers 00053 m_managers[IService::interfaceID().id()] = new ServiceManager(this); 00054 m_managers[IAlgorithm::interfaceID().id()] = new AlgorithmManager(this); 00055 00056 m_svcLocator = svcManager(); 00057 00058 // Instantiate internal services 00059 // SvcLocator/Factory HAS to be already instantiated 00060 m_classManager = new DLLClassManager(this); 00061 m_propertyMgr = new PropertyMgr(this); 00062 00063 m_name = "ApplicationMgr"; 00064 m_state = Gaudi::StateMachine::OFFLINE; 00065 m_targetState = Gaudi::StateMachine::OFFLINE; 00066 00067 m_propertyMgr->declareProperty("Go", m_SIGo = 0 ); 00068 m_propertyMgr->declareProperty("Exit", m_SIExit = 0 ); 00069 m_propertyMgr->declareProperty("Dlls", m_dllNameList ); 00070 m_propertyMgr->declareProperty("ExtSvc", m_extSvcNameList ); 00071 m_propertyMgr->declareProperty("CreateSvc", m_createSvcNameList ); 00072 m_propertyMgr->declareProperty("ExtSvcCreates", m_extSvcCreates=true ); 00073 00074 m_propertyMgr->declareProperty("SvcMapping", m_svcMapping ); 00075 m_propertyMgr->declareProperty("SvcOptMapping", m_svcOptMapping ); 00076 00077 m_propertyMgr->declareProperty("TopAlg", m_topAlgNameList ); 00078 m_propertyMgr->declareProperty("OutStream", m_outStreamNameList ); 00079 m_propertyMgr->declareProperty("OutStreamType", m_outStreamType = "OutputStream" ); 00080 m_propertyMgr->declareProperty("MessageSvcType",m_messageSvcType= "MessageSvc" ); 00081 m_propertyMgr->declareProperty("JobOptionsSvcType", 00082 m_jobOptionsSvcType = "JobOptionsSvc" ); 00083 m_propertyMgr->declareProperty( s_runable, m_runableType = "AppMgrRunable"); 00084 m_propertyMgr->declareProperty( s_eventloop, m_eventLoopMgr = "EventLoopMgr"); 00085 00086 m_propertyMgr->declareProperty("HistogramPersistency", m_histPersName="NONE"); 00087 00088 // Declare Job Options Service properties and set default 00089 m_propertyMgr->declareProperty("JobOptionsType", m_jobOptionsType = "FILE"); 00090 m_propertyMgr->declareProperty("JobOptionsPath", m_jobOptionsPath = ""); 00091 m_propertyMgr->declareProperty("EvtMax", m_evtMax = -1); 00092 m_propertyMgr->declareProperty("EvtSel", m_evtsel ); 00093 m_propertyMgr->declareProperty("OutputLevel", m_outputLevel = MSG::INFO); 00094 00095 m_propertyMgr->declareProperty("MultiThreadExtSvc", m_multiThreadSvcNameList); 00096 m_propertyMgr->declareProperty("NoOfThreads", m_noOfEvtThreads = 0); 00097 m_propertyMgr->declareProperty("AppName", m_appName = "ApplicationMgr"); 00098 m_propertyMgr->declareProperty("AppVersion", m_appVersion = ""); 00099 00100 m_propertyMgr->declareProperty("AuditTools", m_auditTools = false); 00101 m_propertyMgr->declareProperty("AuditServices", m_auditSvcs = false); 00102 m_propertyMgr->declareProperty("AuditAlgorithms", m_auditAlgs = false); 00103 00104 m_propertyMgr->declareProperty("ActivateHistory", m_actHistory = false); 00105 m_propertyMgr->declareProperty("StatusCodeCheck", m_codeCheck = false); 00106 00107 m_propertyMgr->declareProperty("Environment", m_environment); 00108 00109 // ServiceMgr Initialization loop checking 00110 m_propertyMgr->declareProperty("InitializationLoopCheck", m_loopCheck = true) 00111 ->declareUpdateHandler(&ApplicationMgr::initLoopCheckHndlr, this); 00112 svcManager()->setLoopCheckEnabled(m_loopCheck); 00113 00114 // Flag to activate the printout of properties 00115 m_propertyMgr->declareProperty 00116 ( "PropertiesPrint", 00117 m_propertiesPrint = false, 00118 "Flag to activate the printout of properties" ); 00119 00120 m_propertyMgr->declareProperty("ReflexPluginDebugLevel", m_reflexDebugLevel = 0 ); 00121 00122 // Add action handlers to the appropriate properties 00123 m_SIGo.declareUpdateHandler ( &ApplicationMgr::SIGoHandler , this ); 00124 m_SIExit.declareUpdateHandler( &ApplicationMgr::SIExitHandler , this ); 00125 m_topAlgNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this); 00126 m_outStreamNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this); 00127 m_outStreamType.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this); 00128 m_reflexDebugLevel.declareUpdateHandler(&ApplicationMgr::reflexDebugPropertyHandler, this); 00129 m_svcMapping.push_back("EvtDataSvc/EventDataSvc"); 00130 m_svcMapping.push_back("DetDataSvc/DetectorDataSvc"); 00131 m_svcMapping.push_back("HistogramSvc/HistogramDataSvc"); 00132 m_svcMapping.push_back("HbookCnv::PersSvc/HbookHistSvc"); 00133 m_svcMapping.push_back("RootHistCnv::PersSvc/RootHistSvc"); 00134 m_svcMapping.push_back("EvtPersistencySvc/EventPersistencySvc"); 00135 m_svcMapping.push_back("DetPersistencySvc/DetectorPersistencySvc"); 00136 m_svcMapping.push_back("HistogramPersistencySvc/HistogramPersistencySvc"); 00137 }
| ApplicationMgr::~ApplicationMgr | ( | ) | [virtual] |
Definition at line 142 of file ApplicationMgr.cpp.
00142 { 00143 if( m_classManager ) m_classManager->release(); 00144 if( m_propertyMgr ) m_propertyMgr->release(); 00145 if( m_messageSvc ) m_messageSvc->release(); 00146 if( m_jobOptionsSvc ) m_jobOptionsSvc->release(); 00147 }
| StatusCode ApplicationMgr::queryInterface | ( | const InterfaceID & | iid, | |
| void ** | pinterface | |||
| ) | [virtual] |
Definition at line 153 of file ApplicationMgr.cpp.
00155 { 00156 if ( 0 == ppvi ) { return StatusCode::FAILURE ; } 00157 00158 // try to find own/direct interfaces: 00159 StatusCode sc = base_class::queryInterface(iid,ppvi); 00160 if (sc.isSuccess()) return sc; 00161 00162 // find indirect interfaces : 00163 if ( ISvcLocator ::interfaceID() . versionMatch ( iid ) ) 00164 { return serviceLocator()-> queryInterface ( iid , ppvi ) ; } 00165 else if ( ISvcManager ::interfaceID() . versionMatch ( iid ) ) 00166 { return svcManager() -> queryInterface ( iid , ppvi ) ; } 00167 else if ( IAlgManager ::interfaceID() . versionMatch ( iid ) ) 00168 { return algManager() -> queryInterface ( iid , ppvi ) ; } 00169 else if ( IClassManager ::interfaceID() . versionMatch ( iid ) ) 00170 { return m_classManager -> queryInterface ( iid , ppvi ) ; } 00171 else if ( IProperty ::interfaceID() . versionMatch ( iid ) ) 00172 { return m_propertyMgr -> queryInterface ( iid , ppvi ) ; } 00173 else if ( IMessageSvc ::interfaceID() . versionMatch ( iid ) ) 00174 { 00175 *ppvi = reinterpret_cast<void*>(m_messageSvc.get()); 00176 if (m_messageSvc) { 00177 m_messageSvc->addRef(); 00178 } 00179 // Note that 0 can be a valid IMessageSvc pointer value (when used for 00180 // MsgStream). 00181 return StatusCode::SUCCESS; 00182 } 00183 else 00184 { *ppvi = 0 ; return StatusCode::FAILURE; } // RETURN 00185 // increment the reference counter: 00186 addRef (); 00187 // 00188 return StatusCode::SUCCESS ; 00189 }
| StatusCode ApplicationMgr::run | ( | ) | [virtual] |
Definition at line 792 of file ApplicationMgr.cpp.
00792 { 00793 StatusCode sc = StatusCode::SUCCESS; 00794 00795 sc = GoToState(Gaudi::StateMachine::RUNNING); 00796 if ( sc.isSuccess() ) { 00797 MsgStream log(m_messageSvc, name()); 00798 if ( m_runable != 0 ) { // loop over the events 00799 sc = m_runable->run(); 00800 if ( !sc.isSuccess() ) { 00801 log << MSG::FATAL << "Application execution failed. Ending the job." 00802 << endmsg; 00803 } 00804 } else { 00805 log << MSG::FATAL << "Application has no runable object. Check option:" 00806 << s_runable << endmsg; 00807 } 00808 } 00809 if (sc.isSuccess()) { // try to close cleanly 00810 sc = GoToState(Gaudi::StateMachine::OFFLINE); 00811 } 00812 // either the runable failed of the stut-down 00813 if (sc.isFailure()) { // try to close anyway (but keep the StatusCode unchanged) 00814 GoToState(Gaudi::StateMachine::OFFLINE,true).ignore(); 00815 } 00816 return sc; 00817 }
| StatusCode ApplicationMgr::configure | ( | ) | [virtual] |
Definition at line 288 of file ApplicationMgr.cpp.
00288 { 00289 // Check if the state is compatible with the transition 00290 MsgStream tlog( m_messageSvc, name() ); 00291 if( Gaudi::StateMachine::CONFIGURED == m_state ) { 00292 tlog << MSG::INFO << "Already Configured" << endmsg; 00293 return StatusCode::SUCCESS; 00294 } 00295 else if( Gaudi::StateMachine::OFFLINE != m_state ) { 00296 tlog << MSG::FATAL 00297 << "configure: Invalid state \"" << m_state << "\"" << endmsg; 00298 return StatusCode::FAILURE; 00299 } 00300 m_targetState = Gaudi::StateMachine::CONFIGURED; 00301 00302 StatusCode sc; 00303 sc = i_startup(); 00304 if ( !sc.isSuccess() ) { 00305 return sc; 00306 } 00307 00308 MsgStream log( m_messageSvc, name() ); 00309 00310 // Get my own options using the Job options service 00311 log << MSG::DEBUG << "Getting my own properties" << endmsg; 00312 sc = m_jobOptionsSvc->setMyProperties( name(), m_propertyMgr ); 00313 if( !sc.isSuccess() ) { 00314 log << MSG::WARNING << "Problems getting my properties from JobOptionsSvc" 00315 << endmsg; 00316 return sc; 00317 } 00318 00319 // Check current outputLevel to eventually inform the MessageSvc 00320 if( m_outputLevel != MSG::NIL && !m_appName.empty() ) { 00321 assert(m_messageSvc != 0); 00322 m_messageSvc->setOutputLevel( name(), m_outputLevel ); 00323 // Print a welcome message 00324 log << MSG::ALWAYS 00325 << std::endl 00326 << "==================================================================" 00327 << "==================================================================" 00328 << std::endl 00329 << " " 00330 << " Welcome to " << m_appName; 00331 00332 if( "" != m_appVersion ) { 00333 log << MSG::ALWAYS << " version " << m_appVersion; 00334 } 00335 else { 00336 log << MSG::ALWAYS << " $Revision: 1.77 $"; 00337 } 00338 00339 // Add the host name and current time to the message 00340 time_t t; 00341 std::time( &t ); 00342 tm* localt = std::localtime( &t ); 00343 00344 log << MSG::ALWAYS 00345 << std::endl 00346 << " " 00347 << " running on " << System::hostName() 00348 << " on " << std::asctime( localt ) 00349 << "==================================================================" 00350 << "==================================================================" 00351 << endmsg; 00352 } 00353 00354 // print all own properties if the options "PropertiesPrint" is set to true 00355 if ( m_propertiesPrint ) 00356 { 00357 typedef std::vector<Property*> Properties; 00358 const Properties& properties = m_propertyMgr->getProperties() ; 00359 log << MSG::ALWAYS 00360 << "List of ALL properties of " 00361 << System::typeinfoName ( typeid( *this ) ) << "/" << this->name() 00362 << " #properties = " << properties.size() << endmsg ; 00363 for ( Properties::const_iterator property = properties.begin() ; 00364 properties.end() != property ; ++property ) 00365 { log << "Property ['Name': Value] = " << ( **property) << endmsg ; } 00366 } 00367 00368 // Check if StatusCode need to be checked 00369 if (m_codeCheck) { 00370 StatusCode::enableChecking(); 00371 sc = addMultiSvc("StatusCodeSvc", -9999); 00372 if ( sc.isFailure() ) { 00373 log << MSG::FATAL << "Error adding StatusCodeSvc for multiple threads" << endmsg; 00374 return StatusCode::FAILURE; 00375 } 00376 } else { 00377 StatusCode::disableChecking(); 00378 } 00379 00380 // set the requested environment variables 00381 std::map<std::string,std::string>::iterator var; 00382 for ( var = m_environment.begin(); var != m_environment.end(); ++var ) { 00383 const std::string &name = var->first; 00384 const std::string &value = var->second; 00385 std::string old = System::getEnv(name.c_str()); 00386 if ( !old.empty() && (old != "UNKNOWN" )) { 00387 log << MSG::WARNING; 00388 } 00389 else { 00390 log << MSG::DEBUG; 00391 } 00392 log << "Setting " << name << " = " << value << endmsg; 00393 System::setEnv(name,value); 00394 } 00395 00396 //Declare Service Types 00397 VectorName::const_iterator j; 00398 for(j=m_svcMapping.begin(); j != m_svcMapping.end(); ++j) { 00399 Gaudi::Utils::TypeNameString itm(*j); 00400 if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) { 00401 log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg; 00402 return StatusCode::FAILURE; 00403 } 00404 } 00405 for(j=m_svcOptMapping.begin(); j != m_svcOptMapping.end(); ++j) { 00406 Gaudi::Utils::TypeNameString itm(*j); 00407 if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) { 00408 log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg; 00409 return StatusCode::FAILURE; 00410 } 00411 } 00412 00413 //-------------------------------------------------------------------------- 00414 // Declare other Services and Algorithms by loading DLL's 00415 sc = decodeDllNameList( ); 00416 if ( sc.isFailure( ) ) { 00417 log << MSG::ERROR << "Failure loading declared DLL's" << endmsg; 00418 return sc; 00419 } 00420 00421 //-------------------------------------------------------------------------- 00422 // Deal with the services explicitely declared by the user. 00423 sc = decodeExtSvcNameList(); 00424 if ( sc.isFailure( ) ) { 00425 log << MSG::ERROR << "Failure during external service association" << endmsg; 00426 return sc; 00427 } 00428 00429 sc = decodeMultiThreadSvcNameList( ); 00430 if ( sc.isFailure( ) ) { 00431 log << MSG::ERROR << "Failure during multi thread service creation" 00432 << endmsg; 00433 return sc; 00434 } 00435 00436 sc = decodeCreateSvcNameList(); 00437 if ( sc.isFailure( ) ) { 00438 log << MSG::ERROR << "Failure during external service creation" << endmsg; 00439 return sc; 00440 } 00441 00442 00443 //-------------------------------------------------------------------------- 00444 // Retrieve intrinsic services. If needed configure them. 00445 //-------------------------------------------------------------------------- 00446 Gaudi::Utils::TypeNameString evtloop_item(m_eventLoopMgr); 00447 sc = addMultiSvc(evtloop_item, 100); 00448 if( !sc.isSuccess() ) { 00449 log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg; 00450 return sc; 00451 } 00452 00453 if (m_noOfEvtThreads == 0) { 00454 m_runable = m_svcLocator->service(m_runableType); 00455 if( !m_runable.isValid() ) { 00456 log << MSG::FATAL 00457 << "Error retrieving Runable:" << m_runableType 00458 << "\n Check option ApplicationMgr." << s_runable << endmsg; 00459 return sc; 00460 } 00461 m_processingMgr = m_svcLocator->service(evtloop_item); 00462 if( !m_processingMgr.isValid() ) { 00463 log << MSG::FATAL 00464 << "Error retrieving Processing manager:" << m_eventLoopMgr 00465 << "\n Check option ApplicationMgr." << s_eventloop 00466 << "\n No events will be processed." << endmsg; 00467 return sc; 00468 } 00469 } 00470 00471 // Establish Update Handlers for ExtSvc and DLLs Properties 00472 m_extSvcNameList.declareUpdateHandler (&ApplicationMgr::extSvcNameListHandler, 00473 this); 00474 m_createSvcNameList.declareUpdateHandler (&ApplicationMgr::createSvcNameListHandler, 00475 this); 00476 m_multiThreadSvcNameList.declareUpdateHandler 00477 (&ApplicationMgr::multiThreadSvcNameListHandler, this); 00478 m_dllNameList.declareUpdateHandler (&ApplicationMgr::dllNameListHandler, 00479 this ); 00480 00481 if (m_actHistory) { 00482 // Create HistorySvc with a priority to ensure it's initialized last, finalized first 00483 sc = svcManager()->addService("HistorySvc",std::numeric_limits<int>::max()); 00484 if ( sc.isFailure() ) { 00485 log << MSG::FATAL << "Error adding HistorySvc" << endmsg; 00486 return StatusCode::FAILURE; 00487 } 00488 00489 if (m_noOfEvtThreads > 0) { 00490 sc = addMultiSvc("HistorySvc",std::numeric_limits<int>::max()); 00491 if ( sc.isFailure() ) { 00492 log << MSG::FATAL << "Error adding HistorySvc for multiple threads" 00493 << endmsg; 00494 return StatusCode::FAILURE; 00495 } 00496 } 00497 } 00498 00499 log << MSG::INFO << "Application Manager Configured successfully" << endmsg; 00500 m_state = m_targetState; 00501 return StatusCode::SUCCESS; 00502 }
| StatusCode ApplicationMgr::terminate | ( | ) | [virtual] |
Definition at line 671 of file ApplicationMgr.cpp.
00671 { 00672 MsgStream log( m_messageSvc, name() ); 00673 00674 if( m_state == Gaudi::StateMachine::OFFLINE ) { 00675 log << MSG::INFO << "Already Offline" << endmsg; 00676 return StatusCode::SUCCESS; 00677 } 00678 else if( m_state != Gaudi::StateMachine::CONFIGURED ) { 00679 log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\"" 00680 << endmsg; 00681 return StatusCode::FAILURE; 00682 } 00683 // release all Services 00684 m_targetState = Gaudi::StateMachine::OFFLINE; 00685 00686 00687 log << MSG::INFO << "Application Manager Terminated successfully" << endmsg; 00688 00689 { // Force a disable the auditing of finalize for MessageSvc 00690 SmartIF<IProperty> prop(m_messageSvc); 00691 if (prop.isValid()) { 00692 prop->setProperty(BooleanProperty("AuditFinalize", false)); 00693 } 00694 } 00695 { // Force a disable the auditing of finalize for JobOptionsSvc 00696 SmartIF<IProperty> prop(m_jobOptionsSvc); 00697 if (prop.isValid()) { 00698 prop->setProperty(BooleanProperty("AuditFinalize", false)); 00699 } 00700 } 00701 00702 // finalize MessageSvc 00703 SmartIF<IService> svc(m_messageSvc); 00704 if ( !svc.isValid() ) { 00705 log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg; 00706 } else { 00707 svc->sysFinalize().ignore(); 00708 } 00709 00710 // finalize JobOptionsSvc 00711 svc = m_jobOptionsSvc; 00712 if ( !svc.isValid() ) { 00713 log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg; 00714 } else { 00715 svc->sysFinalize().ignore(); 00716 } 00717 00718 m_state = m_targetState; 00719 return StatusCode::SUCCESS; 00720 }
| StatusCode ApplicationMgr::initialize | ( | ) | [virtual] |
Definition at line 507 of file ApplicationMgr.cpp.
00507 { 00508 00509 MsgStream log( m_messageSvc, name() ); 00510 StatusCode sc; 00511 00512 if( m_state == Gaudi::StateMachine::INITIALIZED ) { 00513 log << MSG::INFO << "Already Initialized!" << endmsg; 00514 return StatusCode::SUCCESS; 00515 } 00516 else if( m_state != Gaudi::StateMachine::CONFIGURED ) { 00517 log << MSG::FATAL 00518 << "initialize: Invalid state \"" << m_state << "\"" << endmsg; 00519 return StatusCode::FAILURE; 00520 } 00521 m_targetState = Gaudi::StateMachine::INITIALIZED; 00522 00523 //-------------------------------------------------------------------------- 00524 // Initialize the list of top Services 00525 //-------------------------------------------------------------------------- 00526 sc = svcManager()->initialize(); 00527 if( !sc.isSuccess() ) return sc; 00528 00529 //-------------------------------------------------------------------------- 00530 // Final steps: Inform user and change internal state 00531 //-------------------------------------------------------------------------- 00532 log << MSG::INFO << "Application Manager Initialized successfully" << endmsg; 00533 m_state = m_targetState; 00534 00535 return sc; 00536 }
| StatusCode ApplicationMgr::start | ( | ) | [virtual] |
Definition at line 541 of file ApplicationMgr.cpp.
00541 { 00542 00543 MsgStream log( m_messageSvc, name() ); 00544 StatusCode sc; 00545 00546 if( m_state == Gaudi::StateMachine::RUNNING ) { 00547 log << MSG::INFO << "Already Initialized!" << endmsg; 00548 return StatusCode::SUCCESS; 00549 } 00550 else if( m_state != Gaudi::StateMachine::INITIALIZED ) { 00551 log << MSG::FATAL 00552 << "start: Invalid state \"" << m_state << "\"" << endmsg; 00553 return StatusCode::FAILURE; 00554 } 00555 m_targetState = Gaudi::StateMachine::RUNNING; 00556 00557 //-------------------------------------------------------------------------- 00558 // Initialize the list of top Services 00559 //-------------------------------------------------------------------------- 00560 sc = svcManager()->start(); 00561 if( !sc.isSuccess() ) return sc; 00562 00563 //-------------------------------------------------------------------------- 00564 // Final steps: Inform user and change internal state 00565 //-------------------------------------------------------------------------- 00566 log << MSG::INFO << "Application Manager Started successfully" << endmsg; 00567 m_state = m_targetState; 00568 00569 return sc; 00570 }
| StatusCode ApplicationMgr::stop | ( | ) | [virtual] |
Definition at line 594 of file ApplicationMgr.cpp.
00594 { 00595 00596 MsgStream log( m_messageSvc, name() ); 00597 StatusCode sc; 00598 00599 if( m_state == Gaudi::StateMachine::INITIALIZED ) { 00600 log << MSG::INFO << "Already Initialized!" << endmsg; 00601 return StatusCode::SUCCESS; 00602 } 00603 else if( m_state != Gaudi::StateMachine::RUNNING ) { 00604 log << MSG::FATAL 00605 << "stop: Invalid state \"" << m_state << "\"" << endmsg; 00606 return StatusCode::FAILURE; 00607 } 00608 m_targetState = Gaudi::StateMachine::INITIALIZED; 00609 00610 // Stop independently managed Algorithms 00611 sc = algManager()->stop(); 00612 if( !sc.isSuccess() ) return sc; 00613 00614 //-------------------------------------------------------------------------- 00615 // Stop the list of top Services 00616 //-------------------------------------------------------------------------- 00617 sc = svcManager()->stop(); 00618 if( !sc.isSuccess() ) return sc; 00619 00620 //-------------------------------------------------------------------------- 00621 // Final steps: Inform user and change internal state 00622 //-------------------------------------------------------------------------- 00623 log << MSG::INFO << "Application Manager Stopped successfully" << endmsg; 00624 m_state = m_targetState; 00625 00626 return sc; 00627 }
| StatusCode ApplicationMgr::finalize | ( | void | ) | [virtual] |
Definition at line 632 of file ApplicationMgr.cpp.
00632 { 00633 MsgStream log( m_messageSvc, name() ); 00634 if( m_state == Gaudi::StateMachine::CONFIGURED ) { 00635 log << MSG::INFO << "Already Finalized" << endmsg; 00636 return StatusCode::SUCCESS; 00637 } 00638 else if( m_state != Gaudi::StateMachine::INITIALIZED ) { 00639 log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\"" 00640 << endmsg; 00641 return StatusCode::FAILURE; 00642 } 00643 m_targetState = Gaudi::StateMachine::CONFIGURED; 00644 00645 // disable message suppression in finalize 00646 m_svcLocator->service<IProperty>("MessageSvc")->setProperty(BooleanProperty("enableSuppression", false)).ignore(); 00647 00648 // Finalize independently managed Algorithms 00649 StatusCode sc = algManager()->finalize(); 00650 00651 00652 // Finalize all Services 00653 sc = svcManager()->finalize(); 00654 00655 //svcManager()->removeService( (IService*) m_processingMgr.get() ); 00656 //svcManager()->removeService( (IService*) m_runable.get() ); 00657 00658 if (m_codeCheck) { 00659 StatusCode::disableChecking(); 00660 } 00661 00662 log << MSG::INFO << "Application Manager Finalized successfully" << endmsg; 00663 00664 m_state = m_targetState; 00665 return sc; 00666 }
| StatusCode ApplicationMgr::nextEvent | ( | int | maxevt | ) | [virtual] |
Definition at line 575 of file ApplicationMgr.cpp.
00575 { 00576 if( m_state != Gaudi::StateMachine::RUNNING ) { 00577 MsgStream log( m_messageSvc, name() ); 00578 log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\"" 00579 << endmsg; 00580 return StatusCode::FAILURE; 00581 } 00582 if (!m_processingMgr.isValid()) { 00583 MsgStream log( m_messageSvc, name() ); 00584 log << MSG::FATAL << "No event processing manager specified. Check option:" 00585 << s_eventloop << endmsg; 00586 return StatusCode::FAILURE; 00587 } 00588 return m_processingMgr->nextEvent(maxevt); 00589 }
| const std::string & ApplicationMgr::name | ( | ) | const [virtual] |
This is needed to avoid ambiguous calls to name().
Implements CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.
Definition at line 868 of file ApplicationMgr.cpp.
00868 { 00869 return m_name; 00870 }
| StatusCode ApplicationMgr::executeEvent | ( | void * | par | ) | [virtual] |
implementation of IEventProcessor::executeEvent(void*)
Definition at line 822 of file ApplicationMgr.cpp.
00822 { 00823 MsgStream log( m_messageSvc, name() ); 00824 if( m_state == Gaudi::StateMachine::RUNNING ) { 00825 if ( m_processingMgr.isValid() ) { 00826 return m_processingMgr->executeEvent(par); 00827 } 00828 } 00829 log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\"" 00830 <<endmsg; 00831 return StatusCode::FAILURE; 00832 }
| StatusCode ApplicationMgr::executeRun | ( | int | evtmax | ) | [virtual] |
implementation of IEventProcessor::executeRun(int)
Definition at line 837 of file ApplicationMgr.cpp.
00837 { 00838 MsgStream log( m_messageSvc, name() ); 00839 if( m_state == Gaudi::StateMachine::RUNNING ) { 00840 if ( m_processingMgr.isValid() ) { 00841 return m_processingMgr->executeRun(evtmax); 00842 } 00843 log << MSG::WARNING << "No EventLoop Manager specified " << endmsg; 00844 return StatusCode::SUCCESS; 00845 } 00846 log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\"" 00847 << endmsg; 00848 return StatusCode::FAILURE; 00849 }
| StatusCode ApplicationMgr::stopRun | ( | ) | [virtual] |
implementation of IEventProcessor::stopRun()
Definition at line 854 of file ApplicationMgr.cpp.
00854 { 00855 MsgStream log( m_messageSvc, name() ); 00856 if( m_state == Gaudi::StateMachine::RUNNING ) { 00857 if ( m_processingMgr.isValid() ) { 00858 return m_processingMgr->stopRun(); 00859 } 00860 log << MSG::WARNING << "No EventLoop Manager specified " << endmsg; 00861 return StatusCode::SUCCESS; 00862 } 00863 log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\"" 00864 << endmsg; 00865 return StatusCode::FAILURE; 00866 }
| Gaudi::StateMachine::State ApplicationMgr::FSMState | ( | ) | const [virtual] |
| Gaudi::StateMachine::State ApplicationMgr::targetFSMState | ( | ) | const [virtual] |
| StatusCode ApplicationMgr::reinitialize | ( | ) | [virtual] |
Definition at line 885 of file ApplicationMgr.cpp.
00885 { 00886 StatusCode retval = StatusCode::SUCCESS; 00887 StatusCode sc; 00888 if ( m_state < Gaudi::StateMachine::INITIALIZED ) { 00889 throw GaudiException("Cannot reinitialize application if not INITIALIZED or RUNNING", 00890 "ApplicationMgr::reinitialize", StatusCode::FAILURE); 00891 } 00892 if ( m_state == Gaudi::StateMachine::RUNNING ) { 00893 retval = GoToState(Gaudi::StateMachine::INITIALIZED); 00894 } 00895 sc = svcManager()->reinitialize(); 00896 if (sc.isFailure()) retval = sc; 00897 sc = algManager()->reinitialize(); 00898 if (sc.isFailure()) retval = sc; 00899 return retval; 00900 }
| StatusCode ApplicationMgr::restart | ( | ) | [virtual] |
Definition at line 905 of file ApplicationMgr.cpp.
00905 { 00906 StatusCode retval = StatusCode::SUCCESS; 00907 StatusCode sc; 00908 if ( m_state != Gaudi::StateMachine::RUNNING ) { 00909 throw GaudiException("Cannot restart application if not RUNNING", 00910 "ApplicationMgr::restart", StatusCode::FAILURE); 00911 } 00912 sc = svcManager()->restart(); 00913 if (sc.isFailure()) retval = sc; 00914 sc = algManager()->restart(); 00915 if (sc.isFailure()) retval = sc; 00916 return retval; 00917 }
| virtual StatusCode ApplicationMgr::sysInitialize | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysStart | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysStop | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysFinalize | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysReinitialize | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysRestart | ( | ) | [inline, virtual] |
| void ApplicationMgr::SIGoHandler | ( | Property & | theProp | ) |
Definition at line 922 of file ApplicationMgr.cpp.
00922 { 00923 00924 MsgStream log (m_messageSvc, name()); 00925 StatusCode sc; 00926 00927 // Re-initialize everything 00928 sc = reinitialize(); 00929 // Execute a number of events 00930 executeRun(m_evtMax); 00931 00932 return; 00933 }
| void ApplicationMgr::SIExitHandler | ( | Property & | theProp | ) |
Definition at line 938 of file ApplicationMgr.cpp.
00938 { 00939 StatusCode status; 00940 status = finalize(); 00941 status = terminate(); 00942 ::exit( 0 ); 00943 }
| void ApplicationMgr::evtLoopPropertyHandler | ( | Property & | theProp | ) |
Definition at line 948 of file ApplicationMgr.cpp.
00948 { 00949 if ( m_processingMgr.isValid() ) { 00950 SmartIF<IProperty> props(m_processingMgr); 00951 if ( props.isValid() ) { 00952 props->setProperty( p ).ignore(); 00953 } 00954 } 00955 }
| StatusCode ApplicationMgr::decodeExtSvcNameList | ( | ) |
Definition at line 1004 of file ApplicationMgr.cpp.
01004 { 01005 StatusCode result = StatusCode::SUCCESS; 01006 01007 std::vector<std::string> theNames = m_extSvcNameList.value( ); 01008 01009 VectorName::const_iterator it(theNames.begin()); 01010 VectorName::const_iterator et(theNames.end()); 01011 while(result.isSuccess() && it != et) { 01012 Gaudi::Utils::TypeNameString item(*it++); 01013 if (m_extSvcCreates == true) { 01014 if ( (result = svcManager()->addService(item, 10)).isFailure()) { 01015 MsgStream log( m_messageSvc, m_name ); 01016 log << MSG::ERROR << "decodeExtSvcNameList: Cannot create service " 01017 << item.type() << "/" << item.name() << endmsg; 01018 } 01019 } else { 01020 if( ( result = svcManager()->declareSvcType(item.name(), 01021 item.type()) ).isFailure()) { 01022 MsgStream log( m_messageSvc, m_name ); 01023 log << MSG::ERROR << "decodeExtSvcNameList: Cannot declare service " 01024 << item.type() << "/" << item.name() << endmsg; 01025 } 01026 } 01027 } 01028 return result; 01029 }
| StatusCode ApplicationMgr::decodeCreateSvcNameList | ( | ) |
Definition at line 970 of file ApplicationMgr.cpp.
00970 { 00971 StatusCode result = StatusCode::SUCCESS; 00972 const std::vector<std::string>& theNames = m_createSvcNameList.value( ); 00973 VectorName::const_iterator it(theNames.begin()); 00974 VectorName::const_iterator et(theNames.end()); 00975 while(result.isSuccess() && it != et) { 00976 Gaudi::Utils::TypeNameString item(*it++); 00977 if( (result = svcManager()->addService(item, 10) ).isFailure()) { 00978 MsgStream log( m_messageSvc, m_name ); 00979 log << MSG::ERROR << "decodeCreateSvcNameList: Cannot create service " 00980 << item.type() << "/" << item.name() << endmsg; 00981 } else { 00982 MsgStream log( m_messageSvc, m_name ); 00983 log << MSG::DEBUG << "decodeCreateSvcNameList: Created service " 00984 << item.type() << "/" << item.name() << endmsg; 00985 } 00986 } 00987 return result; 00988 }
| void ApplicationMgr::createSvcNameListHandler | ( | Property & | ) |
Definition at line 960 of file ApplicationMgr.cpp.
00960 { 00961 if ( !(decodeCreateSvcNameList()).isSuccess() ) { 00962 throw GaudiException("Failed to create ext services", 00963 "MinimalEventLoopMgr::createSvcNameListHandler", 00964 StatusCode::FAILURE); 00965 } 00966 }
| void ApplicationMgr::extSvcNameListHandler | ( | Property & | theProp | ) |
Definition at line 993 of file ApplicationMgr.cpp.
00993 { 00994 if ( !(decodeExtSvcNameList( )).isSuccess() ) { 00995 throw GaudiException("Failed to declare ext services", 00996 "MinimalEventLoopMgr::extSvcNameListHandler", 00997 StatusCode::FAILURE); 00998 } 00999 }
| StatusCode ApplicationMgr::decodeMultiThreadSvcNameList | ( | ) |
Definition at line 1046 of file ApplicationMgr.cpp.
01046 { 01047 StatusCode result = StatusCode::SUCCESS; 01048 const std::vector<std::string>& theNames = m_multiThreadSvcNameList.value( ); 01049 for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) { 01050 for (VectorName::const_iterator it = theNames.begin(); 01051 it != theNames.end(); 01052 ++it) { 01053 Gaudi::Utils::TypeNameString item(*it); 01054 result = addMultiSvc(item, 10); 01055 //FIXME SHOULD CLONE? 01056 if( result.isFailure() ) { 01057 MsgStream log( m_messageSvc, m_name ); 01058 log << MSG::ERROR 01059 << "decodeMultiThreadSvcNameList: Cannot create service " 01060 << item.type() << "/" << item.name() << endmsg; 01061 } else { 01062 MsgStream log( m_messageSvc, m_name ); 01063 log << MSG::VERBOSE 01064 << "decodeMultiThreadSvcNameList: created service " 01065 << item.type() << "/" << item.name() << endmsg; 01066 } 01067 } 01068 } 01069 return result; 01070 }
| void ApplicationMgr::multiThreadSvcNameListHandler | ( | Property & | theProp | ) |
Definition at line 1034 of file ApplicationMgr.cpp.
01034 { 01035 if ( !(decodeMultiThreadSvcNameList( )).isSuccess() ) { 01036 throw GaudiException("Failed to create copies of mt services", 01037 "MinimalEventLoopMgr::multiThreadSvcNameListHandler", 01038 StatusCode::FAILURE); 01039 } 01040 01041 }
| StatusCode ApplicationMgr::decodeDllNameList | ( | ) |
Definition at line 1151 of file ApplicationMgr.cpp.
01151 { 01152 01153 MsgStream log( m_messageSvc, m_name ); 01154 StatusCode result = StatusCode::SUCCESS; 01155 01156 // Clean up multiple entries from DLL list 01157 // ------------------------------------------------------------------------- 01158 std::vector<std::string> newList; 01159 std::map<std::string,unsigned int> dllInList, duplicateList; 01160 {for ( std::vector<std::string>::const_iterator it = m_dllNameList.value().begin(); 01161 it != m_dllNameList.value().end(); ++it ) { 01162 if ( 0 == dllInList[*it] ) { 01163 newList.push_back(*it); // first instance of this module 01164 } else { ++duplicateList[*it]; } // module listed multiple times 01165 ++dllInList[*it]; // increment count for this module 01166 }} 01167 //m_dllNameList = newList; // update primary list to new, filtered list (do not use the 01168 // property itself otherwise we get called again infinitely) 01169 // List modules that were in there twice.. 01170 if ( !duplicateList.empty() ) { 01171 log << MSG::DEBUG << "Removed duplicate entries for modules : "; 01172 for ( std::map<std::string,unsigned int>::const_iterator it = duplicateList.begin(); 01173 it != duplicateList.end(); ++it ) { 01174 log << it->first << "(" << 1+it->second << ")"; 01175 if ( it != --duplicateList.end() ) log << ", "; 01176 } 01177 log << endmsg; 01178 } 01179 // ------------------------------------------------------------------------- 01180 01181 const std::vector<std::string>& theNames = newList; 01182 01183 // only load the new dlls or previously failed dlls 01184 log << MSG::DEBUG << "Loading declared DLL's" << endmsg; 01185 01186 std::vector<std::string> successNames, failNames; 01187 std::vector<std::string>::const_iterator it; 01188 01189 for (it = theNames.begin(); it != theNames.end(); it++) { 01190 if (std::find (m_okDlls.rbegin(), m_okDlls.rend(), *it) == m_okDlls.rend()){ 01191 // found a new module name 01192 StatusCode status = m_classManager->loadModule( (*it) ); 01193 if( status.isFailure() ) { 01194 failNames.push_back(*it); 01195 result = StatusCode::FAILURE; 01196 } 01197 else { 01198 successNames.push_back(*it); 01199 } 01200 } 01201 } 01202 01203 // report back to the user and store the names of the succesfully loaded dlls 01204 if ( !successNames.empty() ) { 01205 log << MSG::INFO << "Successfully loaded modules : "; 01206 for (it = successNames.begin(); it != successNames.end(); it++) { 01207 log<< (*it); 01208 if( (it+1) != successNames.end()) log << ", "; 01209 // save name 01210 m_okDlls.push_back( *it ); 01211 } 01212 log << endmsg; 01213 } 01214 01215 if ( result == StatusCode::FAILURE ) { 01216 log << MSG::WARNING << "Failed to load modules: "; 01217 for (it = failNames.begin(); it != failNames.end(); it++) { 01218 log<< (*it); 01219 if( (it+1) != failNames.end()) log << ", "; 01220 } 01221 log << endmsg; 01222 } 01223 return result; 01224 }
| void ApplicationMgr::dllNameListHandler | ( | Property & | theProp | ) |
Definition at line 1140 of file ApplicationMgr.cpp.
01140 { 01141 if ( !(decodeDllNameList( )).isSuccess() ) { 01142 throw GaudiException("Failed to load DLLs.", 01143 "MinimalEventLoopMgr::dllNameListHandler", 01144 StatusCode::FAILURE); 01145 } 01146 }
| void ApplicationMgr::reflexDebugPropertyHandler | ( | Property & | theProp | ) |
Definition at line 1229 of file ApplicationMgr.cpp.
01230 { 01231 // Setup debug level for Reflex plugin system 01232 MsgStream log (m_messageSvc, name()); 01233 log << MSG::INFO 01234 << "Updating ROOT::Reflex::PluginService::SetDebug(level) to level=" 01235 << (int)m_reflexDebugLevel 01236 << endmsg; 01237 ROOT::Reflex::PluginService::SetDebug(m_reflexDebugLevel); 01238 }
| void ApplicationMgr::initLoopCheckHndlr | ( | Property & | ) |
Definition at line 1243 of file ApplicationMgr.cpp.
01243 { 01244 svcManager()->setLoopCheckEnabled(m_loopCheck); 01245 }
| SmartIF<IComponentManager>& ApplicationMgr::getManager | ( | ) | [inline] |
Definition at line 137 of file ApplicationMgr.h.
00137 { 00138 return m_managers[I::interfaceID().id()]; 00139 }
| SmartIF<ISvcManager>& ApplicationMgr::svcManager | ( | ) | [inline] |
Definition at line 141 of file ApplicationMgr.h.
00141 { 00142 // Cache the casted pointer to ISvcManager 00143 if (!m_svcManager) { 00144 m_svcManager = getManager<IService>(); 00145 } 00146 return m_svcManager; 00147 }
| SmartIF<IAlgManager>& ApplicationMgr::algManager | ( | ) | [inline] |
Definition at line 149 of file ApplicationMgr.h.
00149 { 00150 // Cache the casted pointer to IAlgManager 00151 if (!m_algManager) { 00152 m_algManager = getManager<IAlgorithm>(); 00153 } 00154 return m_algManager; 00155 }
| virtual SmartIF<ISvcLocator>& ApplicationMgr::serviceLocator | ( | ) | const [inline, virtual] |
Needed to locate the message service.
Implements CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.
Definition at line 158 of file ApplicationMgr.h.
00158 { 00159 return m_svcLocator; 00160 }
| StatusCode ApplicationMgr::declareMultiSvcType | ( | const std::string & | name, | |
| const std::string & | type | |||
| ) | [protected] |
declare one or more copies of svc type/name as determined by NoOfThreads
Definition at line 1074 of file ApplicationMgr.cpp.
01075 { 01076 StatusCode result = StatusCode::SUCCESS; 01077 MsgStream log( m_messageSvc, m_name ); 01078 if (0 == m_noOfEvtThreads) { 01079 result = svcManager()->declareSvcType(name, type); 01080 if( result.isFailure() ) { 01081 log << MSG::ERROR << "declareMultiSvcType: Cannot declare service " 01082 << type << "/" << name << endmsg; 01083 } else { 01084 log << MSG::VERBOSE << "declareMultiSvcType: declared service " 01085 << type << "/" << name << endmsg; 01086 } 01087 } else { 01088 for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) { 01089 std::string thrName(name + getGaudiThreadIDfromID(iCopy)); 01090 result = svcManager()->declareSvcType(thrName, type); 01091 if( result.isFailure() ) { 01092 log << MSG::ERROR << "declareMultiSvcType: Cannot declare service " 01093 << type << "/" << thrName << endmsg; 01094 } else { 01095 log << MSG::VERBOSE << "declareMultiSvcType: declared service " 01096 << type << "/" << thrName << endmsg; 01097 } 01098 } 01099 } 01100 return result; 01101 }
| StatusCode ApplicationMgr::addMultiSvc | ( | const Gaudi::Utils::TypeNameString & | typeName, | |
| int | prio | |||
| ) | [protected] |
add one or more copies of svc type/name as determined by NoOfThreads
Definition at line 1105 of file ApplicationMgr.cpp.
01106 { 01107 using Gaudi::Utils::TypeNameString; 01108 StatusCode result = StatusCode::SUCCESS; 01109 MsgStream log( m_messageSvc, m_name ); 01110 if (0 == m_noOfEvtThreads) { 01111 result = svcManager()->addService(typeName, prio); 01112 // result = svcManager()->addService(name, type, prio); // CHECKME??? 01113 if( result.isFailure() ) { 01114 log << MSG::ERROR << "addMultiSvc: Cannot add service " 01115 << typeName.type() << "/" << typeName.name() << endmsg; 01116 } else { 01117 log << MSG::VERBOSE << "addMultiSvc: added service " 01118 << typeName.type() << "/" << typeName.name() << endmsg; 01119 } 01120 } else { 01121 for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) { 01122 const std::string &type = typeName.type(); 01123 std::string thrName(typeName.name() + getGaudiThreadIDfromID(iCopy)); 01124 result = svcManager()->addService(TypeNameString(thrName, type), prio); 01125 if( result.isFailure() ) { 01126 log << MSG::ERROR << "addMultiSvc: Cannot add service " 01127 << type << "/" << thrName << endmsg; 01128 } else { 01129 log << MSG::VERBOSE << "addMultiSvc: added service " 01130 << type << "/" << thrName << endmsg; 01131 } 01132 } 01133 } 01134 return result; 01135 }
| void ApplicationMgr::setServiceManager | ( | ISvcManager * | ) | [inline, protected] |
| StatusCode ApplicationMgr::i_startup | ( | ) | [protected] |
Internal startup routine.
Definition at line 194 of file ApplicationMgr.cpp.
00194 { 00195 StatusCode sc; 00196 00197 // declare factories in current module 00198 m_classManager->loadModule("").ignore(); 00199 00200 // Create the Message service 00201 SmartIF<IService> msgsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("MessageSvc", m_messageSvcType)); 00202 if( !msgsvc.isValid() ) { 00203 fatal() << "Error creating MessageSvc of type " << m_messageSvcType << endmsg; 00204 return sc; 00205 } 00206 // Create the Job Options service 00207 SmartIF<IService> jobsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("JobOptionsSvc", m_jobOptionsSvcType)); 00208 if( !jobsvc.isValid() ) { 00209 fatal() << "Error creating JobOptionsSvc" << endmsg; 00210 return sc; 00211 } 00212 00213 SmartIF<IProperty> jobOptsIProp(jobsvc); 00214 if ( !jobOptsIProp.isValid() ) { 00215 fatal() << "Error locating JobOptionsSvc" << endmsg; 00216 return sc; 00217 } 00218 sc = jobOptsIProp->setProperty( StringProperty("TYPE", m_jobOptionsType) ); 00219 if( !sc.isSuccess() ) { 00220 fatal() << "Error setting TYPE option in JobOptionsSvc" << endmsg; 00221 return sc; 00222 } 00223 00224 if ( m_jobOptionsPath != "") { // The command line takes precedence 00225 sc = jobOptsIProp->setProperty( StringProperty("PATH", m_jobOptionsPath) ); 00226 if( !sc.isSuccess() ) { 00227 fatal() << "Error setting PATH option in JobOptionsSvc" << endmsg; 00228 return sc; 00229 } 00230 } 00231 else if ( 0 != getenv("JOBOPTPATH") ) {// Otherwise the Environment JOBOPTPATH 00232 sc = jobOptsIProp->setProperty (StringProperty("PATH", 00233 getenv("JOBOPTPATH"))); 00234 if( !sc.isSuccess() ) { 00235 fatal() 00236 << "Error setting PATH option in JobOptionsSvc from env" 00237 << endmsg; 00238 return sc; 00239 } 00240 } 00241 else { // Otherwise the default 00242 sc = jobOptsIProp->setProperty (StringProperty("PATH", 00243 "../options/job.opts")); 00244 if( !sc.isSuccess() ) { 00245 fatal() 00246 << "Error setting PATH option in JobOptionsSvc to default" 00247 << endmsg; 00248 return sc; 00249 } 00250 } 00251 jobOptsIProp->release(); 00252 00253 // Sets my default the Output Level of the Message service to be 00254 // the same as this 00255 SmartIF<IProperty> msgSvcIProp(msgsvc); 00256 msgSvcIProp->setProperty( IntegerProperty("OutputLevel", m_outputLevel)).ignore(); 00257 msgSvcIProp->release(); 00258 00259 sc = jobsvc->sysInitialize(); 00260 if( !sc.isSuccess() ) { 00261 fatal() << "Error initializing JobOptionsSvc" << endmsg; 00262 return sc; 00263 } 00264 sc = msgsvc->sysInitialize(); 00265 if( !sc.isSuccess() ) { 00266 fatal() << "Error initializing MessageSvc" << endmsg; 00267 return sc; 00268 } 00269 00270 // Get the useful interface from Message anf JobOptions services 00271 m_messageSvc = m_svcLocator->service("MessageSvc"); 00272 if( !m_messageSvc.isValid() ) { 00273 fatal() << "Error retrieving MessageSvc." << endmsg; 00274 return sc; 00275 } 00276 m_jobOptionsSvc = m_svcLocator->service("JobOptionsSvc"); 00277 if( !m_jobOptionsSvc.isValid() ) { 00278 fatal() << "Error retrieving JobOptionsSvc." << endmsg; 00279 return sc; 00280 } 00281 00282 return sc; 00283 }
| StatusCode ApplicationMgr::GoToState | ( | Gaudi::StateMachine::State | state, | |
| bool | ignoreFailures = false | |||
| ) | [protected] |
Reach a state from current state (whichever it is) going through the correct transitions.
By default, if a transition fails, the chain is interrupted, but the behavior can be changed with the parameter "gnoreFailures"
Definition at line 725 of file ApplicationMgr.cpp.
00725 { 00726 StatusCode sc = StatusCode(StatusCode::SUCCESS,true); 00727 00728 switch (state) { 00729 00730 case Gaudi::StateMachine::OFFLINE: 00731 switch (m_state) { 00732 case Gaudi::StateMachine::OFFLINE : return StatusCode::SUCCESS; break; 00733 case Gaudi::StateMachine::CONFIGURED : return terminate(); break; 00734 default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING 00735 sc = GoToState(Gaudi::StateMachine::CONFIGURED); 00736 if (sc.isSuccess()) { 00737 return terminate(); 00738 } break; 00739 } break; 00740 00741 case Gaudi::StateMachine::CONFIGURED: 00742 switch (m_state) { 00743 case Gaudi::StateMachine::CONFIGURED : return StatusCode::SUCCESS; break; 00744 case Gaudi::StateMachine::OFFLINE : return configure(); break; 00745 case Gaudi::StateMachine::INITIALIZED : return finalize(); break; 00746 default: // Gaudi::StateMachine::RUNNING 00747 sc = GoToState(Gaudi::StateMachine::INITIALIZED); 00748 if (sc.isSuccess()) { 00749 return finalize(); 00750 } break; 00751 } break; 00752 00753 case Gaudi::StateMachine::INITIALIZED: 00754 switch (m_state) { 00755 case Gaudi::StateMachine::INITIALIZED : return StatusCode::SUCCESS; break; 00756 case Gaudi::StateMachine::CONFIGURED : return initialize(); break; 00757 case Gaudi::StateMachine::RUNNING : return stop(); break; 00758 default: // Gaudi::StateMachine::OFFLINE 00759 sc = GoToState(Gaudi::StateMachine::CONFIGURED); 00760 if (sc.isSuccess()) { 00761 return initialize(); 00762 } break; 00763 } break; 00764 00765 case Gaudi::StateMachine::RUNNING: 00766 switch (m_state) { 00767 case Gaudi::StateMachine::RUNNING : return StatusCode::SUCCESS; break; 00768 case Gaudi::StateMachine::INITIALIZED : return start(); break; 00769 default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED 00770 sc = GoToState(Gaudi::StateMachine::INITIALIZED); 00771 if (sc.isSuccess()) { 00772 return start(); 00773 } break; 00774 } break; 00775 00776 } 00777 00778 // If I get here, there has been a problem in the recursion 00779 00780 if (ignoreFailures){ 00781 // force the new state 00782 m_state = state; 00783 return StatusCode::SUCCESS; 00784 } 00785 00786 return sc; 00787 }
ManagersMap ApplicationMgr::m_managers [protected] |
Map of known component managers.
It contains (at least) the managers for IService and IAlgorithm. IAlgTool and IAuditor are not mandatory (but a missing manager for IAlgTool will probably not allow any job to run).
Definition at line 188 of file ApplicationMgr.h.
SmartIF<ISvcManager> ApplicationMgr::m_svcManager [protected] |
SmartIF<IAlgManager> ApplicationMgr::m_algManager [protected] |
DLLClassManager* ApplicationMgr::m_classManager [protected] |
SmartIF<ISvcLocator> ApplicationMgr::m_svcLocator [mutable, protected] |
IntegerProperty ApplicationMgr::m_SIGo [protected] |
IntegerProperty ApplicationMgr::m_SIExit [protected] |
StringArrayProperty ApplicationMgr::m_topAlgNameList [protected] |
StringProperty ApplicationMgr::m_outStreamType [protected] |
StringProperty ApplicationMgr::m_messageSvcType [protected] |
StringProperty ApplicationMgr::m_jobOptionsSvcType [protected] |
ListSvc ApplicationMgr::m_topSvcList [protected] |
ListName ApplicationMgr::m_topSvcNameList [protected] |
std::string ApplicationMgr::m_name [protected] |
Gaudi::StateMachine::State ApplicationMgr::m_state [protected] |
VectorName ApplicationMgr::m_defServices [protected] |
VectorName ApplicationMgr::m_svcMapping [protected] |
VectorName ApplicationMgr::m_svcOptMapping [protected] |
PropertyMgr* ApplicationMgr::m_propertyMgr [protected] |
SmartIF<IMessageSvc> ApplicationMgr::m_messageSvc [protected] |
SmartIF<IRunable> ApplicationMgr::m_runable [protected] |
SmartIF<IEventProcessor> ApplicationMgr::m_processingMgr [protected] |
SmartIF<IJobOptionsSvc> ApplicationMgr::m_jobOptionsSvc [protected] |
int ApplicationMgr::m_evtMax [protected] |
StringArrayProperty ApplicationMgr::m_extSvcNameList [protected] |
BooleanProperty ApplicationMgr::m_extSvcCreates [protected] |
List of external services names for which we want a copy per evt thread.
Definition at line 238 of file ApplicationMgr.h.
int ApplicationMgr::m_noOfEvtThreads [protected] |
StringArrayProperty ApplicationMgr::m_dllNameList [protected] |
std::string ApplicationMgr::m_jobOptionsType [protected] |
std::string ApplicationMgr::m_jobOptionsPath [protected] |
std::string ApplicationMgr::m_runableType [protected] |
std::string ApplicationMgr::m_eventLoopMgr [protected] |
std::string ApplicationMgr::m_evtsel [protected] |
std::string ApplicationMgr::m_histPersName [protected] |
int ApplicationMgr::m_outputLevel [protected] |
std::string ApplicationMgr::m_appName [protected] |
std::string ApplicationMgr::m_appVersion [protected] |
bool ApplicationMgr::m_actHistory [protected] |
bool ApplicationMgr::m_codeCheck [protected] |
IntegerProperty ApplicationMgr::m_reflexDebugLevel [protected] |
Definition at line 255 of file ApplicationMgr.h.
BooleanProperty ApplicationMgr::m_auditTools [protected] |
BooleanProperty ApplicationMgr::m_auditSvcs [protected] |
Definition at line 259 of file ApplicationMgr.h.
BooleanProperty ApplicationMgr::m_auditAlgs [protected] |
Definition at line 260 of file ApplicationMgr.h.
std::map<std::string,std::string> ApplicationMgr::m_environment [protected] |
BooleanProperty ApplicationMgr::m_loopCheck [protected] |
bool ApplicationMgr::m_propertiesPrint [protected] |
std::vector<std::string> ApplicationMgr::m_okDlls [private] |