| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# PoolDbCnvSvc Class Reference

`#include <PoolDb/PoolDbCnvSvc.h>`

Inheritance diagram for PoolDbCnvSvc:

[legend]
Collaboration diagram for PoolDbCnvSvc:

[legend]
List of all members.

## Detailed Description

Description:.

PoolDbCnvSvc class implementation definition.

Author:
  Markus Frank

Version:
  1.0

Definition at line 45 of file PoolDbCnvSvc.h.

## Public Types
typedef std::pair< void *, const ROOT::Reflex::Type > | ObjH
typedef std::map< std::string, DbH > | DbMap
typedef std::map< std::string, std::string > | DbFidMap
## Public Member Functions
| PoolDbCnvSvc (const std::string &name, ISvcLocator *svc)
| Standard constructor.
virtual | ~PoolDbCnvSvc ()
| Standard destructor.
virtual StatusCode | updateServiceState (IOpaqueAddress *pAddress)
| Update state of the service.
StatusCode | error (const std::string &msg, bool rethrow=true)
| Standard way to print errors.
StatusCode | setDataProvider (IDataProviderSvc *pDataSvc)
| Connect to data provider service.
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)
| ConversionSvc overload: Query interface.
virtual StatusCode | initialize ()
| ConversionSvc overload: initialize Db service.
virtual StatusCode | finalize ()
| ConversionSvc overload: Finalize Db service.
virtual IConverter * | createConverter (long typ, const CLID &wanted, const ICnvFactory *fac)
| ConversionSvc overload: Create new Converter using factory.
virtual void | loadConverter (DataObject *)
| ConversionSvc overload: Load the class (dictionary) for the converter.
virtual IPoolCacheSvc * | cacheSvc () const
| Access to cache service.
virtual StatusCode | accessStorageType (const std::string &type_string, long &gaudi_type)
| Create access to the POOL persistency mechanism using the Gaudi String identifier.
virtual StatusCode | connectOutput (const std::string &outputFile, const std::string &openMode)
| Connect the output file to the service with open mode.
StatusCode | connectDatabase (int typ, const std::string &outputFile, pool::DbAccessMode openMode, PoolDbDataConnection **con)
  | Parameters:
  | outputFile | String containig output file
StatusCode | connectContainer (pool::DbDatabase &dbH, const std::string &cntName, pool::DbAccessMode openMode, const pool::DbTypeInfo *shape, pool::DbContainer &cntH)
| Connect to a database container.
virtual StatusCode | connectContainer (int typ, const std::string &dbName, const std::string &cntName, pool::DbAccessMode openMode, const pool::DbTypeInfo *shape, pool::DbContainer &cntH)
| Connect to a database container.
virtual StatusCode | connectOutput (const std::string &outputFile)
| Connect the output file to the service.
virtual StatusCode | commitOutput (const std::string &outputFile, bool do_commit)
| Commit pending output.
virtual StatusCode | connect (const std::string &dbName, const std::string &cntName, pool::DbContainer &cntH)
| Connect to a database container in read mode.
virtual StatusCode | disconnect (const std::string &dbName)
| Disconnect from an existing data stream.
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
| IAddressCreator implementation: Address creation.
virtual StatusCode | createAddress (pool::Token *pToken, PoolDbAddress **ppAddress)
| IPoolDbMgr implementation: Address creation.
virtual pool::DbSelect * | createSelect (const std::string &criteria, const std::string &dbName, const std::string &cntName)
| Request an iterator over a container from the service.
virtual StatusCode | markWrite (pool::DataCallBack *call, const std::string &cntName, PoolDbAddress **ppAddr=0)
| Marks a reference to be written.
virtual StatusCode | markUpdate (pool::DataCallBack *call, PoolDbAddress *pAddr)
| Mark an object for update.
virtual StatusCode | read (pool::DataCallBack *call, PoolDbAddress *pAddr)
| Read existing object.
virtual StatusCode | read (pool::DataCallBack *call, pool::Token &tok)
  | Parameters:
  | call | Pointer to callback object
