18 #define DATASVC_RECORDDATASVC_CPP
46 m_cnvSvc = service(m_persSvcName,
true);
48 error() <<
"Failed to access RecordPersistencySvc." <<
endmsg;
55 sc = setDataLoader( m_cnvSvc.get() );
57 error() <<
"Failed to attach dataloader RecordPersistencySvc." <<
endmsg;
63 warning() <<
"Error declaring Record root DataObject" <<
endmsg;
67 if( !m_incidentSvc ) {
68 fatal() <<
"IncidentSvc is invalid--base class failed." <<
endmsg;
76 m_incidentSvc->addListener(
this,
"FILE_OPEN_READ");
77 m_incidentSvc->addListener(
this,m_saveIncidentName);
83 if( m_incidentSvc ) m_incidentSvc->removeListener(
this);
91 if ( incident.
type() ==
"FILE_OPEN_READ" ) {
93 auto inc =
dynamic_cast<const Ctxt*
>(&incident);
95 always() <<
"Received invalid incident of type:" << incident.
type() <<
endmsg;
97 registerRecord(inc->source(),inc->tag());
98 if ( !m_incidentName.empty() ) {
99 auto incidents = m_incidents;
101 for(
const auto&
i : incidents)
102 m_incidentSvc->fireIncident(
Incident{
i,m_incidentName});
105 }
else if ( incident.
type() == m_saveIncidentName ) {
106 always() <<
"Saving records not implemented." <<
endmsg;
113 error() <<
"Failed to load records object: " << pObj->
identifier() <<
endmsg;
120 debug() <<
"Loaded records object: " << id0 <<
endmsg;
121 sc = objectLeaves(pObj, leaves);
123 for (
const auto&
i : leaves) loadRecords(
i);
131 if ( !data.
empty() && pAddr ) {
133 debug() <<
"Request to load record for file " << fid <<
endmsg;
136 warning() <<
"Failed to register record for:" << fid <<
endmsg;
145 else if ( !data.
empty() && !pAddr ) {
146 info() <<
"Failed to register record for:" << data <<
" [Invalid Address]" <<
endmsg;
StatusCode finalize() override
Service finalization.
std::string m_persSvcName
Property: name of the persistency service.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
const std::string & type() const
Access to the incident type.
std::string m_incidentName
Property: name of incident to be fired if new record arrives.
bool isSuccess() const
Test for a status code of SUCCESS.
bool m_autoLoad
Property: autoload of records (default: true)
std::string m_rootName
Name of root event.
virtual unsigned long release()=0
release reference to object
A RecordDataSvc is the base class for event services.
#define DECLARE_COMPONENT(type)
std::string m_saveIncidentName
Property: name of the "save" incident.
virtual IRegistry * registry() const =0
Update branch name.
This class is used for returning status codes from appropriate routines.
void clear(STATE_TYPE _i=std::ios_base::failbit)
The IRegistry represents the entry door to the environment any data object residing in a transient da...
StatusCode finalize() override
Service initialization.
StatusCode initialize() override
Service initialization.
Base class for all Incidents (computing events).
RecordDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
virtual const id_type & identifier() const =0
Full identifier (or key)
void handle(const Incident &incident) override
IIncidentListener override: Inform that a new incident has occured.
void registerRecord(const std::string &data, IOpaqueAddress *pAddr)
Load new record into the data store if necessary.
Opaque address interface definition.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
The IProperty is the basic interface for all components which have properties that can be set or get...
A DataObject is the base class of any identifiable object on any data store.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
void loadRecords(IRegistry *pReg)
Load dependent records into memory.