| The Gaudi Framework v32r1 (f65d50dc)

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/DataObject.h"
22 #include "GaudiKernel/IConverter.h"
23 #include "GaudiKernel/IDataProviderSvc.h"
24 #include "GaudiKernel/IDataSelector.h"
25 #include "GaudiKernel/IOpaqueAddress.h"
26 #include "GaudiKernel/ISvcLocator.h"
27 #include "GaudiKernel/MsgStream.h"
28 #include "GaudiKernel/SmartIF.h"
29 #include "GaudiKernel/TypeNameString.h"
30 #include "GaudiKernel/strcasecmp.h"
31
32 // Implementation specific definitions
33 #include "PersistencySvc.h"
34
35 // Instantiation of a static factory class used by clients to create
36 // instances of this service
37 DECLARE_COMPONENT( PersistencySvc )
38
39 enum CnvSvcAction {
40 CREATE_OBJ,
41 FILL_OBJ_REFS,
42 UPDATE_OBJ,
43 UPDATE_OBJ_REFS,
44 CREATE_REP,
45 FILL_REP_REFS,
46 UPDATE_REP,
47 UPDATE_REP_REFS
48 };
49
50 StatusCode PersistencySvc::makeCall( int typ, IOpaqueAddress*& pAddress, DataObject*& pObject ) {
51 if ( m_enable ) {
52 IConversionSvc* svc = nullptr;
53 switch ( typ ) {
54 case CREATE_REP:
55 case FILL_REP_REFS:
56 case UPDATE_REP:
57 case UPDATE_REP_REFS:
58 svc = m_cnvDefault;
59 break;
60 default:
61 if ( !pAddress ) return Status::INVALID_ADDRESS;
62 svc = service( pAddress->svcType() );
63 if ( !svc ) return Status::BAD_STORAGE_TYPE;
64 break;
65 }
66
67 StatusCode status( StatusCode::FAILURE, true );
68 switch ( typ ) {
69 case CREATE_OBJ:
70 pObject = nullptr;
71 status = svc->createObj( pAddress, pObject );
72 break;
73 case FILL_OBJ_REFS:
74 status = svc->fillObjRefs( pAddress, pObject );
75 break;
76 case UPDATE_OBJ:
77 status = svc->updateObj( pAddress, pObject );
78 break;
79 case UPDATE_OBJ_REFS:
80 status = svc->updateObjRefs( pAddress, pObject );
81 break;
82 case CREATE_REP:
83 status = svc->createRep( pObject, pAddress );
84 break;
85 case FILL_REP_REFS:
86 status = svc->fillRepRefs( pAddress, pObject );
87 break;
88 case UPDATE_REP:
89 status = svc->updateRep( pAddress, pObject );
90 break;
91 case UPDATE_REP_REFS:
92 status = svc->updateRepRefs( pAddress, pObject );
93 break;
94 default:
95 status = StatusCode::FAILURE;
96 break;
97 }
98 status.ignore();
99 return status;
100 }
101 return StatusCode::SUCCESS;
102 }
103
105 StatusCode PersistencySvc::createObj( IOpaqueAddress* pAddr, DataObject*& refpObj ) {
106 return makeCall( CREATE_OBJ, pAddr, refpObj );
107 }
108
110 StatusCode PersistencySvc::fillObjRefs( IOpaqueAddress* pAddr, DataObject* pObj ) {
111 return makeCall( FILL_OBJ_REFS, pAddr, pObj );
112 }
113
115 StatusCode PersistencySvc::updateObj( IOpaqueAddress* pAddr, DataObject* pObj ) {
116 return makeCall( UPDATE_OBJ, pAddr, pObj );
117 }
118
120 StatusCode PersistencySvc::updateObjRefs( IOpaqueAddress* pAddr, DataObject* pObj ) {
121 return makeCall( UPDATE_OBJ_REFS, pAddr, pObj );
122 }
123
125 StatusCode PersistencySvc::createRep( DataObject* pObj, IOpaqueAddress*& refpAddr ) {
126 return makeCall( CREATE_REP, refpAddr, pObj );
127 }
128
130 StatusCode PersistencySvc::fillRepRefs( IOpaqueAddress* pAddr, DataObject* pObj ) {
131 return makeCall( FILL_REP_REFS, pAddr, pObj );
132 }
133
135 StatusCode PersistencySvc::updateRep( IOpaqueAddress* pAddr, DataObject* pObj ) {
136 return makeCall( UPDATE_REP, pAddr, pObj );
137 }
138
140 StatusCode PersistencySvc::updateRepRefs( IOpaqueAddress* pAddr, DataObject* pObj ) {
141 return makeCall( UPDATE_REP_REFS, pAddr, pObj );
142 }
143
145 SmartIF<IAddressCreator>& PersistencySvc::addressCreator( long type ) {
146 long typ = type;
147 auto it = m_cnvServices.find( typ );
148 if ( it == m_cnvServices.end() ) {
149 IConversionSvc* s = service( type );
150 if ( s ) {
151 it = m_cnvServices.find( typ );
152 if ( it != m_cnvServices.end() ) return it->second.addrCreator();
153 }
154 static SmartIF<IAddressCreator> no_creator;
155 return no_creator;
156 }
157 return it->second.addrCreator();
158 }
159
161 StatusCode PersistencySvc::setDataProvider( IDataProviderSvc* pDataSvc ) {
162 m_dataSvc = pDataSvc;
163 for ( auto& i : m_cnvServices ) { i.second.conversionSvc()->setDataProvider( m_dataSvc ).ignore(); }
164 return StatusCode( StatusCode::SUCCESS, true );
165 }
166
168 SmartIF<IDataProviderSvc>& PersistencySvc::dataProvider() const { return m_dataSvc; }
169
171 StatusCode PersistencySvc::setConversionSvc( IConversionSvc* svc ) {
172 m_cnvDefault = svc;
173 return StatusCode( StatusCode::SUCCESS, true );
174 }
175
177 SmartIF<IConversionSvc>& PersistencySvc::conversionSvc() const { return m_cnvDefault; }
178
180 StatusCode PersistencySvc::addConverter( const CLID& /* clid */ ) { return StatusCode::FAILURE; }
181
183 StatusCode PersistencySvc::addConverter( IConverter* pConverter ) {
184 if ( !pConverter ) return Status::NO_CONVERTER;
185 IConversionSvc* svc = service( pConverter->repSvcType() );
186 return svc ? svc->addConverter( pConverter ) : Status::BAD_STORAGE_TYPE;
187 }
188
190 StatusCode PersistencySvc::removeConverter( const CLID& clid ) {
191 // Remove converter type from all services
192 StatusCode status = Status::NO_CONVERTER, iret = StatusCode::SUCCESS;
193 for ( auto& i : m_cnvServices ) {
194 iret = i.second.conversionSvc()->removeConverter( clid );
195 if ( iret.isSuccess() ) status = iret;
196 }
197 return status;
198 }
199
201 IConverter* PersistencySvc::converter( const CLID& /*clid*/ ) { return nullptr; }
202
204 SmartIF<IConversionSvc>& PersistencySvc::service( const std::string& nam ) {
205 Gaudi::Utils::TypeNameString tn( nam );
206 auto it = std::find_if( m_cnvServices.begin(), m_cnvServices.end(),
207 [&]( Services::const_reference i ) { return i.second.service()->name() == tn.name(); } );
208 if ( it != m_cnvServices.end() ) return it->second.conversionSvc();
209
210 auto svc = Service::service<IConversionSvc>( nam, true );
211 if ( svc && addCnvService( svc.get() ).isSuccess() ) {
212 return service( nam ); // now it is in the list
213 }
214
215 info() << "Cannot access Conversion service:" << nam << endmsg;
216 static SmartIF<IConversionSvc> no_svc;
217 return no_svc;
218 }
219
221 SmartIF<IConversionSvc>& PersistencySvc::service( long type ) {
222 // Check wether this is already an active service
223 auto it = m_cnvServices.find( type );
224 if ( it != m_cnvServices.end() ) return it->second.conversionSvc();
225 // if not, check if the service is in the list and may be requested
226 for ( const auto& i : m_svcNames.value() ) {
227 auto& svc = service( i );
228 if ( svc && svc->repSvcType() == type ) return svc;
229 }
230 static SmartIF<IConversionSvc> no_svc;
231 return no_svc;
232 }
233
235 StatusCode PersistencySvc::addCnvService( IConversionSvc* servc ) {
236 if ( !servc ) return Status::BAD_STORAGE_TYPE;
237 long type = servc->repSvcType();
238 long def_typ = ( m_cnvDefault ? m_cnvDefault->repSvcType() : 0 );
239 auto it = m_cnvServices.find( type );
240 auto cnv_svc = ( it != m_cnvServices.end() ? it->second.conversionSvc() : nullptr );
241 if ( type == def_typ ) m_cnvDefault = servc;
242 if ( cnv_svc == servc ) return StatusCode::SUCCESS;
243
244 auto iservc = make_SmartIF( servc );
245 auto icr = iservc.as<IAddressCreator>();
246 if ( icr ) {
247 auto isvc = iservc.as<IService>();
248 if ( isvc ) {
249 if ( cnv_svc ) removeCnvService( type ).ignore();
250 auto p = m_cnvServices.emplace( type, ServiceEntry( type, isvc, iservc, icr ) );
251 if ( !p.second ) {
252 info() << "Cannot add Conversion service of type " << isvc->name() << endmsg;
253 return StatusCode::FAILURE;
254 }
255 info() << "Added successfully Conversion service:" << isvc->name() << endmsg;
256 iservc->setAddressCreator( this ).ignore();
257 iservc->setDataProvider( m_dataSvc ).ignore();
258 return StatusCode::SUCCESS;
259 }
260 }
261 info() << "Cannot add Conversion service of type " << type << endmsg;
262 return StatusCode::FAILURE;
263 }
264
266 StatusCode PersistencySvc::removeCnvService( long svctype ) {
267 auto it = m_cnvServices.find( svctype );
268 if ( it == m_cnvServices.end() ) return Status::BAD_STORAGE_TYPE;
269 it->second.service()->release();
270 it->second.addrCreator()->release();
271 m_cnvServices.erase( it );
272 return StatusCode::SUCCESS;
273 }
274
276 long PersistencySvc::repSvcType() const { return m_cnvDefault ? m_cnvDefault->repSvcType() : 0; }
277
279 StatusCode PersistencySvc::setDefaultCnvService( long type ) {
280 m_cnvDefault = service( type );
281 return StatusCode::SUCCESS;
282 }
283
285 StatusCode PersistencySvc::connectOutput( const std::string& outputFile, const std::string& /* openMode */ ) {
286 return connectOutput( outputFile );
287 }
288
290 StatusCode PersistencySvc::connectOutput( const std::string& ) { return StatusCode::SUCCESS; }
291
293 StatusCode PersistencySvc::commitOutput( const std::string&, bool ) { return StatusCode::SUCCESS; }
294
296 StatusCode PersistencySvc::createAddress( long svc_type, const CLID& clid, const std::string* pars,
297 const unsigned long* ipars, IOpaqueAddress*& refpAddress ) {
298 refpAddress = nullptr;
299 IAddressCreator* svc = addressCreator( svc_type );
300 return svc ? svc->createAddress( svc_type, clid, pars, ipars, refpAddress ) : Status::BAD_STORAGE_TYPE;
301 }
302
304 StatusCode PersistencySvc::convertAddress( const IOpaqueAddress* pAddress, std::string& refAddress ) {
305 // Assumuption is that the Persistency service prepends a header
306 // and requests the conversion service refered to by the service
307 // type to encode the rest
308 long svc_type = 0;
309 CLID clid = 0;
310 if ( pAddress ) {
311 svc_type = pAddress->svcType();
312 clid = pAddress->clID();
313 }
314 IAddressCreator* svc = addressCreator( svc_type );
315 StatusCode status = Status::BAD_STORAGE_TYPE; // Preset error
316 refAddress.clear();
317
318 if ( svc ) {
319 // Found service, set header
320 encodeAddrHdr( svc_type, clid, refAddress );
321 std::string address;
322 // Get rest of address from conversion service
323 status = svc->convertAddress( pAddress, address );
324 refAddress += address;
325 }
326 return status;
327 }
328
330 StatusCode PersistencySvc::createAddress( long /* svc_type */, const CLID& /* clid */, const std::string& refAddress,
331 IOpaqueAddress*& refpAddress ) {
332 // Assumption is that the Persistency service decodes that header
333 // and requests the conversion service referred to by the service
334 // type to decode the rest
335 long new_svc_type = 0;
336 CLID new_clid = 0;
337 std::string address_trailer;
338 decodeAddrHdr( refAddress, new_svc_type, new_clid, address_trailer );
339 IAddressCreator* svc = addressCreator( new_svc_type );
340 return svc ? svc->createAddress( new_svc_type, new_clid, address_trailer, refpAddress ) : Status::BAD_STORAGE_TYPE;
341 }
342
344 void PersistencySvc::encodeAddrHdr( long service_type, const CLID& clid, std::string& address ) const {
345 // For address header, use xml-style format of
346 // <addrhdr service_type="xxx" clid="yyy" />
347 std::stringstream stream;
348 int svctyp = service_type; // must put int into stream, not char
349 stream << "<address_header service_type=\"" << svctyp << "\" clid=\"" << clid << "\" /> ";
350 address = stream.str();
351 }
352
354 void PersistencySvc::decodeAddrHdr( const std::string& address, long& service_type, CLID& clid,
355 std::string& address_trailer ) const {
356 // For address header, use xml-style format of
357 // <address_header service_type="xxx" clid="yyy" />
358 service_type = 0;
359 clid = 0;
360 address_trailer.clear();
361
362 // Check for address_header tag
363 size_t pos = address.find( "<address_header" );
364 if ( std::string::npos != pos ) {
365 // Get service_type
366 pos = address.find( "service_type=\"" );
367 if ( std::string::npos != pos ) {
368 pos += 14;
369 size_t end = address.find( '"', pos );
370 if ( std::string::npos != end ) {
371 service_type = std::stol( address.substr( pos, end - pos ) );
372 // Get clid
373 pos = address.find( "clid=\"" );
374 if ( std::string::npos != pos ) {
375 pos += 6;
376 end = address.find( '\"', pos );
377 if ( std::string::npos != end ) {
378 std::istringstream str;
379 str.str( address.substr( pos, end - pos ) );
380 str >> clid;
381 // Get trailer_address
382 pos = address.find( '>' );
383 if ( pos < ( address.size() - 2 ) ) { // this means that '>' was found (pos != npos)
384 // it is before the last char
385 address_trailer = address.substr( pos + 1 );
386 }
387 }
388 }
389 }
390 }
391 }
392 }
393
395 StatusCode PersistencySvc::setAddressCreator( IAddressCreator* ) {
396 // The persistency service is a address creation dispatcher istelf.
397 // The persistency service can NEVER create addresses itself.
398 // The entry point must only be provided in order to fulfill the needs of the
399 // implementing interfaces.
400 return StatusCode::FAILURE;
401 }
402
404 SmartIF<IAddressCreator>& PersistencySvc::addressCreator() const { return m_addrCreator; }
405
407 StatusCode PersistencySvc::getService( long service_type, IConversionSvc*& refpSvc ) {
408 refpSvc = service( service_type );
409 return refpSvc ? StatusCode::SUCCESS : StatusCode::FAILURE;
410 }
411
413 StatusCode PersistencySvc::getService( const std::string& service_type, IConversionSvc*& refpSvc ) {
414 const char* imp = service_type.c_str();
415 long len = service_type.length();
416 if ( ::strncasecmp( imp, "SICB", len ) == 0 )
417 return getService( SICB_StorageType, refpSvc );
418 else if ( ::strncasecmp( imp, "ZEBRA", len ) == 0 )
419 return getService( SICB_StorageType, refpSvc );
420 else if ( ::strncasecmp( imp, "MS Access", len ) == 0 )
421 return getService( ACCESS_StorageType, refpSvc );
422 else if ( ::strncasecmp( imp, "Microsoft Access", strlen( "Microsoft Access" ) ) == 0 )
423 return getService( ACCESS_StorageType, refpSvc );
424 else if ( ::strncasecmp( imp, "SQL Server", len ) == 0 )
425 return getService( SQLSERVER_StorageType, refpSvc );
426 else if ( ::strncasecmp( imp, "Microsoft ODBC for Oracle", len ) == 0 )
427 return getService( ORACLE_StorageType, refpSvc );
428 else if ( ::strncasecmp( imp, "Oracle ODBC", strlen( "Oracle ODBC" ) ) == 0 )
429 return getService( ORACLE_StorageType, refpSvc );
430 else if ( ::strncasecmp( imp, "Oracle OCI", strlen( "Oracle OCI" ) ) == 0 )
431 return getService( ORACLE_StorageType, refpSvc );
432 else if ( ::strncasecmp( imp, "MySQL", len ) == 0 )
433 return getService( MYSQL_StorageType, refpSvc );
434 else if ( ::strncasecmp( imp, "ROOT", len ) == 0 )
435 return getService( ROOT_StorageType, refpSvc );
436 else if ( ::strncasecmp( imp, "OBJY", len ) == 0 )
437 return getService( OBJY_StorageType, refpSvc );
438 else if ( ::strncasecmp( imp, "OBJYECTI", 7 ) == 0 )
439 return getService( OBJY_StorageType, refpSvc );
440 else if ( ::strncasecmp( imp, "POOL_ROOTKEY", 12 ) == 0 )
441 return getService( POOL_ROOTKEY_StorageType, refpSvc );
442 else if ( ::strncasecmp( imp, "POOL_ROOTTREE", 12 ) == 0 )
443 return getService( POOL_ROOTTREE_StorageType, refpSvc );
444 else if ( ::strncasecmp( imp, "POOL_ROOT", 9 ) == 0 )
445 return getService( POOL_ROOT_StorageType, refpSvc );
446 else if ( ::strncasecmp( imp, "POOL_MySQL", 8 ) == 0 )
447 return getService( POOL_MYSQL_StorageType, refpSvc );
448 else if ( ::strncasecmp( imp, "POOL_ORACLE", 8 ) == 0 )
449 return getService( POOL_ORACLE_StorageType, refpSvc );
450 else if ( ::strncasecmp( imp, "POOL_ACCESS", 8 ) == 0 )
451 return getService( POOL_ACCESS_StorageType, refpSvc );
452 else if ( ::strncasecmp( imp, "POOL", 4 ) == 0 )
453 return getService( POOL_StorageType, refpSvc );
454
455 for ( const auto& i : m_cnvServices ) {
456 SmartIF<IService> svc( i.second.conversionSvc() );
457 if ( svc ) {
458 // Check wether this is already an active service: first check by service name
459 if ( svc->name() == service_type ) {
460 refpSvc = i.second.conversionSvc();
461 return StatusCode::SUCCESS;
462 }
463 // Check wether this is already an active service: now check by service type
464 auto instance = svc.get();
465 if ( System::typeinfoName( typeid( *instance ) ) == service_type ) {
466 refpSvc = i.second.conversionSvc();
467 return StatusCode::SUCCESS;
468 }
469 }
470 }
471 // if not, check if the service is in the list and may be requested
472 for ( const auto& i : m_svcNames.value() ) {
473 Gaudi::Utils::TypeNameString itm( i );
474 if ( itm.name() == service_type || itm.type() == service_type ) {
475 IConversionSvc* svc = service( i );
476 if ( svc ) {
477 refpSvc = svc;
478 return StatusCode::SUCCESS;
479 }
480 }
481 }
482 return StatusCode::FAILURE;
483 }
484
486 const CLID& PersistencySvc::objType() const { return CLID_NULL; }
487
489 StatusCode PersistencySvc::initialize() {
490 m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
491 // Initialize basic service
492 StatusCode status = Service::initialize();
493 if ( UNLIKELY( !status.isSuccess() ) ) { error() << "Error initializing Service base class." << endmsg; }
494 return status;
495 }
496
498 StatusCode PersistencySvc::finalize() {
499 // Release all workers
500 m_cnvServices.clear();
501 // Release references to this to avoid loops
502 m_addrCreator = nullptr;
503 return StatusCode::SUCCESS;
504 }
505
507 bool PersistencySvc::enable( bool value ) {
508 std::swap( value, m_enable );
509 return value;
510 }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:250
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:404
IDataSelector.h
CREATE_OBJ
Definition: PersistencySvc.cpp:40
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:96
UPDATE_OBJ_REFS
Definition: PersistencySvc.cpp:43
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:60
SmartIF< IAddressCreator >
std::istringstream
STL class.
IConverter
The data converters are responsible to translate data from one representation into another.
Definition: IConverter.h:58
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
PersistencySvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: PersistencySvc.cpp:489
IConversionSvc
Definition: IConversionSvc.h:37
PersistencySvc::ServiceEntry::addrCreator
SmartIF< IAddressCreator > & addrCreator() const
Definition: PersistencySvc.h:74
MsgStream.h
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:285
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
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:52
std::swap
T swap(T... args)
PersistencySvc::m_svcNames
Gaudi::Property< std::vector< std::string > > m_svcNames
Definition: PersistencySvc.h:237
ACCESS_StorageType
const long ACCESS_StorageType
Definition: ClassID.h:60
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:247
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
PersistencySvc::setConversionSvc
StatusCode setConversionSvc(IConversionSvc *svc) override
Set conversion service the converter is connected to.
Definition: PersistencySvc.cpp:171
IConversionSvc::addConverter
virtual StatusCode addConverter(IConverter *pConverter)=0
Add converter object to conversion service.
IConverter::conversionSvc
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50
Gaudi::Utils::TypeNameString::type
const std::string & type() const
Definition: TypeNameString.h:36
FILL_OBJ_REFS
Definition: PersistencySvc.cpp:41
std::map::end
T end(T... args)
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
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:43
PersistencySvc::removeConverter
StatusCode removeConverter(const CLID &clid) override
Remove converter object from conversion service (if present).
Definition: PersistencySvc.cpp:190
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:135
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:120
PersistencySvc::addConverter
StatusCode addConverter(IConverter *pConverter) override
Add converter object to conversion service.
Definition: PersistencySvc.cpp:183
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:304
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:276
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
PersistencySvc::fillObjRefs
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the created transient object.
Definition: PersistencySvc.cpp:110
PersistencySvc::enable
bool enable(bool value)
Set enabled flag.
Definition: PersistencySvc.cpp:507
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
PersistencySvc::setDataProvider
StatusCode setDataProvider(IDataProviderSvc *pStore) override
Define transient datastore.
Definition: PersistencySvc.cpp:161
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:10
IDataProviderSvc.h
FILL_REP_REFS
Definition: PersistencySvc.cpp:45
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
PersistencySvc::objType
const CLID & objType() const override
Retrieve the class type of objects the converter produces. (DUMMY)
Definition: PersistencySvc.cpp:486
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
Gaudi::Utils::TypeNameString::name
const std::string & name() const
Definition: TypeNameString.h:37
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
gaudirun.type
type
Definition: gaudirun.py:142
PersistencySvc::createRep
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
Definition: PersistencySvc.cpp:125
PersistencySvc::finalize
StatusCode finalize() override
stop the service.
Definition: PersistencySvc.cpp:498
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:407
std::map::erase
T erase(T... args)
PersistencySvc::encodeAddrHdr
void encodeAddrHdr(long service_type, const CLID &clid, std::string &address) const
Retrieve string from storage type and clid.
Definition: PersistencySvc.cpp:344
CnvSvcAction
CnvSvcAction
Definition: PersistencySvc.cpp:39
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:235
PersistencySvc::commitOutput
StatusCode commitOutput(const std::string &output, bool do_commit) override
Commit pending output.
Definition: PersistencySvc.cpp:293
std::stringstream::str
T str(T... args)
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:130
IOTest.end
def end
Definition: IOTest.py:112
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)
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
ORACLE_StorageType
const long ORACLE_StorageType
Definition: ClassID.h:65
POOL_ROOT_StorageType
const long POOL_ROOT_StorageType
Definition: ClassID.h:68
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:354
PersistencySvc::addCnvService
StatusCode addCnvService(IConversionSvc *service) override
Add a new Service.
Definition: PersistencySvc.cpp:235
IOpaqueAddress.h
PersistencySvc::removeCnvService
StatusCode removeCnvService(long type) override
Remove a Service.
Definition: PersistencySvc.cpp:266
PersistencySvc::updateObj
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Implementation of IConverter: Update the transient object from the other representation.
Definition: PersistencySvc.cpp:115
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:296
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:177
StatusCode::ignore
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
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:168
PersistencySvc::ServiceEntry::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const
Definition: PersistencySvc.h:73
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:105
std::string::c_str
T c_str(T... args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:233
std::map::emplace
T emplace(T... args)
gaudirun.s
string s
Definition: gaudirun.py:316
TypeNameString.h
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
PersistencySvc::setAddressCreator
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
Definition: PersistencySvc.cpp:395
std::string::substr
T substr(T... args)
make_SmartIF
SmartIF< IFace > make_SmartIF(IFace *iface)
Definition: SmartIF.h:140
CREATE_REP
Definition: PersistencySvc.cpp:44
SQLSERVER_StorageType
const long SQLSERVER_StorageType
Definition: ClassID.h:63
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
UPDATE_OBJ
Definition: PersistencySvc.cpp:42
OBJY_StorageType
const long OBJY_StorageType
Definition: ClassID.h:53
PersistencySvc::setDefaultCnvService
StatusCode setDefaultCnvService(long type) override
Set default service type.
Definition: PersistencySvc.cpp:279
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
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:47
PersistencySvc::updateRepRefs
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an already converted object.
Definition: PersistencySvc.cpp:140
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:192
PersistencySvc::ServiceEntry::service
SmartIF< IService > & service() const
Definition: PersistencySvc.h:72
DataObject.h
UPDATE_REP
Definition: PersistencySvc.cpp:46
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:231
PersistencySvc::converter
IConverter * converter(const CLID &clid) override
Retrieve converter from list.
Definition: PersistencySvc.cpp:201