18 #define PERSISTENCYSVC_PERSISTENCYSVC_CPP
35 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
36 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
38 #define DEBMSG ON_DEBUG debug()
39 #define VERMSG ON_VERBOSE verbose()
69 if ( 0 != pAddress ) {
70 long svc_type = pAddress->
svcType();
73 return BAD_STORAGE_TYPE;
77 return INVALID_ADDRESS;
86 status = svc->
createObj(pAddress, pObject);
92 status = svc->
updateObj(pAddress, pObject);
98 status = svc->
createRep(pObject, pAddress);
104 status = svc->
updateRep(pAddress, pObject);
168 return (*it).second.addrCreator();
174 return (*it).second.addrCreator();
181 (*i).second.conversionSvc()->setDataProvider(
m_dataSvc).ignore();
209 if ( 0 != pConverter ) {
215 return BAD_STORAGE_TYPE;
225 iret = (*i).second.conversionSvc()->removeConverter(clid);
226 if ( iret.isSuccess() ) {
240 Gaudi::Utils::TypeNameString tn(nam);
243 if ( (*it).second.service()->name() == tn.name() ) {
254 info() <<
"Cannot access Conversion service:" << nam <<
endmsg;
265 return (*it).second.conversionSvc();
269 for ( SvcNames::const_iterator
i = theNames.begin();
i != theNames.end();
i++ ) {
272 long typ = svc->repSvcType();
292 if ( type == def_typ ) {
295 if ( cnv_svc != servc ) {
302 if ( 0 != cnv_svc ) {
308 info() <<
"Added successfully Conversion service:" << isvc->
name() <<
endmsg;
314 info() <<
"Cannot add Conversion service of type " << isvc->
name() <<
endmsg;
321 info() <<
"Cannot add Conversion service of type " << type <<
endmsg;
328 return BAD_STORAGE_TYPE;
335 (*it).second.service()->release();
336 (*it).second.addrCreator()->release();
340 return BAD_STORAGE_TYPE;
375 const unsigned long* ipars,
381 status = svc->
createAddress(svc_type, clid, pars, ipars, refpAddress);
395 if ( 0 != pAddress ) {
396 svc_type = pAddress->
svcType();
397 clid = pAddress->
clID();
409 refAddress += address;
423 long new_svc_type = 0;
426 decodeAddrHdr(refAddress, new_svc_type, new_clid, address_trailer);
430 status = svc->
createAddress( new_svc_type, new_clid, address_trailer, refpAddress);
443 int svctyp = service_type;
444 stream <<
"<address_header service_type=\"" << svctyp <<
"\" clid=\"" << clid <<
"\" /> ";
445 address = stream.
str();
458 address_trailer =
"";
461 size_t pos = address.find(
"<address_header");
462 if (std::string::npos != pos) {
464 pos = address.find(
"service_type=\"");
465 if (std::string::npos != pos) {
467 size_t end = address.find(
'"', pos);
468 if (std::string::npos != end) {
472 pos = address.find(
"clid=\"");
473 if (std::string::npos != pos) {
475 end = address.find(
'\"', pos);
476 if (std::string::npos != end) {
478 str.str(address.substr(pos, end-pos));
481 pos = address.find(
'>');
482 if (pos < (address.size()-2)) {
484 address_trailer = address.substr(pos+1);
509 refpSvc =
service(service_type);
515 const char* imp = service_type.c_str();
516 long len = service_type.length();
517 if ( ::strncasecmp(imp,
"SICB", len) == 0 )
519 else if ( ::strncasecmp(imp,
"ZEBRA", len) == 0 )
521 else if ( ::strncasecmp(imp,
"MS Access", len) == 0 )
523 else if ( ::strncasecmp(imp,
"Microsoft Access", strlen(
"Microsoft Access")) == 0 )
525 else if ( ::strncasecmp(imp,
"SQL Server", len) == 0 )
527 else if ( ::strncasecmp(imp,
"Microsoft ODBC for Oracle", len) == 0 )
529 else if ( ::strncasecmp(imp,
"Oracle ODBC", strlen(
"Oracle ODBC")) == 0 )
531 else if ( ::strncasecmp(imp,
"Oracle OCI", strlen(
"Oracle OCI")) == 0 )
533 else if ( ::strncasecmp(imp,
"MySQL", len) == 0 )
535 else if ( ::strncasecmp(imp,
"ROOT", len) == 0 )
537 else if ( ::strncasecmp(imp,
"OBJY", len) == 0 )
539 else if ( ::strncasecmp(imp,
"OBJYECTI", 7) == 0 )
541 else if ( ::strncasecmp(imp,
"POOL_ROOTKEY", 12) == 0 )
543 else if ( ::strncasecmp(imp,
"POOL_ROOTTREE", 12) == 0 )
545 else if ( ::strncasecmp(imp,
"POOL_ROOT", 9) == 0 )
547 else if ( ::strncasecmp(imp,
"POOL_MySQL", 8) == 0 )
549 else if ( ::strncasecmp(imp,
"POOL_ORACLE", 8) == 0 )
551 else if ( ::strncasecmp(imp,
"POOL_ACCESS", 8) == 0 )
553 else if ( ::strncasecmp(imp,
"POOL", 4) == 0 )
560 if ( svc->name() == service_type ) {
574 Gaudi::Utils::TypeNameString
itm(*
i);
575 if ( itm.name() == service_type || itm.type() == service_type ) {
597 error() <<
"Error initializing Service base class." <<
endmsg;