## Protected Attributes
std::string | m_cacheSvcName
| Name of the POOL cache service instance to connect to.
std::string | m_implementation
| Name of the OODataBase implementation.
std::string | m_serverConnect
| Connection string to server.
bool | m_safeTransactions
| Flag to indicate safe transactions if requested.
std::vector< std::string > | m_domainOpts
| Buffer for domain options.
std::vector< std::string > | m_databaseOpts
| Buffer for database options.
std::vector< std::string > | m_containerOpts
| Buffer for container options.
IDataManagerSvc * | m_dataMgr
| Services needed for proper operation: Data Manager.
IPoolCacheSvc * | m_cacheSvc
| Reference to POOL cache service.
PoolDbDataConnection * | m_current
| On writing: reference to active output stream.
pool::DbDefaultDataHandler | m_handler
| POOL Datahandler.
pool::DbDomain | m_domH
| POOL technology domain handle.
std::string | m_shareFiles
| Share files ? If set to YES, files will not be closed on finalize.
bool | m_checkFIDs
| Flag to enforce FID checking and verification.
Gaudi::IFileCatalog * | m_catalog
| Reference to the file catalog.
Gaudi::IIODataManager * | m_ioMgr
| Reference to the I/O data manager.
## Classes
struct | DbH

## Member Typedef Documentation

typedef std::pair< void*, const ROOT::Reflex::Type > PoolDbCnvSvc::ObjH

Definition at line 60 of file PoolDbCnvSvc.h.

typedef std::map<std::string, DbH> PoolDbCnvSvc::DbMap

Definition at line 61 of file PoolDbCnvSvc.h.

typedef std::map<std::string, std::string> PoolDbCnvSvc::DbFidMap

Definition at line 62 of file PoolDbCnvSvc.h.

## Constructor & Destructor Documentation

PoolDbCnvSvc::PoolDbCnvSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc |
| ) |  |  |

Standard constructor.

PoolDbCnvSvc::~PoolDbCnvSvc | ( |  | ) | `[virtual]`

Standard destructor.

Definition at line 97 of file PoolDbCnvSvc.cpp.

References pool::DbInstanceCount::Counter::decrement(), and s_count.

    00097                               {
    00098   s_count->decrement();
    00099 }

## Member Function Documentation

StatusCode PoolDbCnvSvc::updateServiceState | ( | IOpaqueAddress * | pAddress | ) | `[virtual]`

Update state of the service.

Reimplemented from ConversionSvc.

Definition at line 193 of file PoolDbCnvSvc.cpp.

References S_OK.

    00193                                                                         {
    00194   return S_OK;
    00195 }

StatusCode PoolDbCnvSvc::error | ( | const std::string & | msg,
|  | bool | rethrow = `true` |
| ) |  |  |

Standard way to print errors.

after the printout an exception is thrown.

Parameters:

  | msg | [IN] Message string to be printed.
  | rethrow | [IN] Flag to indicate if an exception should be thrown

Returns:
  Status code returning failure.

Referenced by createAddress(), markUpdate(), read(), and setDataProvider().

StatusCode PoolDbCnvSvc::setDataProvider | ( | IDataProviderSvc * | pDataSvc | ) | `[virtual]`

Connect to data provider service.

Re-connects to data manager service.

Parameters:

  | pDataSvc | New data provider object.

Returns:
  Status code indicating success or failure.

Reimplemented from ConversionSvc.

Definition at line 255 of file PoolDbCnvSvc.cpp.

References error(), IID_IDataManagerSvc, StatusCode::isSuccess(), m_dataMgr, IInterface::queryInterface(), IInterface::release(), and ConversionSvc::setDataProvider().

    00255                                                                     {
    00256   IDataManagerSvc* tmp = m_dataMgr;
    00257   if (pDataSvc)  {
    00258     StatusCode status =
    00259       pDataSvc->queryInterface(IID_IDataManagerSvc, pp_cast<void>(&m_dataMgr));
    00260     if ( !status.isSuccess() )    {
    00261       return error("Cannot connect to \"IDataManagerSvc\" interface.");
    00262     }
    00263   }
    00264   if ( tmp ) tmp->release();
    00265   return ConversionSvc::setDataProvider(pDataSvc);
    00266 }

StatusCode PoolDbCnvSvc::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvInterface |
| ) |  |  | `[virtual]`

ConversionSvc overload: Query interface.

Reimplemented from ConversionSvc.

Definition at line 103 of file PoolDbCnvSvc.cpp.

