![]() |
|
|
Generated: 8 Jan 2009 |
#include <RunRecordDataSvc.h>


When a new datafile is opened the data service retrieves an incident from the persistency area (currently only from POOL) together with an opaque address describing the run record. These history records are put onto the run-records datastore under the name of the logical file (FID): /RunRecords/<FID>/.....
The data service by default has two top level leafs: /RunRecords/SOR (start-of-run-record) and /RunRecords/EOR (end-of-run-record)
Hence, each history records can be addresses the same way: /RunRecord/<FID>/SOR (/EOR)
Definition at line 30 of file RunRecordDataSvc.h.
Public Member Functions | |
| virtual StatusCode | initialize () |
| Service initialisation. | |
| virtual StatusCode | reinitialize () |
| Service reinitialisation. | |
| virtual StatusCode | finalize () |
| Service finalization. | |
| virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
| IInterface override: Query interfaces of Interface. | |
| virtual void | handle (const Incident &incident) |
| IIncidentListener override: Inform that a new incident has occured. | |
| RunRecordDataSvc (const std::string &name, ISvcLocator *svc) | |
| Standard Constructor. | |
| virtual | ~RunRecordDataSvc () |
| Standard Destructor. | |
Protected Types | |
| typedef std::vector< std::string > | StringV |
Protected Member Functions | |
| void | registerRunRecord (const std::string &data, IOpaqueAddress *pAddr) |
| Load new run record into the data store if necessary. | |
Private Attributes | |
| IConversionSvc * | m_cnvSvc |
| Reference to the main data conversion service. | |
Friends | |
| class | SvcFactory< RunRecordDataSvc > |
typedef std::vector<std::string> RunRecordDataSvc::StringV [protected] |
Definition at line 33 of file RunRecordDataSvc.h.
| RunRecordDataSvc::RunRecordDataSvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Standard Constructor.
Definition at line 150 of file RunRecordDataSvc.cpp.
00151 : DataSvc(name,svc) { 00152 m_cnvSvc = 0; 00153 m_rootName = "/RunRecords"; 00154 }
| RunRecordDataSvc::~RunRecordDataSvc | ( | ) | [virtual] |
| StatusCode RunRecordDataSvc::initialize | ( | ) | [virtual] |
Service initialisation.
We need to subscribe to 2 incident: 1) FILE_OPEN_READ: fired by conversion service on open file 2) IncidentType::BeginEvent fired by event loop BEFORE the event processing starts. Do everything to bootstract access to the old event record.
Reimplemented from DataSvc.
Definition at line 39 of file RunRecordDataSvc.cpp.
00039 { 00040 // Nothing to do: just call base class initialisation 00041 StatusCode sc = DataSvc::initialize(); 00042 ISvcLocator* svc_loc = serviceLocator(); 00043 MsgStream log(msgSvc(),name()); 00044 00045 if ( !sc.isSuccess() ) { // Base class failure 00046 return sc; 00047 } 00048 // Attach data loader facility 00049 sc = svc_loc->service("PersistencySvc/RunRecordPersistencySvc", m_cnvSvc, true); 00050 if ( !sc.isSuccess() ) { 00051 log << MSG::ERROR << "Failed to access RunRecordPersistencySvc." << endmsg; 00052 return sc; 00053 } 00054 SmartIF<IProperty> prp(m_cnvSvc); 00055 if ( prp ) { 00056 //prp->setProperty(); 00057 } 00058 sc = setDataLoader( m_cnvSvc ); 00059 if ( !sc.isSuccess() ) { 00060 log << MSG::ERROR << "Failed to attach dataloader RunRecordPersistencySvc." << endmsg; 00061 return sc; 00062 } 00063 00064 sc = setRoot(m_rootName, new DataObject()); 00065 if( !sc.isSuccess() ) { 00066 log << MSG::WARNING << "Error declaring RunRecord root DataObject" << endreq; 00067 return sc; 00068 } 00069 00070 if( !m_incidentSvc ) { 00071 log << MSG::FATAL << "IncidentSvc is invalid--base class failed." << endreq; 00072 return sc; 00073 } 00074 00079 m_incidentSvc->addListener(this,IncidentType::BeginEvent); 00080 m_incidentSvc->addListener(this,"FILE_OPEN_READ"); 00081 m_incidentSvc->addListener(this,"SAVE_RUN_RECORD"); 00082 00083 return sc; 00084 }
| StatusCode RunRecordDataSvc::reinitialize | ( | ) | [virtual] |
Service reinitialisation.
Reimplemented from DataSvc.
Definition at line 87 of file RunRecordDataSvc.cpp.
00087 { 00088 // Do nothing for this service 00089 return StatusCode::SUCCESS; 00090 }
| StatusCode RunRecordDataSvc::finalize | ( | void | ) | [virtual] |
Service finalization.
Reimplemented from DataSvc.
Definition at line 93 of file RunRecordDataSvc.cpp.
00093 { 00094 if( m_cnvSvc ) m_cnvSvc->release(); 00095 m_cnvSvc = 0; 00096 DataSvc::finalize().ignore(); 00097 return StatusCode::SUCCESS ; 00098 }
| StatusCode RunRecordDataSvc::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvInterface | |||
| ) | [virtual] |
IInterface override: Query interfaces of Interface.
Query interfaces of Interface.
| riid | ID of Interface to be retrieved | |
| ppvInterface | Pointer to Location for interface pointer |
Reimplemented from DataSvc.
Definition at line 101 of file RunRecordDataSvc.cpp.
00101 { 00102 if ( 0 == ppvIf ) 00103 return StatusCode::FAILURE; 00104 else if ( IIncidentListener::interfaceID().versionMatch(riid) ) 00105 *ppvIf = static_cast<IIncidentListener*>( this ); 00106 else 00107 return DataSvc::queryInterface(riid,ppvIf); 00108 // increment reference counter 00109 addRef(); 00110 return SUCCESS; 00111 }
| void RunRecordDataSvc::handle | ( | const Incident & | incident | ) | [virtual] |
IIncidentListener override: Inform that a new incident has occured.
Inform that a new incident has occured.
Implements IIncidentListener.
Definition at line 114 of file RunRecordDataSvc.cpp.
00114 { 00115 if ( incident.type() == "FILE_OPEN_READ" ) { 00116 typedef ContextIncident<IOpaqueAddress*> Ctxt; 00117 const Ctxt* inc = dynamic_cast<const Ctxt*>(&incident); 00118 if ( inc ) { 00119 registerRunRecord(inc->source(),inc->tag()); 00120 return; 00121 } 00122 MsgStream log(msgSvc(),name()); 00123 log << MSG::ALWAYS << "Received invalid incident of type:" << incident.type() << endmsg; 00124 } 00125 else if ( incident.type() == "SAVE_RUN_RECORD" ) { 00126 MsgStream log(msgSvc(),name()); 00127 log << MSG::ALWAYS << "Saving run records not implemented." << endmsg; 00128 } 00129 }
| void RunRecordDataSvc::registerRunRecord | ( | const std::string & | data, | |
| IOpaqueAddress * | pAddr | |||
| ) | [protected] |
Load new run record into the data store if necessary.
Definition at line 132 of file RunRecordDataSvc.cpp.
00132 { 00133 if ( !data.empty() && 0 != pAddr ) { 00134 MsgStream log(msgSvc(),name()); 00135 std::string fid = data; 00136 log << MSG::ALWAYS << "Request to load run record for file " << fid << endmsg; 00137 StatusCode sc = registerAddress(m_root,fid,pAddr); 00138 if ( !sc.isSuccess() ) { 00139 log << MSG::ERROR << "Failed to register run record for:" << fid << endmsg; 00140 pAddr->release(); 00141 } 00142 } 00143 else if ( !data.empty() && 0 == pAddr ) { 00144 MsgStream log(msgSvc(),name()); 00145 log << MSG::ERROR << "Failed to register run record for:" << data << " [Invalid Address]" << endmsg; 00146 } 00147 }
friend class SvcFactory< RunRecordDataSvc > [friend] |
Definition at line 31 of file RunRecordDataSvc.h.
IConversionSvc* RunRecordDataSvc::m_cnvSvc [private] |