Go to the documentation of this file.
47 if ( !pAddress )
return Status::INVALID_ADDRESS;
49 if ( !svc )
return Status::BAD_STORAGE_TYPE;
57 status = svc->
createObj( pAddress, pObject );
63 status = svc->
updateObj( pAddress, pObject );
69 status = svc->
createRep( pObject, pAddress );
75 status = svc->
updateRep( pAddress, pObject );
145 return it->second.addrCreator();
173 if ( !pConverter )
return Status::NO_CONVERTER;
175 return svc ? svc->
addConverter( pConverter ) : Status::BAD_STORAGE_TYPE;
184 iret = i.second.conversionSvc()->removeConverter( clid );
185 if ( iret.isSuccess() ) status = iret;
200 [&]( Services::const_reference i ) { return i.second.service()->name() == tn.name(); } );
203 auto svc = Service::service<IConversionSvc>( nam,
true );
208 error() <<
"Cannot access Conversion service " << nam <<
endmsg;
222 if ( svc && svc->repSvcType() ==
type )
return svc;
231 if ( !servc )
return Status::BAD_STORAGE_TYPE;
247 error() <<
"Cannot add Conversion service " << isvc->name() <<
endmsg;
250 info() <<
"Added successfully Conversion service " << isvc->name() <<
endmsg;
251 iservc->setAddressCreator(
this ).ignore();
252 iservc->setDataProvider(
m_dataSvc ).ignore();
256 error() <<
"Cannot add Conversion service for type " <<
type <<
endmsg;
266 it->second.
service()->release();
267 it->second.addrCreator()->release();
295 refpAddress =
nullptr;
297 return svc ? svc->
createAddress( svc_type, clid, pars, ipars, refpAddress ) : Status::BAD_STORAGE_TYPE;
308 svc_type = pAddress->
svcType();
309 clid = pAddress->
clID();
321 refAddress += address;
332 long new_svc_type = 0;
335 decodeAddrHdr( refAddress, new_svc_type, new_clid, address_trailer );
337 return svc ? svc->
createAddress( new_svc_type, new_clid, address_trailer, refpAddress ) : Status::BAD_STORAGE_TYPE;
345 int svctyp = service_type;
346 stream <<
"<address_header service_type=\"" << svctyp <<
"\" clid=\"" << clid <<
"\" /> ";
357 address_trailer.
clear();
360 size_t pos = address.
find(
"<address_header" );
361 if ( std::string::npos != pos ) {
363 pos = address.
find(
"service_type=\"" );
364 if ( std::string::npos != pos ) {
366 size_t end = address.
find(
'"', pos );
367 if ( std::string::npos !=
end ) {
370 pos = address.
find(
"clid=\"" );
371 if ( std::string::npos != pos ) {
373 end = address.
find(
'\"', pos );
374 if ( std::string::npos !=
end ) {
379 pos = address.
find(
'>' );
380 if ( pos < ( address.
size() - 2 ) ) {
382 address_trailer = address.
substr( pos + 1 );
405 refpSvc =
service( service_type );
411 const char* imp = service_type.
c_str();
412 long len = service_type.
length();
413 if ( ::strncasecmp( imp,
"SICB", len ) == 0 )
415 else if ( ::strncasecmp( imp,
"ZEBRA", len ) == 0 )
417 else if ( ::strncasecmp( imp,
"MS Access", len ) == 0 )
419 else if ( ::strncasecmp( imp,
"Microsoft Access", strlen(
"Microsoft Access" ) ) == 0 )
421 else if ( ::strncasecmp( imp,
"SQL Server", len ) == 0 )
423 else if ( ::strncasecmp( imp,
"Microsoft ODBC for Oracle", len ) == 0 )
425 else if ( ::strncasecmp( imp,
"Oracle ODBC", strlen(
"Oracle ODBC" ) ) == 0 )
427 else if ( ::strncasecmp( imp,
"Oracle OCI", strlen(
"Oracle OCI" ) ) == 0 )
429 else if ( ::strncasecmp( imp,
"MySQL", len ) == 0 )
431 else if ( ::strncasecmp( imp,
"ROOT", len ) == 0 )
433 else if ( ::strncasecmp( imp,
"OBJY", len ) == 0 )
435 else if ( ::strncasecmp( imp,
"OBJYECTI", 7 ) == 0 )
437 else if ( ::strncasecmp( imp,
"POOL_ROOTKEY", 12 ) == 0 )
439 else if ( ::strncasecmp( imp,
"POOL_ROOTTREE", 12 ) == 0 )
441 else if ( ::strncasecmp( imp,
"POOL_ROOT", 9 ) == 0 )
443 else if ( ::strncasecmp( imp,
"POOL_MySQL", 8 ) == 0 )
445 else if ( ::strncasecmp( imp,
"POOL_ORACLE", 8 ) == 0 )
447 else if ( ::strncasecmp( imp,
"POOL_ACCESS", 8 ) == 0 )
449 else if ( ::strncasecmp( imp,
"POOL", 4 ) == 0 )
457 if ( svc->name() == service_type ) {
462 auto instance = svc.
get();
472 if ( itm.
name() == service_type || itm.
type() == service_type ) {
491 if ( !status.
isSuccess() ) { error() <<
"Error initializing Service base class." <<
endmsg; }
void encodeAddrHdr(long service_type, const CLID &clid, std::string &address) const
Retrieve string from storage type and clid.
StatusCode commitOutput(const std::string &output, bool do_commit) override
Commit pending output.
PersistencySvc class implementation definition.
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
StatusCode finalize() override
stop the service.
StatusCode initialize() override
SmartIF< IConversionSvc > & conversionSvc() const
const std::string & name() const
StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the converted object.
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Implementation of IConverter: Update the transient object from the other representation.
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
SmartIF< IDataProviderSvc > & dataProvider() const override
Access reference to transient datastore.
const long ACCESS_StorageType
virtual long svcType() const =0
Retrieve service type.
const long MYSQL_StorageType
StatusCode addCnvService(IConversionSvc *service) override
Add a new Service.
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.
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)=0
Convert an address to string form.
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.
StatusCode removeCnvService(long type) override
Remove a Service.
StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConverter: Create the transient representation of an object.
const long POOL_MYSQL_StorageType
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
SmartIF< IService > & service() const
Services m_cnvServices
List of conversion workers.
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an already converted object.
Helper class to parse a string of format "type/name".
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
StatusCode setDefaultCnvService(long type) override
Set default service type.
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
SmartIF< IAddressCreator > & addrCreator() const
const long POOL_ROOT_StorageType
const long POOL_ROOTKEY_StorageType
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual const CLID & clID() const =0
Retrieve class information from link.
const ValueType & value() const
IConverter * converter(const CLID &clid) override
Retrieve converter from list.
const long POOL_ORACLE_StorageType
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
const long POOL_StorageType
const long POOL_ACCESS_StorageType
unsigned int CLID
Class ID definition.
virtual StatusCode addConverter(IConverter *pConverter)=0
Add converter object to conversion service.
StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.
const long ORACLE_StorageType
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const long ROOT_StorageType
Gaudi::Property< std::vector< std::string > > m_svcNames
const std::string & type() const
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
StatusCode initialize() override
Initialize the service.
SmartIF< IFace > make_SmartIF(IFace *iface)
StatusCode setConversionSvc(IConversionSvc *svc) override
Set conversion service the converter is connected to.
constexpr static const auto SUCCESS
const long SQLSERVER_StorageType
TYPE * get() const
Get interface pointer.
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.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
const long POOL_ROOTTREE_StorageType
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
StatusCode removeConverter(const CLID &clid) override
Remove converter object from conversion service (if present).
std::recursive_mutex m_servicesMutex
Mutex to protect accesses to m_cnvServices.
#define DECLARE_COMPONENT(type)
StatusCode addConverter(IConverter *pConverter) override
Add converter object to conversion service.
bool m_enable
Flag to indicate that the service is enabled.
StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an updated transient object.
StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the converted representation of a transient object.
long repSvcType() const override
Return default service type.
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the created transient object.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
constexpr static const auto FAILURE
bool enable(bool value)
Set enabled flag.
const long OBJY_StorageType
StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress) override
Convert an address to string form.
const long SICB_StorageType
const CLID & objType() const override
Retrieve the class type of objects the converter produces. (DUMMY)
StatusCode setDataProvider(IDataProviderSvc *pStore) override
Define transient datastore.
StatusCode getService(long service_type, IConversionSvc *&refpSvc) override
Retrieve conversion service identified by technology.