References IInterface::addRef(), IID_IPoolDbMgr, ConversionSvc::queryInterface(), and S_OK.

    00103                                                                            {
    00104   if ( IID_IPoolDbMgr == riid )  {
    00105     *ppvInterface = (IPoolDbMgr*)this;
    00106     addRef();
    00107     return S_OK;
    00108   }
    00109   // Interface is not directly availible: try out a base class
    00110   return ConversionSvc::queryInterface(riid, ppvInterface);
    00111 }

StatusCode PoolDbCnvSvc::initialize | ( |  | ) | `[virtual]`

ConversionSvc overload: initialize Db service.

Reimplemented from ConversionSvc.

Definition at line 114 of file PoolDbCnvSvc.cpp.

References accessStorageType(), PropertyWithValue< TYPE >::assign(), IPoolCacheSvc::callbackHandler(), MSG::DEBUG, endmsg(), endreq(), MSG::ERROR, ConversionSvc::initialize(), StatusCode::isSuccess(), m_cacheSvc, m_cacheSvcName, m_catalog, m_domH, m_implementation, m_ioMgr, ConversionSvc::m_type, Service::messageService(), Service::name(), pool::DbDomain::open(), S_OK, Service::service(), IPoolCacheSvc::session(), pool::DbDomain::setAgeLimit(), pool::UPDATE, and PropertyWithValue< TYPE >::value().

    00114                                      {
    00115   StatusCode status = ConversionSvc::initialize();
    00116   MsgStream log(messageService(), name());
    00117   if ( !status.isSuccess() ) {
    00118     log << MSG::ERROR << "Failed to initialize ConversionSvc base class."
    00119         << endmsg;
    00120     return status;
    00121   }
    00122   status = accessStorageType(m_implementation, m_type);
    00123   if ( !status.isSuccess() )  {
    00124     log << MSG::ERROR << "Failed to connect to POOL implementation:"
    00125         << m_implementation << endmsg;
    00126     return status;
    00127   }
    00128   status = service(m_cacheSvcName, m_cacheSvc);
    00129   if ( !status.isSuccess() )  {
    00130     log << MSG::ERROR << "Failed to connect to POOL cache service:"
    00131         << m_cacheSvcName << endmsg;
    00132     return status;
    00133   }
    00134   status = service("IODataManager", m_ioMgr);
    00135   if( !status.isSuccess() ) {
    00136     log << MSG::ERROR
    00137         << "Unable to localize interface from service:IODataManager" << endreq;
    00138     return status;
    00139   }
    00140   status = service("FileCatalog", m_catalog);
    00141   if( !status.isSuccess() ) {
    00142     log << MSG::ERROR
    00143         << "Unable to localize interface from service:FileCatalog" << endreq;
    00144     return status;
    00145   }
    00146   DbOptionCallback cb(m_cacheSvc->callbackHandler());
    00147   if ( m_domH.open(m_cacheSvc->session(),m_type,pool::UPDATE).isSuccess() )  {
    00148     SmartIF<IProperty> prp(m_ioMgr);
    00149     IntegerProperty ageLimit;
    00150     ageLimit.assign(prp->getProperty("AgeLimit"));
    00151     log << MSG::DEBUG << "POOL agelimit is set to " << ageLimit.value() << endmsg;
    00152     m_domH.setAgeLimit(ageLimit.value());
    00153     return S_OK;
    00154   }
    00155   return S_OK;
    00156 }

StatusCode PoolDbCnvSvc::finalize | ( |  | ) | `[virtual]`

ConversionSvc overload: Finalize Db service.

Reimplemented from ConversionSvc.

Definition at line 159 of file PoolDbCnvSvc.cpp.

