| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

PersistencySvc.cpp
Go to the documentation of this file.
1 //====================================================================
2 // PersistencySvc.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : System ( The LHCb Offline System)
6 //
7 // Description: implementation of the PersistencySvc
8 //
9 // Author : M.Frank
10 // History :
11 // +---------+----------------------------------------------+---------
12 // | Date | Comment | Who
13 // +---------+----------------------------------------------+---------
14 // | 29/10/98| Initial version | MF
15 // +---------+----------------------------------------------+---------
16 //
17 //====================================================================
18 #define PERSISTENCYSVC_PERSISTENCYSVC_CPP
19
20 // Interface definitions
21 #include "GaudiKernel/SmartIF.h"
22 #include "GaudiKernel/DataObject.h"
23 #include "GaudiKernel/IConverter.h"
24 #include "GaudiKernel/ISvcLocator.h"
25 #include "GaudiKernel/IDataSelector.h"
26 #include "GaudiKernel/IOpaqueAddress.h"
27 #include "GaudiKernel/MsgStream.h"
28 #include "GaudiKernel/strcasecmp.h"
29 #include "GaudiKernel/TypeNameString.h"
30 #include "GaudiKernel/IDataProviderSvc.h"
31
32 // Implementation specific definitions
33 #include "PersistencySvc.h"
34
35 #define ON_DEBUG if (msgLevel(MSG::DEBUG))
36 #define ON_VERBOSE if (msgLvel(MSG::VERBOSE))
37
38 #define DEBMSG ON_DEBUG debug()
39 #define VERMSG ON_VERBOSE verbose()
40
41 // Instantiation of a static factory class used by clients to create
42 // instances of this service
43 DECLARE_COMPONENT(PersistencySvc)
44
45 enum CnvSvcAction {
46 CREATE_OBJ,
47 FILL_OBJ_REFS,
48 UPDATE_OBJ,
49 UPDATE_OBJ_REFS,
50 CREATE_REP,
51 FILL_REP_REFS,
52 UPDATE_REP,
53 UPDATE_REP_REFS
54 };
55
56 StatusCode PersistencySvc::makeCall(int typ,
57 IOpaqueAddress*& pAddress,
58 DataObject*& pObject) {
59 if ( m_enable ) {
60 IConversionSvc* svc = nullptr;
61 switch(typ) {
62 case CREATE_REP:
63 case FILL_REP_REFS:
64 case UPDATE_REP:
65 case UPDATE_REP_REFS:
66 svc = m_cnvDefault;
67 break;
68 default:
69 if ( !pAddress ) return INVALID_ADDRESS;
70 svc = service(pAddress->svcType());
71 if ( !svc ) return BAD_STORAGE_TYPE;
72 break;
73 }
74
75 StatusCode status(StatusCode::FAILURE,true);
76 switch( typ ) {
77 case CREATE_OBJ:
78 pObject = nullptr;
79 status = svc->createObj(pAddress, pObject);
80 break;
81 case FILL_OBJ_REFS:
82 status = svc->fillObjRefs(pAddress, pObject);
83 break;
84 case UPDATE_OBJ:
85 status = svc->updateObj(pAddress, pObject);
86 break;
87 case UPDATE_OBJ_REFS:
88 status = svc->updateObjRefs(pAddress, pObject);
89 break;
90 case CREATE_REP:
91 status = svc->createRep(pObject, pAddress);
92 break;
93 case FILL_REP_REFS:
94 status = svc->fillRepRefs(pAddress, pObject);
95 break;
96 case UPDATE_REP:
97 status = svc->updateRep(pAddress, pObject);
98 break;
99 case UPDATE_REP_REFS:
100 status = svc->updateRepRefs(pAddress, pObject);
101 break;
102 default:
103 status = StatusCode::FAILURE;
104 break;
105 }
106 status.ignore();
107 return status;
108 }
109 return StatusCode::SUCCESS;
110 }
111
113 StatusCode PersistencySvc::createObj(IOpaqueAddress* pAddr, DataObject*& refpObj) {
114 return makeCall(CREATE_OBJ, pAddr, refpObj);
115 }
116
118 StatusCode PersistencySvc::fillObjRefs(IOpaqueAddress* pAddr, DataObject* pObj) {
119 return makeCall(FILL_OBJ_REFS, pAddr, pObj);
120 }
121
123 StatusCode PersistencySvc::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
124 return makeCall(UPDATE_OBJ, pAddr, pObj);
125 }
126
128 StatusCode PersistencySvc::updateObjRefs(IOpaqueAddress* pAddr, DataObject* pObj) {
129 return makeCall(UPDATE_OBJ_REFS, pAddr, pObj);
130 }
131
133 StatusCode PersistencySvc::createRep(DataObject* pObj, IOpaqueAddress*& refpAddr) {
134 return makeCall(CREATE_REP, refpAddr, pObj);
135 }
136
138 StatusCode PersistencySvc::fillRepRefs(IOpaqueAddress* pAddr, DataObject* pObj) {
139 return makeCall(FILL_REP_REFS, pAddr, pObj);
140 }
141
143 StatusCode PersistencySvc::updateRep(IOpaqueAddress* pAddr, DataObject* pObj) {
144 return makeCall(UPDATE_REP, pAddr, pObj);
145 }
146
148 StatusCode PersistencySvc::updateRepRefs(IOpaqueAddress* pAddr, DataObject* pObj) {
149 return makeCall(UPDATE_REP_REFS, pAddr, pObj);
150 }
151
153 SmartIF<IAddressCreator>& PersistencySvc::addressCreator(long type) {
154 long typ = type;
155 auto it = m_cnvServices.find( typ );
156 if( it == m_cnvServices.end() ) {
157 IConversionSvc* s = service(type);
158 if ( s ) {
159 it = m_cnvServices.find( typ );
160 if ( it != m_cnvServices.end() ) return it->second.addrCreator();
161 }
162 static SmartIF<IAddressCreator> no_creator;
163 return no_creator;
164 }
165 return it->second.addrCreator();
166 }
167
169 StatusCode PersistencySvc::setDataProvider(IDataProviderSvc* pDataSvc) {
170 m_dataSvc = pDataSvc;
171 for (auto& i : m_cnvServices) {
172 i.second.conversionSvc()->setDataProvider(m_dataSvc).ignore();
173 }
174 return StatusCode(StatusCode::SUCCESS,true);
175 }
176
178 SmartIF<IDataProviderSvc>& PersistencySvc::dataProvider() const {
179 return m_dataSvc;
180 }
181
183 StatusCode PersistencySvc::setConversionSvc(IConversionSvc* svc) {
184 m_cnvDefault = svc;
185 return StatusCode(StatusCode::SUCCESS,true);
186 }
187
189 SmartIF<IConversionSvc>& PersistencySvc::conversionSvc() const {
190 return m_cnvDefault;
191 }
192
194 StatusCode PersistencySvc::addConverter(const CLID& /* clid */) {
195 return StatusCode::FAILURE;
196 }
197
199 StatusCode PersistencySvc::addConverter(IConverter* pConverter) {
200 if ( !pConverter ) return NO_CONVERTER;
201 IConversionSvc* svc = service(pConverter->repSvcType());
202 return svc ? svc->addConverter(pConverter) : BAD_STORAGE_TYPE;
203 }
204
206 StatusCode PersistencySvc::removeConverter(const CLID& clid) {
207 // Remove converter type from all services
208 StatusCode status = NO_CONVERTER, iret = StatusCode::SUCCESS;
209 for ( auto& i : m_cnvServices ) {
210 iret = i.second.conversionSvc()->removeConverter(clid);
211 if ( iret.isSuccess() ) status = iret;
212 }
213 return status;
214 }
215
217 IConverter* PersistencySvc::converter(const CLID& /*clid*/) {
218 return nullptr;
219 }
220
222 SmartIF<IConversionSvc>& PersistencySvc::service(const std::string& nam) {
223 Gaudi::Utils::TypeNameString tn(nam);
224 auto it = std::find_if( m_cnvServices.begin(), m_cnvServices.end(),
225 [&](Services::const_reference i) {
226 return i.second.service()->name() == tn.name();
227 } );
228 if (it!=m_cnvServices.end()) return it->second.conversionSvc();
229
230 auto svc = Service::service<IConversionSvc>(nam, true);
231 if ( svc && addCnvService(svc.get()).isSuccess() ) {
232 return service(nam); // now it is in the list
233 }
234
235 info() << "Cannot access Conversion service:" << nam << endmsg;
236 static SmartIF<IConversionSvc> no_svc;
237 return no_svc;
238 }
239
241 SmartIF<IConversionSvc>& PersistencySvc::service(long type) {
242 // Check wether this is already an active service
243 auto it = m_cnvServices.find( type );
244 if( it != m_cnvServices.end() ) return it->second.conversionSvc();
245 // if not, check if the service is in the list and may be requested
246 for ( const auto& i : m_svcNames.value() ) {
247 auto& svc = service(i);
248 if ( svc && svc->repSvcType() == type ) return svc;
249 }
250 static SmartIF<IConversionSvc> no_svc;
251 return no_svc;
252 }
253
255 StatusCode PersistencySvc::addCnvService(IConversionSvc* servc) {
256 if ( !servc ) return BAD_STORAGE_TYPE;
257 long type = servc->repSvcType();
258 long def_typ = ( m_cnvDefault ? m_cnvDefault->repSvcType() : 0 );
259 auto it = m_cnvServices.find( type );
260 auto cnv_svc = ( it != m_cnvServices.end() ? it->second.conversionSvc() : nullptr );
261 if ( type == def_typ ) m_cnvDefault = servc;
262 if ( cnv_svc == servc ) return StatusCode::SUCCESS;
263
264 auto iservc = make_SmartIF( servc );
265 auto icr = iservc.as<IAddressCreator>();
266 if ( icr ) {
267 auto isvc = iservc.as<IService>();
268 if ( isvc ) {
269 if ( cnv_svc ) removeCnvService (type).ignore();
270 auto p = m_cnvServices.emplace( type, ServiceEntry(type, isvc, iservc, icr) );
271 if( !p.second ) {
272 info() << "Cannot add Conversion service of type " << isvc->name() << endmsg;
273 return StatusCode::FAILURE;
274 }
275 info() << "Added successfully Conversion service:" << isvc->name() << endmsg;
276 iservc->setAddressCreator(this).ignore();
277 iservc->setDataProvider(m_dataSvc).ignore();
278 return StatusCode::SUCCESS;
279 }
280 }
281 info() << "Cannot add Conversion service of type " << type << endmsg;
282 return StatusCode::FAILURE;
283 }
284
286 StatusCode PersistencySvc::removeCnvService(long svctype) {
287 auto it = m_cnvServices.find( svctype );
288 if( it == m_cnvServices.end() ) return BAD_STORAGE_TYPE;
289 it->second.service()->release();
290 it->second.addrCreator()->release();
291 m_cnvServices.erase(it);
292 return StatusCode::SUCCESS;
293 }
294
296 long PersistencySvc::repSvcType() const {
297 return m_cnvDefault ? m_cnvDefault->repSvcType() : 0;
298 }
299
301 StatusCode PersistencySvc::setDefaultCnvService(long type) {
302 m_cnvDefault = service(type);
303 return StatusCode::SUCCESS;
304 }
305
307 StatusCode PersistencySvc::connectOutput(const std::string& outputFile,
308 const std::string& /* openMode */) {
309 return connectOutput(outputFile);
310 }
311
313 StatusCode PersistencySvc::connectOutput(const std::string&) {
314 return StatusCode::SUCCESS;
315 }
316
318 StatusCode PersistencySvc::commitOutput(const std::string& , bool ) {
319 return StatusCode::SUCCESS;
320 }
321
323 StatusCode PersistencySvc::createAddress(long svc_type,
324 const CLID& clid,
325 const std::string* pars,
326 const unsigned long* ipars,
327 IOpaqueAddress*& refpAddress) {
328 refpAddress = nullptr;
329 IAddressCreator* svc = addressCreator(svc_type);
330 return svc ? svc->createAddress(svc_type, clid, pars, ipars, refpAddress)
331 : BAD_STORAGE_TYPE;
332 }
333
335 StatusCode PersistencySvc::convertAddress( const IOpaqueAddress* pAddress,
336 std::string& refAddress)
337 {
338 // Assumuption is that the Persistency service prepends a header
339 // and requests the conversion service refered to by the service
340 // type to encode the rest
341 long svc_type = 0;
342 CLID clid = 0;
343 if ( pAddress ) {
344 svc_type = pAddress->svcType();
345 clid = pAddress->clID();
346 }
347 IAddressCreator* svc = addressCreator(svc_type);
348 StatusCode status = BAD_STORAGE_TYPE; // Preset error
349 refAddress.clear();
350
351 if ( svc ) {
352 // Found service, set header
353 encodeAddrHdr(svc_type, clid, refAddress);
354 std::string address;
355 // Get rest of address from conversion service
356 status = svc->convertAddress(pAddress, address);
357 refAddress += address;
358 }
359 return status;
360 }
361
363 StatusCode PersistencySvc::createAddress( long /* svc_type */,
364 const CLID& /* clid */,
365 const std::string& refAddress,
366 IOpaqueAddress*& refpAddress)
367 {
368 // Assumption is that the Persistency service decodes that header
369 // and requests the conversion service referred to by the service
370 // type to decode the rest
371 long new_svc_type = 0;
372 CLID new_clid = 0;
373 std::string address_trailer;
374 decodeAddrHdr(refAddress, new_svc_type, new_clid, address_trailer);
375 IAddressCreator* svc = addressCreator(new_svc_type);
376 return svc ? svc->createAddress( new_svc_type, new_clid, address_trailer, refpAddress)
377 : BAD_STORAGE_TYPE;
378 }
379
381 void PersistencySvc::encodeAddrHdr( long service_type,
382 const CLID& clid,
383 std::string& address) const
384 {
385 // For address header, use xml-style format of
386 // <addrhdr service_type="xxx" clid="yyy" />
387 std::stringstream stream;
388 int svctyp = service_type; // must put int into stream, not char
389 stream << "<address_header service_type=\"" << svctyp << "\" clid=\"" << clid << "\" /> ";
390 address = stream.str();
391 }
392
394 void PersistencySvc::decodeAddrHdr( const std::string& address,
395 long& service_type,
396 CLID& clid,
397 std::string& address_trailer) const
398 {
399 // For address header, use xml-style format of
400 // <address_header service_type="xxx" clid="yyy" />
401 service_type = 0;
402 clid = 0;
403 address_trailer.clear();
404
405 // Check for address_header tag
406 size_t pos = address.find("<address_header");
407 if (std::string::npos != pos) {
408 // Get service_type
409 pos = address.find("service_type=\"");
410 if (std::string::npos != pos) {
411 pos += 14;
412 size_t end = address.find('"', pos);
413 if (std::string::npos != end) {
414 service_type = std::stol(address.substr(pos, end-pos));
415 // Get clid
416 pos = address.find("clid=\"");
417 if (std::string::npos != pos) {
418 pos += 6;
419 end = address.find('\"', pos);
420 if (std::string::npos != end) {
421 std::istringstream str;
422 str.str(address.substr(pos, end-pos));
423 str >> clid;
424 // Get trailer_address
425 pos = address.find('>');
426 if (pos < (address.size()-2)) { // this means that '>' was found (pos != npos)
427 // it is before the last char
428 address_trailer = address.substr(pos+1);
429 }
430 }
431 }
432 }
433 }
434 }
435 }
436
438 StatusCode PersistencySvc::setAddressCreator(IAddressCreator*) {
439 // The persistency service is a address creation dispatcher istelf.
440 // The persistency service can NEVER create addresses itself.
441 // The entry point must only be provided in order to fulfill the needs of the
442 // implementing interfaces.
443 return StatusCode::FAILURE;
444 }
445
447 SmartIF<IAddressCreator>& PersistencySvc::addressCreator() const {
448 return m_addrCreator;
449 }
450
452 StatusCode PersistencySvc::getService(long service_type, IConversionSvc*& refpSvc) {
453 refpSvc = service(service_type);
454 return refpSvc ? StatusCode::SUCCESS : StatusCode::FAILURE;
455 }
456
458 StatusCode PersistencySvc::getService(const std::string& service_type, IConversionSvc*& refpSvc) {
459 const char* imp = service_type.c_str();
460 long len = service_type.length();
461 if ( ::strncasecmp(imp,"SICB", len) == 0 )
462 return getService(SICB_StorageType, refpSvc);
463 else if ( ::strncasecmp(imp,"ZEBRA", len) == 0 )
464 return getService(SICB_StorageType, refpSvc);
465 else if ( ::strncasecmp(imp,"MS Access", len) == 0 )
466 return getService(ACCESS_StorageType, refpSvc);
467 else if ( ::strncasecmp(imp,"Microsoft Access", strlen("Microsoft Access")) == 0 )
468 return getService(ACCESS_StorageType, refpSvc);
469 else if ( ::strncasecmp(imp,"SQL Server", len) == 0 )
470 return getService(SQLSERVER_StorageType, refpSvc);
471 else if ( ::strncasecmp(imp,"Microsoft ODBC for Oracle", len) == 0 )
472 return getService(ORACLE_StorageType, refpSvc);
473 else if ( ::strncasecmp(imp,"Oracle ODBC", strlen("Oracle ODBC")) == 0 )
474 return getService(ORACLE_StorageType, refpSvc);
475 else if ( ::strncasecmp(imp,"Oracle OCI", strlen("Oracle OCI")) == 0 )
476 return getService(ORACLE_StorageType, refpSvc);
477 else if ( ::strncasecmp(imp,"MySQL", len) == 0 )
478 return getService(MYSQL_StorageType, refpSvc);
479 else if ( ::strncasecmp(imp,"ROOT", len) == 0 )
480 return getService(ROOT_StorageType, refpSvc);
481 else if ( ::strncasecmp(imp,"OBJY", len) == 0 )
482 return getService(OBJY_StorageType, refpSvc);
483 else if ( ::strncasecmp(imp,"OBJYECTI", 7) == 0 )
484 return getService(OBJY_StorageType, refpSvc);
485 else if ( ::strncasecmp(imp,"POOL_ROOTKEY", 12) == 0 )
486 return getService(POOL_ROOTKEY_StorageType, refpSvc);
487 else if ( ::strncasecmp(imp,"POOL_ROOTTREE", 12) == 0 )
488 return getService(POOL_ROOTTREE_StorageType, refpSvc);
489 else if ( ::strncasecmp(imp,"POOL_ROOT", 9) == 0 )
490 return getService(POOL_ROOT_StorageType, refpSvc);
491 else if ( ::strncasecmp(imp,"POOL_MySQL", 8) == 0 )
492 return getService(POOL_MYSQL_StorageType, refpSvc);
493 else if ( ::strncasecmp(imp,"POOL_ORACLE", 8) == 0 )
494 return getService(POOL_ORACLE_StorageType, refpSvc);
495 else if ( ::strncasecmp(imp,"POOL_ACCESS", 8) == 0 )
496 return getService(POOL_ACCESS_StorageType, refpSvc);
497 else if ( ::strncasecmp(imp,"POOL", 4) == 0 )
498 return getService(POOL_StorageType, refpSvc);
499
500 for(const auto& i : m_cnvServices) {
501 SmartIF<IService> svc(i.second.conversionSvc());
502 if ( svc ) {
503 // Check wether this is already an active service: first check by service name
504 if ( svc->name() == service_type ) {
505 refpSvc = i.second.conversionSvc();
506 return StatusCode::SUCCESS;
507 }
508 // Check wether this is already an active service: now check by service type
509 auto instance = svc.get();
510 if ( System::typeinfoName(typeid(*instance)) == service_type ) {
511 refpSvc = i.second.conversionSvc();
512 return StatusCode::SUCCESS;
513 }
514 }
515 }
516 // if not, check if the service is in the list and may be requested
517 for(const auto& i : m_svcNames.value() ) {
518 Gaudi::Utils::TypeNameString itm(i);
519 if ( itm.name() == service_type || itm.type() == service_type ) {
520 IConversionSvc* svc = service(i);
521 if ( svc ) {
522 refpSvc = svc;
523 return StatusCode::SUCCESS;
524 }
525 }
526 }
527 return StatusCode::FAILURE;
528 }
529
531 const CLID& PersistencySvc::objType() const {
532 return CLID_NULL;
533 }
534
536 StatusCode PersistencySvc::initialize() {
537 m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
538 // Initialize basic service
539 StatusCode status = Service::initialize();
540 if ( UNLIKELY(!status.isSuccess()) ) {
541 error() << "Error initializing Service base class." << endmsg;
542 }
543 return status;
544 }
545
547 StatusCode PersistencySvc::finalize() {
548 // Release all workers
549 m_cnvServices.clear();
550 // Release references to this to avoid loops
551 m_addrCreator = nullptr;
552 return StatusCode::SUCCESS;
553 }
554
555 void PersistencySvc::svcNamesHandler( Property& p ) {
556 DEBMSG << p << endmsg;
557 }
558
560 bool PersistencySvc::enable(bool value)
561 {
562 std::swap(value,m_enable);
563 return value;
564 }
565
567 PersistencySvc::PersistencySvc(const std::string& name, ISvcLocator* svc)
568 : base_class(name, svc)
569 {
570 declareProperty("CnvServices", m_svcNames);
571 m_svcNames.declareUpdateHandler( &PersistencySvc::svcNamesHandler, this );
572 }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:282
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:447
IDataSelector.h
CREATE_OBJ
Definition: PersistencySvc.cpp:46
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
UPDATE_OBJ_REFS
Definition: PersistencySvc.cpp:49
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:222
PersistencySvc::ServiceEntry::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const
Definition: PersistencySvc.h:85
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
SmartIF< IAddressCreator >
PersistencySvc::ServiceEntry::addrCreator
SmartIF< IAddressCreator > & addrCreator() const
Definition: PersistencySvc.h:88
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
std::istringstream
STL class.
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:57
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
DEBMSG
#define DEBMSG
Definition: PersistencySvc.cpp:38
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
PersistencySvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: PersistencySvc.cpp:536
IConversionSvc
Definition: IConversionSvc.h:37
MsgStream.h
ana.itm
tuple itm
Definition: ana.py:57
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
PersistencySvc::connectOutput
StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.
Definition: PersistencySvc.cpp:307
Property::declareUpdateHandler
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
IAddressCreator::createAddress
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
PersistencySvc::ServiceEntry
Definition: PersistencySvc.h:56
std::swap
T swap(T...args)
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
ACCESS_StorageType
const long ACCESS_StorageType
Definition: ClassID.h:60
PersistencySvc::ServiceEntry::service
SmartIF< IService > & service() const
Definition: PersistencySvc.h:82
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
PersistencySvc::m_enable
bool m_enable
Flag to indicate that the service is enabled.
Definition: PersistencySvc.h:279
PersistencySvc::setConversionSvc
StatusCode setConversionSvc(IConversionSvc *svc) override
Set conversion service the converter is connected to.
Definition: PersistencySvc.cpp:183
IConversionSvc::addConverter
virtual StatusCode addConverter(IConverter *pConverter)=0
Add converter object to conversion service.
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
FILL_OBJ_REFS
Definition: PersistencySvc.cpp:47
std::map::end
T end(T...args)
PersistencySvc::m_svcNames
StringArrayProperty m_svcNames
Names of services to be requested from the service locator and added by default.
Definition: PersistencySvc.h:277
IConverter::createRep
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
MYSQL_StorageType
const long MYSQL_StorageType
Definition: ClassID.h:64
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
PersistencySvc::removeConverter
StatusCode removeConverter(const CLID &clid) override
Remove converter object from conversion service (if present).
Definition: PersistencySvc.cpp:206
PersistencySvc::PersistencySvc
PersistencySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: PersistencySvc.cpp:567
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
IConverter::updateRepRefs
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
POOL_MYSQL_StorageType
const long POOL_MYSQL_StorageType
Definition: ClassID.h:72
PersistencySvc::updateRep
StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the converted representation of a transient object.
Definition: PersistencySvc.cpp:143
std::stringstream
STL class.
PersistencySvc::updateObjRefs
StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an updated transient object.
Definition: PersistencySvc.cpp:128
PersistencySvc::addConverter
StatusCode addConverter(IConverter *pConverter) override
Add converter object to conversion service.
Definition: PersistencySvc.cpp:199
IConverter::updateObj
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
PersistencySvc::convertAddress
StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress) override
Convert an address to string form.
Definition: PersistencySvc.cpp:335
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
std::string
STL class.
POOL_ROOTKEY_StorageType
const long POOL_ROOTKEY_StorageType
Definition: ClassID.h:69
PersistencySvc::repSvcType
long repSvcType() const override
Return default service type.
Definition: PersistencySvc.cpp:296
PersistencySvc::fillObjRefs
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the created transient object.
Definition: PersistencySvc.cpp:118
PersistencySvc::enable
bool enable(bool value)
Set enabled flag.
Definition: PersistencySvc.cpp:560
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
PersistencySvc::setDataProvider
StatusCode setDataProvider(IDataProviderSvc *pStore) override
Define transient datastore.
Definition: PersistencySvc.cpp:169
POOL_ACCESS_StorageType
const long POOL_ACCESS_StorageType
Definition: ClassID.h:71
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
IDataProviderSvc.h
FILL_REP_REFS
Definition: PersistencySvc.cpp:51
gaudirun.type
string type
Definition: gaudirun.py:151
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
StatusCode::FAILURE
Definition: StatusCode.h:29
PersistencySvc::encodeAddrHdr
void encodeAddrHdr(long service_type, const CLID &clid, std::string &address) const
Retrieve string from storage type and clid.
Definition: PersistencySvc.cpp:381
PersistencySvc::svcNamesHandler
void svcNamesHandler(Property &theProp)
Handlers for Service Names Property.
Definition: PersistencySvc.cpp:555
PersistencySvc::objType
const CLID & objType() const override
Retrieve the class type of objects the converter produces. (DUMMY)
Definition: PersistencySvc.cpp:531
IConverter::repSvcType
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
IService
General service interface definition.
Definition: IService.h:18
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
PersistencySvc::createRep
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
Definition: PersistencySvc.cpp:133
PersistencySvc::finalize
StatusCode finalize() override
stop the service.
Definition: PersistencySvc.cpp:547
IConverter::updateObjRefs
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
SmartIF.h
PersistencySvc::getService
StatusCode getService(long service_type, IConversionSvc *&refpSvc) override
Retrieve conversion service identified by technology.
Definition: PersistencySvc.cpp:452
std::map::erase
T erase(T...args)
CnvSvcAction
CnvSvcAction
Definition: PersistencySvc.cpp:45
POOL_ORACLE_StorageType
const long POOL_ORACLE_StorageType
Definition: ClassID.h:73
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:273
PersistencySvc::commitOutput
StatusCode commitOutput(const std::string &output, bool do_commit) override
Commit pending output.
Definition: PersistencySvc.cpp:318
std::stringstream::str
T str(T...args)
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
PersistencySvc
PersistencySvc class implementation definition.
Definition: PersistencySvc.h:50
ROOT_StorageType
const long ROOT_StorageType
Definition: ClassID.h:52
PersistencySvc::fillRepRefs
StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the converted object.
Definition: PersistencySvc.cpp:138
IConverter::updateRep
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
PersistencySvc.h
std::string::clear
T clear(T...args)
ORACLE_StorageType
const long ORACLE_StorageType
Definition: ClassID.h:65
POOL_ROOT_StorageType
const long POOL_ROOT_StorageType
Definition: ClassID.h:68
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
PersistencySvc::addCnvService
StatusCode addCnvService(IConversionSvc *service) override
Add a new Service.
Definition: PersistencySvc.cpp:255
IOpaqueAddress.h
PersistencySvc::removeCnvService
StatusCode removeCnvService(long type) override
Remove a Service.
Definition: PersistencySvc.cpp:286
PersistencySvc::updateObj
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Implementation of IConverter: Update the transient object from the other representation.
Definition: PersistencySvc.cpp:123
PersistencySvc::createAddress
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *pars, const unsigned long *ipars, IOpaqueAddress *&refpAddress) override
Create a Generic address using explicit arguments to identify a single object.
Definition: PersistencySvc.cpp:323
POOL_StorageType
const long POOL_StorageType
Definition: ClassID.h:67
std::map::find
T find(T...args)
std::string::size
T size(T...args)
PersistencySvc::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition: PersistencySvc.cpp:189
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
IConverter::fillObjRefs
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
POOL_ROOTTREE_StorageType
const long POOL_ROOTTREE_StorageType
Definition: ClassID.h:70
IAddressCreator::convertAddress
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)=0
Convert an address to string form.
PersistencySvc::dataProvider
SmartIF< IDataProviderSvc > & dataProvider() const override
Access reference to transient datastore.
Definition: PersistencySvc.cpp:178
std::map::begin
T begin(T...args)
PersistencySvc::createObj
StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConverter: Create the transient representation of an object.
Definition: PersistencySvc.cpp:113
Gaudi::Utils::TypeNameString::type
const std::string & type() const
Definition: TypeNameString.h:22
std::string::c_str
T c_str(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:271
std::map::emplace
T emplace(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245
TypeNameString.h
CommonMessaging
Definition: CommonMessaging.h:58
PersistencySvc::setAddressCreator
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
Definition: PersistencySvc.cpp:438
std::string::substr
T substr(T...args)
make_SmartIF
SmartIF< IFace > make_SmartIF(IFace *iface)
Definition: SmartIF.h:143
PersistencySvc::decodeAddrHdr
void decodeAddrHdr(const std::string &address, long &service_type, CLID &clid, std::string &address_trailer) const
Retrieve storage type and clid from address header of string.
Definition: PersistencySvc.cpp:394
CREATE_REP
Definition: PersistencySvc.cpp:50
SQLSERVER_StorageType
const long SQLSERVER_StorageType
Definition: ClassID.h:63
Gaudi::Utils::TypeNameString::name
const std::string & name() const
Definition: TypeNameString.h:23
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
UPDATE_OBJ
Definition: PersistencySvc.cpp:48
OBJY_StorageType
const long OBJY_StorageType
Definition: ClassID.h:53
PersistencySvc::setDefaultCnvService
StatusCode setDefaultCnvService(long type) override
Set default service type.
Definition: PersistencySvc.cpp:301
SICB_StorageType
const long SICB_StorageType
Definition: ClassID.h:51
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
ana.i
list i
Definition: ana.py:128
IConverter.h
IConverter::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
UPDATE_REP_REFS
Definition: PersistencySvc.cpp:53
PersistencySvc::updateRepRefs
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an already converted object.
Definition: PersistencySvc.cpp:148
std::stol
T stol(T...args)
ISvcLocator.h
strcasecmp.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
DataObject.h
UPDATE_REP
Definition: PersistencySvc.cpp:52
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:269
PersistencySvc::converter
IConverter * converter(const CLID &clid) override
Retrieve converter from list.
Definition: PersistencySvc.cpp:217