mtpfws/mtpfw/dataproviders/dputility/inc/cmtpknowledgehandler.h
changeset 0 d0791faffa3f
child 1 f8e15b44d440
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // mw/remoteconn/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpknowledgehandler.h
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19  */
       
    20 
       
    21 #ifndef __CMTPKNOWLEDGEHANDLER_H__
       
    22 #define __CMTPKNOWLEDGEHANDLER_H__
       
    23 
       
    24 #include <mtp/cmtptypeserviceproplist.h>
       
    25 #include <mtp/mtpprotocolconstants.h>
       
    26 
       
    27 #include "mtpdebug.h"
       
    28 #include "mtpsvcdpconst.h"
       
    29 #include "mmtpsvcobjecthandler.h"
       
    30 
       
    31 class CMTPTypeFile;
       
    32 class CRepository;
       
    33 
       
    34 /** 
       
    35 Controls access to the knowledge object.
       
    36 @internalComponent
       
    37 */
       
    38 class CMTPKnowledgeHandler : public CBase, public MMTPSvcObjectHandler
       
    39 	{
       
    40 public:
       
    41 	// Basic function
       
    42 	IMPORT_C static CMTPKnowledgeHandler* NewL(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, CRepository& aReposotry, const TDesC& aKwgSuid);
       
    43 	IMPORT_C ~CMTPKnowledgeHandler();
       
    44 
       
    45 	
       
    46 	IMPORT_C void SetStorageId(TUint32 aStorageId);
       
    47 	IMPORT_C void GetObjectSuidL(TDes& aSuid) const;
       
    48 
       
    49 protected:
       
    50 	// MMTPSvcObjectHandler
       
    51 	TMTPResponseCode SendObjectInfoL(const CMTPTypeObjectInfo& aObjectInfo, TUint32& aParentHandle, TDes& aSuid);
       
    52 	TMTPResponseCode GetObjectInfoL(const CMTPObjectMetaData& aObjectMetaData, CMTPTypeObjectInfo& aObjectInfo);
       
    53 
       
    54 	TMTPResponseCode SendObjectPropListL(TUint64 aObjectSize, const CMTPTypeObjectPropList& aObjectPropList, TUint32& aParentHandle, TDes& aSuid);
       
    55 	TMTPResponseCode SetObjectPropertyL(const TDesC& aSuid, const CMTPTypeObjectPropListElement& aElement, TMTPOperationCode aOperationCode);
       
    56 	TMTPResponseCode GetObjectPropertyL(const CMTPObjectMetaData& aObjectMetaData, TUint16 aPropertyCode, CMTPTypeObjectPropList& aPropList);
       
    57 	TMTPResponseCode DeleteObjectPropertyL(const CMTPObjectMetaData& aObjectMetaData, const TUint16 aPropertyCode);
       
    58 
       
    59 	TMTPResponseCode GetBufferForSendObjectL(const CMTPObjectMetaData& aObjectMetaData, MMTPType** aBuffer);
       
    60 	TMTPResponseCode GetObjectL(const CMTPObjectMetaData& aObjectMetaData, MMTPType** aBuffer);
       
    61 	TMTPResponseCode DeleteObjectL(const CMTPObjectMetaData& aObjectMetaData);
       
    62 
       
    63 	TMTPResponseCode GetObjectSizeL(const TDesC& aSuid, TUint64& aObjectSize);
       
    64 	TMTPResponseCode GetAllObjectPropCodeByGroupL(TUint32 aGroupId, RArray<TUint32>& aPropCodes);
       
    65 	
       
    66 	void CommitL();
       
    67 	void CommitForNewObjectL(TDes& aSuid);
       
    68 	void RollBack();
       
    69 	void ReleaseObjectBuffer();	
       
    70 
       
    71 	enum TCacheStatus
       
    72 		{
       
    73 		EOK,
       
    74 		EDirty,
       
    75 		EDeleted
       
    76 		};
       
    77 	//key of central repository
       
    78 	enum TMTPKnowledgeStoreKeyNum
       
    79 		{
       
    80 		ESize = 0x10001, 
       
    81 		EDateModified = 0x10002,
       
    82 		EName = 0x10003,
       
    83 		ELastAuthorProxyID = 0x10004
       
    84 		};
       
    85 	
       
    86 	TMTPResponseCode SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData);
       
    87 
       
    88 private:
       
    89 	CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework,TUint16 aFormatCode, CRepository& aReposotry, const TDesC& aKwgSuid);
       
    90 	void ConstructL();
       
    91 	
       
    92 	/**
       
    93 	Get the value from the central repository
       
    94 	@leave One of the system wide error codes, if repository get value fail
       
    95 	*/
       
    96 	void LoadKnowledgeObjPropertiesL();
       
    97 	/**
       
    98 	Cleanup Item operation for drop all knowledge properties
       
    99 	*/
       
   100 	static void DropCacheWrapper(TAny* aObject);
       
   101 	void DropKnowledgeObjPropertiesCache();
       
   102 	/**
       
   103 	Helper for GetObjectInfo request handling
       
   104 	*/
       
   105 	void BuildObjectInfoL(CMTPTypeObjectInfo& aObjectInfo) const;
       
   106 	/**
       
   107 	Delete knowledge object properties and content
       
   108 	@leave One of the system wide error codes, if repository set value fail
       
   109 	*/
       
   110 	void DeleteAllObjectPropertiesL();
       
   111 	
       
   112 private:
       
   113 	MMTPDataProviderFramework&  iFramework;
       
   114 	CRepository&                iRepository;
       
   115 	TUint32                     iStorageID;
       
   116 	TUint16                     iKnowledgeFormatCode;
       
   117 	TUint64                     iKnowledgeObjectSize; 
       
   118 	HBufC*                      iDateModified;
       
   119 	HBufC*                      iName;
       
   120 	TMTPTypeUint128             iLastAuthorProxyID;
       
   121 	TCacheStatus                iCacheStatus;
       
   122 	TCacheStatus                iCacheStatusFlag;
       
   123 	TFileName                   iKnowObjFileName;
       
   124 	TFileName                   iKnowObjSwpFileName;
       
   125 	// Knowledge object content file
       
   126 	CMTPTypeFile*               iKnowledgeObj;
       
   127 	// Knowledge object swap file
       
   128 	CMTPTypeFile*               iKnowledgeSwpBuffer;
       
   129 	const TDesC&               iSuid;
       
   130 	/**
       
   131 	FLOGGER debug trace member variable.
       
   132 	*/
       
   133 	__FLOG_DECLARATION_MEMBER_MUTABLE;
       
   134 	};
       
   135 
       
   136 #endif // __CMTPKNOWLEDGEHANDLER_H__