References IPoolCacheSvc::callbackHandler(), IDataManagerSvc::clearStore(), pool::DbDomain::close(), MSG::DEBUG, endmsg(), ConversionSvc::finalize(), StatusCode::ignore(), MSG::INFO, StatusCode::isSuccess(), m_cacheSvc, m_catalog, m_dataMgr, m_domH, m_ioMgr, m_shareFiles, Service::messageService(), Service::name(), pool::releasePtr(), and toupper().

    00159                                      {
    00160   MsgStream log(messageService(),name());
    00161   DbOptionCallback cb(m_cacheSvc->callbackHandler());
    00162   if ( m_ioMgr )  {
    00163     if ( ::toupper(m_shareFiles[0]) != 'Y' )  {
    00164       IIODataManager::Connections cons = m_ioMgr->connections(this);
    00165       for(IIODataManager::Connections::iterator i=cons.begin(); i != cons.end(); ++i)  {
    00166         if ( m_ioMgr->disconnect(*i).isSuccess() )  {
    00167           log << MSG::INFO << "Disconnected data IO:" << (*i)->fid();
    00168           log << "[" << (*i)->pfn() << "]";
    00169           log << endmsg;
    00170           delete (*i);
    00171         }
    00172       }
    00173     }
    00174     else  {
    00175       log << MSG::INFO << "File sharing enabled. Do not retire files." << endmsg;
    00176     }
    00177     m_ioMgr->release();
    00178     m_ioMgr = 0;
    00179   }
    00180   m_domH.close();
    00181   m_domH = 0;
    00182   if ( m_dataMgr ) m_dataMgr->clearStore().ignore();
    00183   pool::releasePtr(m_dataMgr);
    00184   pool::releasePtr(m_catalog);
    00185   pool::releasePtr(m_cacheSvc);
    00186   StatusCode status = ConversionSvc::finalize();
    00187   log << MSG::DEBUG << "POOL conversion service finalized " << name() << " ";
    00188   log << (const char*)(status.isSuccess() ? "successfully" : "with errors") << endmsg;
    00189   return status;
    00190 }

IConverter * PoolDbCnvSvc::createConverter | ( | long | typ,
|  | const CLID & | wanted,
|  | const ICnvFactory * | fac |
| ) |  |  | `[virtual]`

ConversionSvc overload: Create new Converter using factory.

Reimplemented from ConversionSvc.

Definition at line 199 of file PoolDbCnvSvc.cpp.

References CLID_Any, CLID_ObjectList, CLID_ObjectVector, endmsg(), std::hex(), MSG::INFO, Service::msgSvc(), Service::name(), POOL_StorageType, Service::serviceLocator(), and std::showbase().

    00200 {
    00201   IConverter* pConverter;
    00202   ConverterID cnvid(POOL_StorageType, wanted);
    00203   pConverter = PluginService::CreateWithId<IConverter*>(cnvid, typ, wanted, serviceLocator());
    00204   if ( 0 == pConverter )  {
    00205     const CLID gen_clids[] = {
    00206     /* ObjectList               */ CLID_Any + CLID_ObjectList,
    00207     /* ObjectVector             */ CLID_Any + CLID_ObjectVector,
    00208     /* Keyed Map                */ CLID_Any + CLID_ObjectVector+0x00030000,
    00209     /* Keyed Hashmap            */ CLID_Any + CLID_ObjectVector+0x00040000,
    00210     /* Keyed redirection array  */ CLID_Any + CLID_ObjectVector+0x00050000,
    00211     /* Standard, non-container  */ CLID_Any
    00212     };
    00213     for ( unsigned int i = 0; i < sizeof(gen_clids)/sizeof(gen_clids[0]); i++ ) {
    00214       if ( (wanted>>16) == (gen_clids[i]>>16) )  {
    00215         ConverterID cnvid(POOL_StorageType, gen_clids[i]);
    00216         pConverter = PluginService::CreateWithId<IConverter*>(cnvid, typ, wanted, serviceLocator());
    00217         if ( 0 != pConverter ) {
    00218           return pConverter;
    00219         }
    00220       }
    00221     }
    00222     // Check if a converter using object update is needed
    00223     if ( (wanted>>24) != 0 )  {
    00224       ConverterID cnvid(POOL_StorageType, CLID_Any | 1<<31);
    00225       pConverter = PluginService::CreateWithId<IConverter*>(cnvid, typ, wanted, serviceLocator());
    00226       if ( 0 != pConverter ) {
    00227         return pConverter;
    00228       }
    00229     }
    00230     // If we do not have found any suitable container after searching
    00231     // for standard containers, we will use the "ANY" converter
    00232     // ... and pray for everything will go well.
    00233     ConverterID cnvid(POOL_StorageType, CLID_Any);
    00234     pConverter = PluginService::CreateWithId<IConverter*>(cnvid, typ, wanted, serviceLocator());
    00235     if ( 0 != pConverter ) {
    00236       MsgStream log(msgSvc(), name());
    00237       log << MSG::INFO << "Using \"Any\" converter "
    00238           << "for objects of type "
    00239           << std::showbase << std::hex << wanted << endmsg;
    00240     }
    00241   }
    00242   return pConverter;
    00243 }

