CMTPObjectStore Class Reference

class CMTPObjectStore : public CBase

Implements the MTP object meta data store, which manages the storage/mapping of object handle and suid, and puid using DMBS. Note, the CMTPObjectMgr acts as a shim class which forwards all the requests to the CMTPObjectStore . The reason is that later on, the class CMTPObjectStore will also implement the reference manager and puid manager functionalities. Having a single class implements all these will enable us to use a single database with multiple tables.

Inherits from

Public Member Functions
~CMTPObjectStore ()
void BeginTransactionL ()
void CalcFreeHandlesL ( TUint )
void CleanDBSnapshotL ( TBool )
void CleanL ()
void CommitReservedObjectHandleL ( CMTPObjectMetaData &)
void CommitTransactionL ()
TUint CountL (const TMTPObjectMgrQueryParams &)
CMTPDPIDStore & DPIDStore ()
RDbDatabase & Database ()
void EstablishDBSnapshotL ( TUint32 )
void GetObjectHandlesL (const TMTPObjectMgrQueryParams &, RMTPObjectMgrQueryContext &, RArray < TUint > &)
void GetObjectSuidsL (const TMTPObjectMgrQueryParams &, RMTPObjectMgrQueryContext &, CDesCArray &)
TUint32 HandleL (const TDesC &)
TUint32 HandleL ( TUint32 , const TDesC &)
void IncTranOpsNumL ()
void InsertObjectL ( CMTPObjectMetaData &)
void InsertObjectsL ( RPointerArray < CMTPObjectMetaData > &)
TBool IsMediaFormat ( TUint32 )
void MarkDPLoadedL ( TUint , TBool )
void MarkNonPersistentObjectsL ( TUint , TUint32 )
void ModifyObjectL (const CMTPObjectMetaData &)
CMtpDeltaDataMgr * MtpDeltaDataMgr ()
CMTPObjectStore * NewL ()
TBool ObjectExistsL (const TUint32 )
TBool ObjectL (const TMTPTypeUint32 &, CMTPObjectMetaData &)
TBool ObjectL (const TDesC &, CMTPObjectMetaData &)
TUint ObjectOwnerId (const TMTPTypeUint32 &)
const TPtrC ObjectSuidL ( TUint32 )
void ObjectsEnumComplete ()
CMTPPkgIDStore & PkgIDStore ()
TMTPTypeUint128 PuidL (const TUint32 )
TMTPTypeUint128 PuidL (const TDesC &)
CMTPReferenceMgr & ReferenceMgr ()
void RemoveNonPersistentObjectsL ( TUint )
void RemoveObjectL (const TMTPTypeUint32 &)
void RemoveObjectL (const TDesC &)
void RemoveObjectsByStorageIdL ( TUint32 )
void RemoveObjectsL (const CDesCArray &)
void RemoveObjectsL ( TUint )
void RemoveUndefinedObjectsL ()
void ReserveObjectHandleL ( CMTPObjectMetaData &, TUint64 )
void RestorePersistentObjectsL ( TUint )
void TraverseL (const TMTPObjectMgrQueryParams &, MTraverseAction &)
void UnreserveObjectHandleL (const CMTPObjectMetaData &)
Private Member Functions
CMTPObjectStore ()
void BuildObjectMetaDataL ( CMTPObjectMetaData &, const RDbTable &)
void CloseDb ()
void ConstructL ()
void CreateDbL (const TDesC &)
void CreateHandleIndexL ()
void CreateHandleTableL ()
void CreateStorageIndexL ()
void CreateStorageTableL ()
void DBUpdateFailRecover ( TAny *)
void DbColReadStreamL (const RDbTable &, TDbColNo , TDes16 &)
void DbColWriteStreamL ( RDbTable &, TDbColNo , const TDesC16 &)
TBool FilterObject (const RDbTable &, const TUint32 , const TUint32 , const TUint32 )
void GetFullPathName (const TDesC &, TFileName &)
TBool GetObjectL ( TUint32 , CMTPObjectMetaData &)
void InitializeDbL ()
TBool IsInvalidHandle ( TUint32 )
TBool LocateByHandleL (const TUint , const TBool )
TBool LocateBySuidL (const TDesC &)
TInt OpenDb (const TDesC &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enum TObjectStore {
EObjectStoreHandleId  = 1, EObjectStoreSUIDHash  = 2, EObjectStoreSUID  = 3, EObjectStoreDataProviderId  = 4, EObjectStoreFormatCode  = 5, EObjectStoreFormatSubCode  = 6, EObjectStoreStorageId  = 7, EObjectStoreModes  = 8, EObjectStorePOUID  = 9, EObjectStoreParentHandle  = 10, EObjectStoreDPFlag  = 11, EObjectStoreNonConsumable  = 12, EObjectStoreName  = 13
}
Private Attributes
const TUint KQueryWindowForeSlots
const TUint KQueryWindowRearSlots
__FLOG_DECLARATION_MEMBER_MUTABLE
RDbTable iBatched
RDbTable iBatched_SuidHashID
TBool iCacheExist
TUint32 iCachedHandle
TUint32 iCachedSuidHash
TBool iCleanUndefined
CDbCompactor * iCompactor
CMTPDPIDStore * iDPIDStore
RDbNamedDatabase iDatabase
RPointerArray < CEnumertingCacheItem > iEnumeratingCacheObjList
CMTPHandleAllocator * iHandleAllocator
TUint32 iMaxCommitLimit
TUint32 iMaxCompactLimit
CMtpDeltaDataMgr * iMtpDeltaDataMgr
RArray < TUint > iNonPersistentDPList
CMTPPkgIDStore * iPkgIDStore
CMTPReferenceMgr * iReferenceMgr
CEnumertingCacheItem * iSentinal
RMTPFramework iSingletons
TInt iSnapshotCleanPos
CSnapshotWorker * iSnapshotWorker
TBuf < KMTPMaxSqlStatementLen > iSqlStatement
TFileName iSuidBuf
TUint32 iTransactionOps
TBool iUpdateDeltaDataTable

Constructor & Destructor Documentation

CMTPObjectStore()

CMTPObjectStore ( ) [private]

Standard c++ constructor

~CMTPObjectStore()

~CMTPObjectStore ( )

Destructor.

Member Functions Documentation

BeginTransactionL()

void BeginTransactionL ( )

BuildObjectMetaDataL(CMTPObjectMetaData &, const RDbTable &)

void BuildObjectMetaDataL ( CMTPObjectMetaData & aBuf,
const RDbTable & aTable
) const [private]

Parameters

CMTPObjectMetaData & aBuf
const RDbTable & aTable

CalcFreeHandlesL(TUint)

void CalcFreeHandlesL ( TUint aDataProviderId )

Parameters

TUint aDataProviderId

CleanDBSnapshotL(TBool)

void CleanDBSnapshotL ( TBool aOnlyRoot = EFalse )

Parameters

TBool aOnlyRoot = EFalse

CleanL()

void CleanL ( )

Clean unloaded data provider contents from object store

CloseDb()

void CloseDb ( ) [private]

Close the current opened database

CommitReservedObjectHandleL(CMTPObjectMetaData &)

void CommitReservedObjectHandleL ( CMTPObjectMetaData & aObject )

Parameters

CMTPObjectMetaData & aObject

CommitTransactionL()

void CommitTransactionL ( )

ConstructL()

void ConstructL ( ) [private]

Second phase constructor.

CountL(const TMTPObjectMgrQueryParams &)

TUint CountL ( const TMTPObjectMgrQueryParams & aParams ) const

Parameters

const TMTPObjectMgrQueryParams & aParams

CreateDbL(const TDesC &)

void CreateDbL ( const TDesC & aFileName ) [private]

Create the database with the specified database name

Parameters

const TDesC & aFileName The name of the database to create

CreateHandleIndexL()

void CreateHandleIndexL ( ) [private]

Create three index on the table: 1. Handle, 2. SuidHash, 3. ParentHandle

CreateHandleTableL()

void CreateHandleTableL ( ) [private]

Create the table for storing the mapping from object handle to other properties (data provider id, storage id, formatcode, etc.)

CreateStorageIndexL()

void CreateStorageIndexL ( ) [private]

CreateStorageTableL()

void CreateStorageTableL ( ) [private]

DBUpdateFailRecover(TAny *)

void DBUpdateFailRecover ( TAny * aTable ) [private, static]

Parameters

TAny * aTable

DPIDStore()

CMTPDPIDStore & DPIDStore ( ) const

Provides a reference to the DPID store object.

Database()

RDbDatabase & Database ( )

Provides a reference to the object meta data store database.

DbColReadStreamL(const RDbTable &, TDbColNo, TDes16 &)

void DbColReadStreamL ( const RDbTable & aTable,
TDbColNo aCol,
TDes16 & aDes
) const [private]

Parameters

const RDbTable & aTable
TDbColNo aCol
TDes16 & aDes

DbColWriteStreamL(RDbTable &, TDbColNo, const TDesC16 &)

void DbColWriteStreamL ( RDbTable & aTable,
TDbColNo aCol,
const TDesC16 & aDes
) [private]

Parameters

RDbTable & aTable
TDbColNo aCol
const TDesC16 & aDes

EstablishDBSnapshotL(TUint32)

void EstablishDBSnapshotL ( TUint32 aStorageId )

Parameters

TUint32 aStorageId

FilterObject(const RDbTable &, const TUint32, const TUint32, const TUint32)

TBool FilterObject ( const RDbTable & aCurrRow,
const TUint32 aStorageID,
const TUint32 aFormatCode,
const TUint32 aDpID
) const [private]

Parameters

const RDbTable & aCurrRow
const TUint32 aStorageID
const TUint32 aFormatCode
const TUint32 aDpID

GetFullPathName(const TDesC &, TFileName &)

void GetFullPathName ( const TDesC & aName,
TFileName & aFileName
) const [private]

Get the full path of the database

Parameters

const TDesC & aName
TFileName & aFileName The file name of the database to be retrieved

GetObjectHandlesL(const TMTPObjectMgrQueryParams &, RMTPObjectMgrQueryContext &, RArray< TUint > &)

void GetObjectHandlesL ( const TMTPObjectMgrQueryParams & aParams,
RMTPObjectMgrQueryContext & aContext,
RArray < TUint > & aHandles
) const

Parameters

const TMTPObjectMgrQueryParams & aParams
RMTPObjectMgrQueryContext & aContext
RArray < TUint > & aHandles

GetObjectL(TUint32, CMTPObjectMetaData &)

TBool GetObjectL ( TUint32 aHandle,
CMTPObjectMetaData & aObject
) const [private]

Get an object for the current query

Parameters

TUint32 aHandle
CMTPObjectMetaData & aObject

GetObjectSuidsL(const TMTPObjectMgrQueryParams &, RMTPObjectMgrQueryContext &, CDesCArray &)

void GetObjectSuidsL ( const TMTPObjectMgrQueryParams & aParams,
RMTPObjectMgrQueryContext & aContext,
CDesCArray & aSuids
) const

Parameters

const TMTPObjectMgrQueryParams & aParams
RMTPObjectMgrQueryContext & aContext
CDesCArray & aSuids

HandleL(const TDesC &)

TUint32 HandleL ( const TDesC & aSuid ) const

Parameters

const TDesC & aSuid

HandleL(TUint32, const TDesC &)

TUint32 HandleL ( TUint32 aSuidHash,
const TDesC & aSuid
) const

Parameters

TUint32 aSuidHash
const TDesC & aSuid

IncTranOpsNumL()

void IncTranOpsNumL ( )

InitializeDbL()

void InitializeDbL ( ) [private]

Initialises the database, it creates the table and index if the database does not exist, otherwise, it open the existing table and index

InsertObjectL(CMTPObjectMetaData &)

void InsertObjectL ( CMTPObjectMetaData & aObject )

Parameters

CMTPObjectMetaData & aObject

InsertObjectsL(RPointerArray< CMTPObjectMetaData > &)

void InsertObjectsL ( RPointerArray < CMTPObjectMetaData > & aObjects )

Parameters

RPointerArray < CMTPObjectMetaData > & aObjects

IsInvalidHandle(TUint32)

TBool IsInvalidHandle ( TUint32 aHandle ) const [private]

Parameters

TUint32 aHandle

IsMediaFormat(TUint32)

TBool IsMediaFormat ( TUint32 aFormatCode )

Determine if the object is of WMP supported media format

Parameters

TUint32 aFormatCode

LocateByHandleL(const TUint, const TBool)

TBool LocateByHandleL ( const TUint aHandle,
const TBool aReadTable = ETrue
) const [private]

Parameters

const TUint aHandle
const TBool aReadTable = ETrue

LocateBySuidL(const TDesC &)

TBool LocateBySuidL ( const TDesC & aSuid ) const [private]

Parameters

const TDesC & aSuid

MarkDPLoadedL(TUint, TBool)

void MarkDPLoadedL ( TUint aDataProviderId,
TBool aFlag
)

Parameters

TUint aDataProviderId
TBool aFlag

MarkNonPersistentObjectsL(TUint, TUint32)

void MarkNonPersistentObjectsL ( TUint aDataProviderId,
TUint32 aStorageId
)

Parameters

TUint aDataProviderId
TUint32 aStorageId

ModifyObjectL(const CMTPObjectMetaData &)

void ModifyObjectL ( const CMTPObjectMetaData & aObject )

Parameters

const CMTPObjectMetaData & aObject

MtpDeltaDataMgr()

CMtpDeltaDataMgr * MtpDeltaDataMgr ( ) const

Provides a reference to the MTP delta Data manager object.

NewL()

CMTPObjectStore * NewL ( ) [static]
MTP object meta data store factory method.
leave
One of the system wide error codes, if a processing failure occurs.

ObjectExistsL(const TUint32)

TBool ObjectExistsL ( const TUint32 aHandle )

Parameters

const TUint32 aHandle

ObjectL(const TMTPTypeUint32 &, CMTPObjectMetaData &)

TBool ObjectL ( const TMTPTypeUint32 & aHandle,
CMTPObjectMetaData & aObject
) const

Parameters

const TMTPTypeUint32 & aHandle
CMTPObjectMetaData & aObject

ObjectL(const TDesC &, CMTPObjectMetaData &)

TBool ObjectL ( const TDesC & aSuid,
CMTPObjectMetaData & aObject
) const

Parameters

const TDesC & aSuid
CMTPObjectMetaData & aObject

ObjectOwnerId(const TMTPTypeUint32 &)

TUint ObjectOwnerId ( const TMTPTypeUint32 & aHandle ) const

Parameters

const TMTPTypeUint32 & aHandle

ObjectSuidL(TUint32)

const TPtrC ObjectSuidL ( TUint32 aHandle ) const

Parameters

TUint32 aHandle

ObjectsEnumComplete()

void ObjectsEnumComplete ( )

OpenDb(const TDesC &)

TInt OpenDb ( const TDesC & aFileName ) [private]

Open the database with the specified database name

Parameters

const TDesC & aFileName The name of the database to open

PkgIDStore()

CMTPPkgIDStore & PkgIDStore ( ) const

PuidL(const TUint32)

TMTPTypeUint128 PuidL ( const TUint32 aHandle )

Parameters

const TUint32 aHandle

PuidL(const TDesC &)

TMTPTypeUint128 PuidL ( const TDesC & aSuid )

Parameters

const TDesC & aSuid

ReferenceMgr()

CMTPReferenceMgr & ReferenceMgr ( ) const

Provides a reference to the reference manager object.

RemoveNonPersistentObjectsL(TUint)

void RemoveNonPersistentObjectsL ( TUint aDataProviderId )

Parameters

TUint aDataProviderId

RemoveObjectL(const TMTPTypeUint32 &)

void RemoveObjectL ( const TMTPTypeUint32 & aHandle )

Parameters

const TMTPTypeUint32 & aHandle

RemoveObjectL(const TDesC &)

void RemoveObjectL ( const TDesC & aSuid )

Parameters

const TDesC & aSuid

RemoveObjectsByStorageIdL(TUint32)

void RemoveObjectsByStorageIdL ( TUint32 aStorageId )

Parameters

TUint32 aStorageId

RemoveObjectsL(const CDesCArray &)

void RemoveObjectsL ( const CDesCArray & aSuids )

Parameters

const CDesCArray & aSuids

RemoveObjectsL(TUint)

void RemoveObjectsL ( TUint aDataProviderId )

Parameters

TUint aDataProviderId

RemoveUndefinedObjectsL()

void RemoveUndefinedObjectsL ( )

ReserveObjectHandleL(CMTPObjectMetaData &, TUint64)

void ReserveObjectHandleL ( CMTPObjectMetaData & aObject,
TUint64 aSpaceRequired
)

Parameters

CMTPObjectMetaData & aObject
TUint64 aSpaceRequired

RestorePersistentObjectsL(TUint)

void RestorePersistentObjectsL ( TUint aDataProviderId )

Initialize the handle allocator for this DP with the minimum object ID to use. This must not be called while an initiator has an open session or it could cause an object ID to be reused.

Parameters

TUint aDataProviderId Data provider ID whose handle allocator must be initialized

TraverseL(const TMTPObjectMgrQueryParams &, MTraverseAction &)

void TraverseL ( const TMTPObjectMgrQueryParams & aParams,
MTraverseAction & action
) const

Parameters

const TMTPObjectMgrQueryParams & aParams
MTraverseAction & action

UnreserveObjectHandleL(const CMTPObjectMetaData &)

void UnreserveObjectHandleL ( const CMTPObjectMetaData & aObject )

Parameters

const CMTPObjectMetaData & aObject

Member Enumerations Documentation

Enum TObjectStore

Enumeration representing the column fields in the object store DBMS, this definition must exactly match the sequence defined in KSQLCreateHandleTableText During insert a object, only the following items is provided in the CMTPObjectMetaData DPId Format FormatSubcode StorageID Modes ParentHandle

Handle is allocated by MTP framework NonConsumable is inserted only by FileDP, for objects manged by LicenseeDP, its values is meaningless

Enumerators

EObjectStoreHandleId = 1
EObjectStoreSUIDHash = 2
EObjectStoreSUID = 3
EObjectStoreDataProviderId = 4
EObjectStoreFormatCode = 5
EObjectStoreFormatSubCode = 6
EObjectStoreStorageId = 7
EObjectStoreModes = 8
EObjectStorePOUID = 9
EObjectStoreParentHandle = 10
EObjectStoreDPFlag = 11
EObjectStoreNonConsumable = 12
EObjectStoreName = 13

Member Data Documentation

const TUint KQueryWindowForeSlots

const TUint KQueryWindowForeSlots [private, static]

const TUint KQueryWindowRearSlots

const TUint KQueryWindowRearSlots [private, static]

__FLOG_DECLARATION_MEMBER_MUTABLE

__FLOG_DECLARATION_MEMBER_MUTABLE [private]

FLOGGER debug trace member variable.

RDbTable iBatched

RDbTable iBatched [private]

RDbTable iBatched_SuidHashID

RDbTable iBatched_SuidHashID [private]

TBool iCacheExist

TBool iCacheExist [private]

TUint32 iCachedHandle

TUint32 iCachedHandle [private]

TUint32 iCachedSuidHash

TUint32 iCachedSuidHash [private]

TBool iCleanUndefined

TBool iCleanUndefined [private]

CDbCompactor * iCompactor

CDbCompactor * iCompactor [private]

CMTPDPIDStore * iDPIDStore

CMTPDPIDStore * iDPIDStore [private]

RDbNamedDatabase iDatabase

RDbNamedDatabase iDatabase [private]

RPointerArray< CEnumertingCacheItem > iEnumeratingCacheObjList

RPointerArray < CEnumertingCacheItem > iEnumeratingCacheObjList [private]

CMTPHandleAllocator * iHandleAllocator

CMTPHandleAllocator * iHandleAllocator [private]

TUint32 iMaxCommitLimit

TUint32 iMaxCommitLimit [private]

TUint32 iMaxCompactLimit

TUint32 iMaxCompactLimit [private]

CMtpDeltaDataMgr * iMtpDeltaDataMgr

CMtpDeltaDataMgr * iMtpDeltaDataMgr [private]

RArray< TUint > iNonPersistentDPList

RArray < TUint > iNonPersistentDPList [private]

CMTPPkgIDStore * iPkgIDStore

CMTPPkgIDStore * iPkgIDStore [private]

CMTPReferenceMgr * iReferenceMgr

CMTPReferenceMgr * iReferenceMgr [private]

CEnumertingCacheItem * iSentinal

CEnumertingCacheItem * iSentinal [private]

RMTPFramework iSingletons

RMTPFramework iSingletons [private]

TInt iSnapshotCleanPos

TInt iSnapshotCleanPos [private]

CSnapshotWorker * iSnapshotWorker

CSnapshotWorker * iSnapshotWorker [private]

TBuf< KMTPMaxSqlStatementLen > iSqlStatement

TBuf < KMTPMaxSqlStatementLen > iSqlStatement [private]

TFileName iSuidBuf

TFileName iSuidBuf [private]

TUint32 iTransactionOps

TUint32 iTransactionOps [private]

TBool iUpdateDeltaDataTable

TBool iUpdateDeltaDataTable [private]