Commit 6d1e2d4f authored by cvs2svn's avatar cvs2svn
Browse files

This commit was manufactured by cvs2svn to create tag

'GAUDI_v19r3-pre'.

git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/distribution/tags/GAUDI/GAUDI_v19r3-pre@3775 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent dfd0a503
// $Id: IPoolCacheSvc.h,v 1.7 2006/09/28 16:57:55 hmd Exp $
//====================================================================
// IPoolCacheSvc.h
//--------------------------------------------------------------------
//
// Author : M.Frank
//====================================================================
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiPoolDb/GaudiPoolDb/IPoolCacheSvc.h,v 1.7 2006/09/28 16:57:55 hmd Exp $
#ifndef POOLDB_IPOOLCACHESVC_H
#define POOLDB_IPOOLCACHESVC_H
// Framework include files
#include "GaudiKernel/IInterface.h"
#include "StorageSvc/DbSession.h"
// C++ header files
#include <string>
// Forward declarations
namespace pool {
class DbType;
class DbSession;
class IFileCatalog;
class DbOptionCallback;
}
static const InterfaceID IID_IPoolCacheSvc("IPoolCacheSvc", 1 , 0);
/** @class IPoolCacheSvc IPoolCacheSvc.h PoolDb/IPoolCacheSvc.h
*
* Description:
*
* The IPoolCacheSvc service interface allows to access the
* functionality provided by the POOL services. The interface
* allows to access the
*
* - POOL persistency interface.
* - POOL file catalog interface.
* - POOL data service interface.
*
* @author Markus Frank
* @version 1.0
*/
class IPoolCacheSvc : virtual public IInterface
{
public:
/// Retrieve interface ID
static const InterfaceID& interfaceID() { return IID_IPoolCacheSvc; }
/// Check for usage of the GFAL file access
virtual bool useGFAL() const = 0;
/** Check for creating map with bad files.
* Reduces dramatically error printing, because
* for each container an error is only printed once.
*
* @return boolean indicating usage of bad file map.
*/
virtual bool useBadFileMap() const = 0;
/// Age limit of POOL
virtual int ageLimit() const = 0;
/// Access the (single) POOL database session
virtual pool::DbSession& session() = 0;
/// Load dictionary library
/** @param name [IN] dictionary name/file path
*
* @return Status code indicating success or failure
*/
virtual StatusCode loadDictionary(const std::string& name) = 0;
/// Access to the POOL file catalog service
/** @return Reference to the POOL file catalog service
*/
virtual pool::IFileCatalog* catalog() const = 0;
/// Access to POOL callback handler
/** @return Reference to POOL callback handler
*/
virtual pool::DbOptionCallback* callbackHandler() const = 0;
};
#endif // POOLDB_IPOOLCACHESVC_H
// $Id: IPoolDbMgr.h,v 1.4 2006/09/28 16:57:55 hmd Exp $
//====================================================================
// IPoolDbMgr.h
//--------------------------------------------------------------------
//
// Author : M.Frank
//====================================================================
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiPoolDb/GaudiPoolDb/IPoolDbMgr.h,v 1.4 2006/09/28 16:57:55 hmd Exp $
#ifndef POOLDB_IPOOLDBMGR_H
#define POOLDB_IPOOLDBMGR_H
// C/C++ include files
#include <string>
// Framework include files
#include "GaudiKernel/IInterface.h"
#include "GaudiKernel/ClassID.h"
#include "StorageSvc/DbContainer.h"
// Forward declarations
class DataObject;
class PoolDbAddress;
class IOpaqueAddress;
class ContainedObject;
namespace pool {
class DataCallBack;
class DbSelect;
class DbType;
class Token;
class Guid;
}
namespace seal {
namespace reflex {
class Type;
}
};
static const InterfaceID IID_IPoolDbMgr("IPoolDbMgr", 1 , 0);
/** @class IPoolDbMgr IPoolDbMgr.h PoolDb/IPoolDbMgr.h
*
* Description:
*
* The IPoolDbMgr service interface allows to store and
* retrieve data stored with the POOL persistency mechanism.
*
* @author Markus Frank
* @version 1.0
*/
class IPoolDbMgr : virtual public IInterface {
public:
enum { UNKNOWN, FID, LFN, PFN };
enum { BAD_INPUT_FILE=4 };
/// Retrieve interface ID
static const InterfaceID& interfaceID() { return IID_IPoolDbMgr; }
/** Create access to the POOL persistency mechanism using
* the Gaudi String identifier. Also all appropriate DLLS
* will be loaded on the fly.
*
* @param type_string Gaudi storage string identifier
* @param gaudi_type Gaudi storage identifier
*
* @return Status code indicating failure or success.
*/
virtual StatusCode accessStorageType(const std::string& type_string,
long& gaudi_type) = 0;
/** Create a Generic address using explicit arguments to
* identify a single object.
* @param svc_type Technology identifier encapsulated
* in this address.
* @param clid Class identifier of the DataObject
* represented by the opaque address
* @param par Array of strings needed to
* construct the opaque address.
* @param ipar Array of integers needed to
* construct the opaque address.
* @param refpAddress Reference to pointer to the address where the created
* Address should be stored.
*
* @return Status code indicating success or failure.
*/
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.
* @param pToken Pointer to valid POOL token object
* @param ppAddress Reference to pointer to the address where the created
* Address should be stored.
*
* @return Status code indicating success or failure.
*/
virtual StatusCode createAddress(pool::Token* pToken,
PoolDbAddress** ppAddress) = 0;
/** Connect the output file to the service with open mode.
* @param outputFile String containig output file
* @param openMode String containig opening mode of the output file
*
* @return Status code indicating success or failure.
*/
virtual StatusCode connectOutput(const std::string& outputFile,
const std::string& openMode) = 0;
/** Commit pending output.
* @param outputFile String containig output file
* @param 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!
* @return Status code indicating success or failure.
*/
virtual StatusCode commitOutput( const std::string& outputFile,
bool do_commit) = 0;
/** Connect to a database container in read mode.
* @param dbName String containing name of the database
* @param cntName String containing the name of the
* container object
* @param cntH Reference to the POOL container object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode connect(const std::string& dbName,
const std::string& cntName,
pool::DbContainer& cntH) = 0;
/** Connect to a database container
* @param typ Database technology type
* @param dbName String containing name of the database
* @param cntName String containing the name of the
* container object
* @param openMode Open mode (READ,WRITE,UPDATE,...)
* @param shape Default shape of objects in the container
* @param cntH Reference to the POOL container object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode connectContainer(int typ,
const std::string& dbName,
const std::string& cntName,
pool::DbAccessMode openMode,
const pool::DbTypeInfo* shape,
pool::DbContainer& cntH
)=0;
/** Request an iterator over a container from the service
* @param criteria Selection criteria to restrict iteration
* @param dbName String containing name of the database
* @param cntName String containing the name of the
* container object
* @return Reference to the iterator object
*/
virtual pool::DbSelect* createSelect(const std::string& criteria,
const std::string& dbName,
const std::string& cntName) = 0;
/** Disconnect from an existing data stream.
* @param dbName String containing name of the database
*
* @return Status code indicating success or failure.
*/
virtual StatusCode disconnect( const std::string& dbName) = 0;
/** Marks a reference to be written.
* @param call Pointer to callback object
* @param cntName Container name the object should be written to.
* @param refpAddr Persistent object location to be used for
* link setup.
*
* @return Status code indicating success or failure.
*/
virtual StatusCode markWrite( pool::DataCallBack* call,
const std::string& cntName,
PoolDbAddress** ppAddr=0) = 0;
/** Mark an object for update.
* @param call Pointer to callback object
* @param pAddr Persistent object location to be used for
* link setup.
* @return Status code indicating success or failure.
*/
virtual StatusCode markUpdate( pool::DataCallBack* call,
PoolDbAddress* pAddr) = 0;
/** Read existing object. Open transaction in read mode if not active.
* @param call Pointer to callback object
* @param pAddr Pointer to valid object address.
*
* @return Status code indicating success or failure.
*/
virtual StatusCode read( pool::DataCallBack* call,
PoolDbAddress* pAddr) = 0;
/// Read existing object. Open transaction in read mode if not active
/** @param call Pointer to callback object
* @param tok Reference to pool token describing the object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode read( pool::DataCallBack* call,
pool::Token& tok) = 0;
};
#endif // POOLDB_IPOOLDBMGR_H
// $Id: PoolDbAddress.h,v 1.3 2005/09/15 14:48:33 hmd Exp $
//====================================================================
// PoolDbAddress.h
//--------------------------------------------------------------------
//
// Author : M.Frank
//====================================================================
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiPoolDb/GaudiPoolDb/PoolDbAddress.h,v 1.3 2005/09/15 14:48:33 hmd Exp $
#ifndef POOLDB_POOLDBADDRESS_H
#define POOLDB_POOLDBADDRESS_H
// Framework include files
#include "POOLCore/Token.h"
#include "GaudiKernel/IOpaqueAddress.h"
// Forward declarations
namespace pool {
class DataCallBack;
class Token;
}
/** @class PoolDbAddress PoolDbAddress.h PoolDb/PoolDbAddress.h
*
* Description:
*
* Definition of a transient link which is capable of locating
* an object in the persistent storage.
*
* @author M.Frank
* @version 1.0
*/
class PoolDbAddress : virtual public IOpaqueAddress {
protected:
/// Reference count
unsigned long m_refCount;
/// Pointer to corresponding directory
IRegistry* m_pRegistry;
/// String parameters to be accessed
mutable std::string m_par[3];
/// Pointer to call handler
pool::DataCallBack* m_handler;
/// Pointer to POOL token structure
pool::Token* m_token;
public:
/// Full constructor: all arguments MUST be valid, no checks!
PoolDbAddress(pool::Token* aToken);
/// Standard Destructor
virtual ~PoolDbAddress();
/**@name Implementation of IOpaqueAddress interface */
//@{
/// Add reference to object
virtual unsigned long addRef() { return ++m_refCount; }
/// Release reference to object
virtual unsigned long release();
/// Retrieve class ID of the address
const CLID& clID() const { return *(CLID*)&m_token->classID().Data1;}
/// Access : retrieve the storage type of the class id
long svcType() const { return m_token->technology(); }
/// Retrieve string parameters
virtual const std::string* par() const;
/// Retrieve integer parameters
virtual const unsigned long* ipar() const{ return (unsigned long*)&(m_token->oid().first); }
/// Pointer to directory
virtual IRegistry* registry() const { return m_pRegistry; }
//@}
/// Access to POOL data handler (if present)
pool::DataCallBack* handler() const { return m_handler; }
/// Set the POOL data handler; releases existing data handler
void setHandler(pool::DataCallBack* h);
/// Cache handle to container object
pool::Token* token() { return m_token; }
/// Check link for validity
bool isValid() const;
/// Set pointer to directory
virtual void setRegistry(IRegistry* pReg) { m_pRegistry = pReg; }
};
#endif // POOLDB_PoolDbAddress_H
// $Id: PoolDbBaseCnv.h,v 1.6 2006/09/28 16:57:56 hmd Exp $
//====================================================================
// PoolDbBaseCnv definition
//
// Author : M.Frank
//====================================================================
#ifndef POOLDB_POOLDBBASECNV_H
#define POOLDB_POOLDBBASECNV_H
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiPoolDb/GaudiPoolDb/PoolDbBaseCnv.h,v 1.6 2006/09/28 16:57:56 hmd Exp $"
// Framework include files
#include "GaudiKernel/Converter.h"
#include "Reflex/Reflex.h"
#include "POOLCore/Guid.h"
#include <set>
// Forward declarations
class LinkManager;
class IPoolDbMgr;
class IDataManagerSvc;
class ContainedObject;
class PoolDbAddress;
class PoolDbLinkManager;
class PoolDbDataObjectHandler;
namespace pool {
class DataCallBack;
}
/** @class PoolDbBaseCnv PoolDbBaseCnv.h PoolDb/PoolDbBaseCnv.h
*
* Description:
* Definition of the generic Db data converter.
* The generic data converter provides the infrastructure
* of all data converters. The templated class takes two arguments:
* The Transient and the Persistent object type.
*
* For a detailed description of the overridden function see the the
* base class.
*
* @author M.Frank
* @version 1.0
*/
class PoolDbBaseCnv : public Converter {
protected:
/// Services needed for proper operation: POOL database manager
IPoolDbMgr* m_dbMgr;
/// Services needed for proper operation: Gaudi datastore manager
IDataManagerSvc* m_dataMgr;
/// Object Guid
pool::Guid m_objGuid;
/// Reference to seal reflection class
ROOT::Reflex::Type m_class;
/// Definition callback
pool::DataCallBack* m_call;
/// Set with bad files/tables
std::set<std::string> m_badFiles;
protected:
/** Standard way to print errors. after the printout an exception is thrown.
* @param msg [IN] Message string to be printed.
* @param rethrow [IN] Flag to indicate if an exception must be thrown
*
* @return Status code returning failure.
*/
StatusCode makeError(const std::string& msg, bool rethrow=true);
/** Retrieve the name of the container a given object is placed into
* @param pReg [IN] Pointer to registry entry.
*
* @return Name of the container the object should be put to.
*/
virtual const std::string containerName(IRegistry* pReg) const;
public:
/** Initializing Constructor
* @param typ [IN] Concrete storage type of the converter
* @param clid [IN] Class identifier of the object
* @param svc [IN] Pointer to service locator object
*
* @return Reference to PoolDbBaseCnv object
*/
PoolDbBaseCnv(long typ, const CLID& clid, ISvcLocator* svc);
/// Standard Destructor
virtual ~PoolDbBaseCnv();
/// Converter overrides: Initialize the Db converter
virtual StatusCode initialize();
/// Converter overrides: Finalize the Db data converter
virtual StatusCode finalize();
/// Retrieve the class type of the data store the converter uses.
virtual long repSvcType() const {
return i_repSvcType();
}
/** Converter overrides: Create transient object from persistent data
*
* @param pAddr [IN] Pointer to object address.
* @param refpObj [OUT] Location to pointer to store data object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode createObj( IOpaqueAddress* pAddr,
DataObject*& refpObj);
/** Converter overrides: Resolve the references
* of the created transient object.
*
* @param pAddr [IN] Pointer to object address.
* @param pObj [IN] Pointer to data object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode fillObjRefs( IOpaqueAddress* pAddr,
DataObject* pObj);
/** Converter overrides: Update transient object from persistent data
*
* @param pAddr [IN] Pointer to object address.
* @param pObj [IN] Pointer to data object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode updateObj( IOpaqueAddress* pAddr,
DataObject* pObj);
/** Converter overrides: Update the references of
* an updated transient object.
*
* @param pAddr [IN] Pointer to object address.
* @param pObj [IN] Pointer to data object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode updateObjRefs( IOpaqueAddress* pAddr,
DataObject* pObj);
/** Converter overrides: Convert the transient object to the
* requested representation.
*
* @param pObj [IN] Pointer to data object
* @param refpAddr [OUT] Location to store pointer to object address.
*
* @return Status code indicating success or failure.
*/
virtual StatusCode createRep( DataObject* pObj,
IOpaqueAddress*& refpAddr);
/** Converter overrides: Resolve the references of the converted object.
*
* @param pAddr [IN] Pointer to object address.
* @param pObj [IN] Pointer to data object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode fillRepRefs( IOpaqueAddress* pAddr,
DataObject* pObj);
/** Converter overrides: Update the converted representation
* of a transient object.
*
* @param pAddr [IN] Pointer to object address.
* @param pObj [IN] Pointer to data object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode updateRep( IOpaqueAddress* pAddr,
DataObject* pObj);
/** Converter overrides: Update the references of an
* already converted object.
*
* @param pAddr [IN] Pointer to object address.
* @param pObj [IN] Pointer to data object
*
* @return Status code indicating success or failure.
*/
virtual StatusCode updateRepRefs( IOpaqueAddress* pAddr,
DataObject* pObj);
virtual PoolDbLinkManager* createReferences(DataObject* pObj);
/** Set the references of a DataObject when reading.
* @param pMgr [IN] Pointer to POOL Link manager object
* @param pLinks [IN] Pointer to intermediate link manager
* @param pObj [IN] Pointer to data object
* @param pReg [IN] Pointer to registry entry
*
* @return Status code indicating success or failure.
*/
virtual StatusCode setReferences(PoolDbLinkManager* pMgr,
LinkManager* pLinks,
DataObject* pObj,
IRegistry* pReg);
/** Dump the references of a DataObject after writing.
* @param pMgr [IN] Pointer to POOL Link manager object
* @param pLinks [IN] Pointer to intermediate link manager
* @param pObj [IN] Pointer to data object
* @param pReg [IN] Pointer to registry entry
*
* @return Status code indicating success or failure.
*/
virtual StatusCode dumpReferences(PoolDbLinkManager* pMgr,
LinkManager* pLinks,
DataObject* pObj,
IRegistry* pReg);
};
#endif // POOLDB_PoolDbBaseCnv_H
// $Id: PoolDbCacheSvc.h,v 1.8 2007/02/08 10:12:13 hmd Exp $
//====================================================================
// PoolCacheMgr.h
//--------------------------------------------------------------------
//
// Author : M.Frank
//====================================================================
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiPoolDb/GaudiPoolDb/PoolDbCacheSvc.h,v 1.8 2007/02/08 10:12:13 hmd Exp $
#ifndef POOLDB_POOLDBCACHESVC_H
#define POOLDB_POOLDBCACHESVC_H
// Framework include files
#include "StorageSvc/DbOptionCallback.h"
#include "StorageSvc/DbSession.h"
#include "GaudiPoolDb/IPoolCacheSvc.h"
#include "GaudiKernel/Service.h"
#include "GaudiKernel/System.h"
// STL include files
#include <vector>
// Forward declarations
namespace seal { class SharedLibrary; }