void PoolDbCnvSvc::loadConverter | ( | DataObject * |  | ) | `[virtual]`

ConversionSvc overload: Load the class (dictionary) for the converter.

Reimplemented from ConversionSvc.

Definition at line 245 of file PoolDbCnvSvc.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), MSG::DEBUG, endmsg(), Service::msgSvc(), Service::name(), and System::typeinfoName().

    00245                                                     {
    00246   if (pObject) {
    00247     MsgStream log(msgSvc(), name());
    00248     std::string cname = System::typeinfoName(typeid(*pObject));
    00249     log << MSG::DEBUG << "Trying to 'Autoload' dictionary for class " << cname << endmsg;
    00250     gInterpreter->EnableAutoLoading();
    00251     gInterpreter->AutoLoad(cname.c_str());
    00252   }
    00253 }

virtual IPoolCacheSvc* PoolDbCnvSvc::cacheSvc | ( |  | ) | const`[inline, virtual]`

Access to cache service.

Implements IPoolDbMgr.

Definition at line 157 of file PoolDbCnvSvc.h.

References m_cacheSvc.

    00157 {  return m_cacheSvc; }

virtual StatusCode PoolDbCnvSvc::accessStorageType | ( | const std::string & | type_string,
|  | long & | gaudi_type |
| ) |  |  | `[virtual]`

Create access to the POOL persistency mechanism using the Gaudi String identifier.

Also all appropriate DLLS will be loaded on the fly.

Parameters:

  | type_string | Gaudi storage string identifier
  | gaudi_type | Gaudi storage identifier

Returns:
  Status code indicating failure or success.

Implements IPoolDbMgr.

Referenced by initialize().

virtual StatusCode PoolDbCnvSvc::connectOutput | ( | const std::string & | outputFile,
|  | const std::string & | openMode |
| ) |  |  | `[virtual]`

Connect the output file to the service with open mode.

Parameters:

  | outputFile | String containig output file
  | openMode | String containig opening mode of the output file

Returns:
  Status code indicating success or failure.

Reimplemented from ConversionSvc.

StatusCode PoolDbCnvSvc::connectDatabase | ( | int | typ,
|  | const std::string & | outputFile,
|  | pool::DbAccessMode | openMode,
|  | PoolDbDataConnection ** | con |
| ) |  |  |

Parameters:

  | outputFile | String containig output file

Parameters:

  | openMode | Opening mode of the output file
  | con | Data connection reference

Returns:
  Status code indicating success or failure.

StatusCode PoolDbCnvSvc::connectContainer | ( | pool::DbDatabase & | dbH,
|  | const std::string & | cntName,
|  | pool::DbAccessMode | openMode,
|  | const pool::DbTypeInfo * | shape,
|  | pool::DbContainer & | cntH |
| ) |  |  |

Connect to a database container.

Parameters:

  | dbH | Handle to hosting database
  | cntName | String containing the name of the container object
  | openMode | Open mode (READ,WRITE,UPDATE,...)
  | shape | Default shape of objects in the container
  | cntH | Reference to the POOL container object

Returns:
  Status code indicating success or failure.

Referenced by markUpdate(), and read().

virtual StatusCode PoolDbCnvSvc::connectContainer | ( | int | typ,
|  | const std::string & | dbName,
|  | const std::string & | cntName,
|  | pool::DbAccessMode | openMode,
|  | const pool::DbTypeInfo * | shape,
|  | pool::DbContainer & | cntH |
| ) |  |  | `[virtual]`

Connect to a database container.

Parameters:

  | typ | Database technology type
  | dbName | String containing name of the database
  | cntName | String containing the name of the container object
  | openMode | Open mode (READ,WRITE,UPDATE,...)
  | shape | Default shape of objects in the container
  | cntH | Reference to the POOL container object

Returns:
  Status code indicating success or failure.

Implements IPoolDbMgr.

virtual StatusCode PoolDbCnvSvc::connectOutput | ( | const std::string & | outputFile | ) | `[virtual]`

Connect the output file to the service.

Parameters:

  | outputFile | String containig output file

Returns:
  Status code indicating success or failure.

Reimplemented from ConversionSvc.

virtual StatusCode PoolDbCnvSvc::commitOutput | ( | const std::string & | outputFile,
|  | bool | do_commit |
| ) |  |  | `[virtual]`

Commit pending output.

Parameters:

  | outputFile | String containig output file
  | do_commit | if true commit the output and flush eventually pending items to the database if false, discard pending buffers. Note: The possibility to commit or rollback depends on the database technology used!

Returns:
  Status code indicating success or failure.

Reimplemented from ConversionSvc.

virtual StatusCode PoolDbCnvSvc::connect | ( | const std::string & | dbName,
|  | const std::string & | cntName,
|  | pool::DbContainer & | cntH |
| ) |  |  | `[virtual]`

Connect to a database container in read mode.

Parameters:

  | dbName | String containing name of the database
  | cntName | String containing the name of the container object
  | cntH | Reference to the POOL container object

Returns:
  Status code indicating success or failure.

Implements IPoolDbMgr.

virtual StatusCode PoolDbCnvSvc::disconnect | ( | const std::string & | dbName | ) | `[virtual]`

Disconnect from an existing data stream.

Parameters:

  | dbName | String containing name of the database

Returns:
  Status code indicating success or failure.

Implements IPoolDbMgr.

StatusCode PoolDbCnvSvc::createAddress | ( | long | svc_type,
|  | const CLID & | clid,
|  | const std::string * | par,
|  | const unsigned long * | ip,
|  | IOpaqueAddress *& | refpAddress |
| ) |  |  | `[virtual]`

IAddressCreator implementation: Address creation.

Create an address using the link infotmation together with the triple (database name/container name/object name).

Parameters:

  | refLink | Reference to abstract link information
  | dbName | Database name
  | containerName | Object container name
  | refpAddress | Opaque address information to retrieve object

Returns:
  StatusCode indicating SUCCESS or failure

Reimplemented from ConversionSvc.

Definition at line 467 of file PoolDbCnvSvc.cpp.

References pool::Guid::Data1, error(), std::auto_ptr< _Tp >::get(), pool::Guid::null(), std::auto_ptr< _Tp >::release(), and S_OK.

    00472 {
    00473   PoolDbAddress* pA = 0;
    00474   pool::Guid guid = pool::Guid::null();
    00475   std::auto_ptr<pool::Token> tok(new pool::Token());
    00476   guid.Data1 = clid;
    00477   tok->setDb(par[0]);
    00478   tok->setCont(par[1]);
    00479   tok->setTechnology(typ);
    00480   tok->setClassID(guid);
    00481   tok->oid().first = ip[0];
    00482   tok->oid().second = ip[1];
    00483   if ( createAddress(tok.get(), &pA).isSuccess() )  {
    00484     refpAddress = pA;
    00485     tok->release();
    00486     tok.release();
    00487     return S_OK;
    00488   }
    00489   return error("createAddress> Failed to create opaque address.");
    00490 }

StatusCode PoolDbCnvSvc::createAddress | ( | pool::Token * | pToken,
|  | PoolDbAddress ** | ppAddress |
| ) |  |  | `[virtual]`

IPoolDbMgr implementation: Address creation.

Create an address using an existing POOL token object.

Parameters:

  | pToken | Reference to valid POOL token object.
  | ppAddress | Opaque address information to retrieve object

Returns:
  StatusCode indicating SUCCESS or failure

Implements IPoolDbMgr.

Definition at line 493 of file PoolDbCnvSvc.cpp.

References error(), and S_OK.

    00493                                                                             {
    00494   if ( pTok )  {
    00495     *ppAdd = new PoolDbAddress(pTok);
    00496     return S_OK;
    00497   }
    00498   return error("createAddress> Failed to create opaque address from POOL token.");
    00499 }

virtual pool::DbSelect* PoolDbCnvSvc::createSelect | ( | const std::string & | criteria,
|  | const std::string & | dbName,
|  | const std::string & | cntName |
| ) |  |  | `[virtual]`

Request an iterator over a container from the service.

Parameters:

  | criteria | Selection criteria to restrict iteration
  | dbName | String containing name of the database
  | cntName | String containing the name of the container object

Returns:
  Reference to the selection object

Implements IPoolDbMgr.

virtual StatusCode PoolDbCnvSvc::markWrite | ( | pool::DataCallBack * | call,
|  | const std::string & | cntName,
|  | PoolDbAddress ** | ppAddr = `0` |
| ) |  |  | `[virtual]`

Marks a reference to be written.

Parameters:

  | call | Pointer to callback object
  | cntName | Container name the object should be written to.
  | refpAddr | Persistent object location to be used for link setup.

Returns:
  Status code indicating success or failure.

Implements IPoolDbMgr.

StatusCode PoolDbCnvSvc::markUpdate | ( | pool::DataCallBack * | call,
|  | PoolDbAddress * | pAddr |
| ) |  |  | `[virtual]`

Mark an object for update.

Parameters:

  | call | Pointer to callback object
  | pAddr | Persistent object location to be used for link setup.

Returns:
  Status code indicating success or failure.

Implements IPoolDbMgr.

Definition at line 548 of file PoolDbCnvSvc.cpp.

References connectContainer(), pool::Token::contID(), pool::Token::dbID(), endmsg(), MSG::ERROR, error(), IPoolDbMgr::FID, StatusCode::isSuccess(), m_handler, Service::messageService(), Service::name(), pool::Token::oid(), POOL_StorageType, S_FAIL, S_OK, pool::DataCallBack::setHandler(), pool::DataCallBack::shape(), PoolDbAddress::token(), pool::Token::toString(), and pool::DbContainer::update().

    00548                                                                               {
    00549   if ( pA && call )  {
    00550     pool::Token* tok = pA->token();
    00551     DbContainer cntH(POOL_StorageType);
    00552     const DbTypeInfo* info = (const DbTypeInfo*)call->shape();
    00553     StatusCode sc = connectContainer(FID,tok->dbID(),tok->contID(),pool::UPDATE,info,cntH);
    00554     if ( sc.isSuccess() )  {
    00555       call->setHandler(&m_handler);
    00556       if ( cntH.update(call, tok->oid()).isSuccess() )  {
    00557         return S_OK;
    00558       }
    00559       return error("markUpdate> Failed to update object:"+tok->toString());
    00560     }
    00561     MsgStream log(messageService(), name());
    00562     log << MSG::ERROR << "markUpdate> The container "
    00563         << tok->dbID() << "::" << tok->contID()
    00564         << " cannot be accessed." << endmsg
    00565         << "Was this object really read from the container "
    00566         << "the object token claims?"
    00567         << endmsg;
    00568     return S_FAIL;
    00569   }
    00570   return error("createRep> Invalid object address for update.");
    00571 }

StatusCode PoolDbCnvSvc::read | ( | pool::DataCallBack * | call,
|  | PoolDbAddress * | pAddr |
| ) |  |  | `[virtual]`

Read existing object.

Open transaction in read mode if not active.

Parameters:

  | call | Pointer to callback object
  | pAddr | Pointer to valid object address.

Returns:
  Status code indicating success or failure.

Implements IPoolDbMgr.

Definition at line 574 of file PoolDbCnvSvc.cpp.

References IPoolDbMgr::BAD_DATA_CONNECTION, error(), IRegistry::identifier(), StatusCode::isSuccess(), PoolDbAddress::registry(), and PoolDbAddress::token().

    00574                                                                         {
    00575   StatusCode sc = read(call, *pA->token());
    00576   if ( sc.isSuccess() || sc == BAD_DATA_CONNECTION )  {
    00577     return sc;
    00578   }
    00579   std::string err="read> Cannot read object:"+pA->registry()->identifier()+" ";
    00580   return error(err, false);
    00581 }

StatusCode PoolDbCnvSvc::read | ( | pool::DataCallBack * | call,
|  | pool::Token & | tok |
| ) |  |  | `[virtual]`

Parameters:

  | call | Pointer to callback object

Parameters:

  | tok | Reference to pool token describing the object

Returns:
  Status code indicating success or failure.

Implements IPoolDbMgr.

Definition at line 584 of file PoolDbCnvSvc.cpp.

References IPoolDbMgr::BAD_DATA_CONNECTION, connectContainer(), pool::Token::contID(), pool::Token::dbID(), error(), IPoolDbMgr::FID, StatusCode::isSuccess(), m_handler, S_FAIL, S_OK, pool::DataCallBack::setHandler(), pool::DataCallBack::shape(), pool::Token::technology(), pool::Token::toString(), and std::exception::what().

    00584                                                                      {
    00585   try  {
    00586     DbContainer cntH(tok.technology());
    00587     const DbTypeInfo* info = (const DbTypeInfo*)call->shape();
    00588     StatusCode sc = connectContainer(FID,tok.dbID(),tok.contID(),pool::READ,info,cntH);
    00589     if ( sc.isSuccess() )  {
    00590       typedef pool::DbObjectHandle<pool::DbObject> ObjH;
    00591       call->setHandler(&m_handler);
    00592       return ObjH::openEx(cntH, tok, call, pool::READ).isSuccess() ? S_OK : S_FAIL;
    00593     }
    00594     else if ( sc == BAD_DATA_CONNECTION )  {
    00595       return sc;
    00596     }
    00597   }
    00598   catch (std::exception& e)  {
    00599     std::string err="read> Cannot read object:"+tok.toString()+" ";
    00600     return error(err+e.what(), false);
    00601   }
    00602   catch (...)   {
    00603     std::string err = "read> Cannot read object:"+tok.toString();
    00604     return error(err+" [Unknown fatal exception]", false);
    00605   }
    00606   return error("read> Cannot read object:"+tok.toString(), false);
    00607 }

## Member Data Documentation

std::string PoolDbCnvSvc::m_cacheSvcName`[protected]`

Name of the POOL cache service instance to connect to.

Definition at line 66 of file PoolDbCnvSvc.h.

Referenced by initialize().

std::string PoolDbCnvSvc::m_implementation`[protected]`

Name of the OODataBase implementation.

Definition at line 69 of file PoolDbCnvSvc.h.

Referenced by initialize().

std::string PoolDbCnvSvc::m_serverConnect`[protected]`

Connection string to server.

Definition at line 72 of file PoolDbCnvSvc.h.

bool PoolDbCnvSvc::m_safeTransactions`[protected]`

Flag to indicate safe transactions if requested.

Definition at line 75 of file PoolDbCnvSvc.h.

std::vector<std::string> PoolDbCnvSvc::m_domainOpts`[protected]`

Buffer for domain options.

Definition at line 78 of file PoolDbCnvSvc.h.

std::vector<std::string> PoolDbCnvSvc::m_databaseOpts`[protected]`

Buffer for database options.

Definition at line 81 of file PoolDbCnvSvc.h.

std::vector<std::string> PoolDbCnvSvc::m_containerOpts`[protected]`

Buffer for container options.

Definition at line 84 of file PoolDbCnvSvc.h.

IDataManagerSvc* PoolDbCnvSvc::m_dataMgr`[protected]`

Services needed for proper operation: Data Manager.

Definition at line 87 of file PoolDbCnvSvc.h.

Referenced by finalize(), and setDataProvider().

IPoolCacheSvc* PoolDbCnvSvc::m_cacheSvc`[protected]`

Reference to POOL cache service.

Definition at line 90 of file PoolDbCnvSvc.h.

Referenced by cacheSvc(), finalize(), and initialize().

PoolDbDataConnection* PoolDbCnvSvc::m_current`[protected]`

On writing: reference to active output stream.

Definition at line 93 of file PoolDbCnvSvc.h.

pool::DbDefaultDataHandler PoolDbCnvSvc::m_handler`[protected]`

POOL Datahandler.

Definition at line 96 of file PoolDbCnvSvc.h.

Referenced by markUpdate(), and read().

pool::DbDomain PoolDbCnvSvc::m_domH`[protected]`

POOL technology domain handle.

Definition at line 99 of file PoolDbCnvSvc.h.

Referenced by finalize(), and initialize().

std::string PoolDbCnvSvc::m_shareFiles`[protected]`

Share files ? If set to YES, files will not be closed on finalize.

Definition at line 102 of file PoolDbCnvSvc.h.

Referenced by finalize().

bool PoolDbCnvSvc::m_checkFIDs`[protected]`

Flag to enforce FID checking and verification.

Definition at line 105 of file PoolDbCnvSvc.h.

Gaudi::IFileCatalog* PoolDbCnvSvc::m_catalog`[protected]`

Reference to the file catalog.

Definition at line 108 of file PoolDbCnvSvc.h.

Referenced by finalize(), and initialize().

Gaudi::IIODataManager* PoolDbCnvSvc::m_ioMgr`[protected]`

Reference to the I/O data manager.

Definition at line 111 of file PoolDbCnvSvc.h.

Referenced by finalize(), and initialize().

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiPoolDb/v4r0/GaudiPoolDb/PoolDbCnvSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiPoolDb/v4r0/src/PoolDbCnvSvc.cpp