Update contrib.
1 // Copyright (c) 2002-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __LOGSERVVIEW_H__
17 #define __LOGSERVVIEW_H__
21 #include "LogCliServShared.h"
22 #include "LogServBackupObserver.h"
23 #include "LogServDatabaseChangeObserver.h"
24 #include "LogServDatabaseTransactionInterface.h"
28 class CLogServViewLockObserver;
29 class CLogServViewChangeManager;
30 class MLogServDatabaseTransactionInterface;
31 class MLogServBackupInterface;
33 ///////////////////////////////////////////////////////////////////////////////////////////////////////
34 ////////////////////// CLogServViewBase /////////////////////////////////////////////////////////////
35 ///////////////////////////////////////////////////////////////////////////////////////////////////////
38 Base class for the view that the LogEng server can create.
39 Implements MLogServBackupObserver and MLogServDatabaseChangeObserver interfaces.
41 @see MLogServBackupObserver
42 @see MLogServDatabaseChangeObserver
45 class CLogServViewBase : public CBase, public MLogServBackupObserver, public MLogServDatabaseChangeObserver
49 void RequestChangeNotifications(const RMessage2& aMessage);
50 void RequestChangeNotificationsCancel();
51 void RequestLockStatusChanges(const RMessage2& aMessage);
52 void RequestLockStatusChangesCancel();
53 void RequestChangesL(const RMessage2& aMessage);
54 void SetupL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
55 virtual TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType)=0;
56 virtual void RemoveL(const RMessage2& aMessage);
57 virtual void ClearDuplicatesL(const RMessage2& aMessage);
58 virtual void SetFlagsL(const RMessage2& aMessage);
59 inline TLogViewId ViewId() const;
61 TLogId At(TInt aIndex) const;
62 inline TBool ViewIsReady() const;
65 CLogServViewBase(MLogServDatabaseTransactionInterface& aDatabase,
66 MLogServBackupInterface& aBackupInterface,
67 CLogPackage& aPackage,
70 const RMessage2& aMessage);
73 static void DestroyList(TAny *aPtr);
75 private: // FROM MLogServDatabaseChangeObserver
76 void DCOHandleChangeEventsL(const CLogChangeDefinition& aChanges);
77 // FROM MLogServBackupObserver
78 void BOHandleEventL(TLogServBackupEvent aEvent);
80 void InitializeColumnsL(RDbRowSet& aRowSet);
81 inline TInt ClientSideCursorPosition() const;
83 void ResetViewContentsL(RDbRowSet& aRowSet);
84 void PrepareViewContentsL(const TDesC& aSQL);
85 TInt RebuildViewContentsIfNecessary();
86 void DoHandleChangeEventsL(const CLogChangeDefinition& aChanges);
88 TBool IsAllowed(TEventOp aEventOp, TUint8 aEventTypeIndex);
91 MLogServDatabaseTransactionInterface& iDatabase;
92 CLogPackage& iPackage;
95 MLogServBackupInterface& iBackupInterface;
96 TLogViewType iType;//The type of view that this object represents
97 TLogViewId iViewId;//The id of this view
98 RArray<TLogId> iViewContents;//An array which contains the log ids of all the items in this view
99 TBool iViewContentsReady;
100 HBufC* iSql;//The SQL filter/condition which is used to build this view
101 TBool iRebuildViewContents;//A flag to indicate that we need to rebuild the view because handling a change notification failed (e.g due to OOM).
102 CLogServViewLockObserver* iLockChangeObserver;//Manages lock change events
103 CLogServViewChangeManager* iChangeManager;//Manages change events for this view
104 const RMessage2& iMessage;//Passed in the constructor by the LogServOperationFactory - used to check security
106 Data structure for storage of cached security information
109 struct SStandardTypeSecurity
115 RArray<SStandardTypeSecurity> iStandardTypeSecurityCache;
116 static TDbColNo iIdColNo;
117 static TDbColNo iTypeColNo;
118 static TDbColNo iFlagColNo[KLogFlagsCount];
123 Returns the id of this view
125 inline TLogViewId CLogServViewBase::ViewId() const
133 inline TBool CLogServViewBase::ViewIsReady() const
135 return (iViewContentsReady && iSql);
138 ///////////////////////////////////////////////////////////////////////////////////////////////////////
139 ////////////////////// CLogServViewLockObserver ////////////////////////////////////////////////////
140 ///////////////////////////////////////////////////////////////////////////////////////////////////////
143 Implements MLogServBackupObserver interface.
144 An instance of this class is data member of CLogServViewBase.
145 It is used every time when the client side requests notification regarding the view status.
146 The view status changes to "locked" during the backup/restore operations.
148 @see CLogServViewBase
149 @see MLogServBackupObserver
152 class CLogServViewLockObserver : public CBase, public MLogServBackupObserver
155 static CLogServViewLockObserver* NewL(MLogServBackupInterface& aBackupInterface);
156 ~CLogServViewLockObserver();
157 void RequestLockStatusChanges(const RMessage2& aMessage);
158 void RequestLockStatusChangesCancel();
161 CLogServViewLockObserver(MLogServBackupInterface& aBackupInterface);
163 // FROM MLogServBackupObserver
164 void BOHandleEventL(TLogServBackupEvent aEvent);
166 inline TBool HaveLockStatusChangePointer() const;
167 void CompleteLockStatusChangeMessage(TInt aCompletionCode);
170 MLogServBackupInterface& iBackupInterface;
171 RArray<TLogViewLockStatus> iLockEvents;//Holds state changes when the client isn't able to receive them immediately.
172 RMessagePtr2 iLockStatusChangeMessage;//Completed when the view is locked/unlocked
176 inline TBool CLogServViewLockObserver::HaveLockStatusChangePointer() const
178 return (iLockStatusChangeMessage != RMessagePtr2());
181 ///////////////////////////////////////////////////////////////////////////////////////////////////////
182 ////////////////////// CLogServViewEvent ///////////////////////////////////////////////////////////
183 ///////////////////////////////////////////////////////////////////////////////////////////////////////
186 CLogServViewBase derived class.
188 @see CLogServViewBase
191 class CLogServViewEvent : public CLogServViewBase
194 static CLogServViewEvent* NewL(MLogServDatabaseTransactionInterface& aDatabase,
195 MLogServBackupInterface& aBackupInterface,
196 CLogPackage& aPackage,
198 const RMessage2& aMessage);
200 TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
203 CLogServViewEvent(MLogServDatabaseTransactionInterface& aDatabase,
204 MLogServBackupInterface& aBackupInterface,
205 CLogPackage& aPackage,
207 const RMessage2& aMessage);
211 ///////////////////////////////////////////////////////////////////////////////////////////////////////
212 ////////////////////// CLogServViewRecent //////////////////////////////////////////////////////////
213 ///////////////////////////////////////////////////////////////////////////////////////////////////////
216 CLogServViewBase derived class.
218 @see CLogServViewBase
221 class CLogServViewRecent : public CLogServViewBase
224 static CLogServViewRecent* NewL(MLogServDatabaseTransactionInterface& aDatabase,
225 MLogServBackupInterface& aBackupInterface,
226 CLogPackage& aPackage,
228 const RMessage2& aMessage);
230 TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
231 void RemoveL(const RMessage2& aMessage);
232 void ClearDuplicatesL(const RMessage2& aMessage);
237 CLogServViewRecent(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, CLogPackage& aPackage, TLogViewId aViewId, const RMessage2& aMessage);
238 void InitializeColumns2L(RDbRowSet& aRowSet);
241 TLogRecentList iRecentList;
243 static TDbColNo iIdColNo;
244 static TDbColNo iRecentColNo;
245 static TDbColNo iDuplicateColNo;
249 ///////////////////////////////////////////////////////////////////////////////////////////////////////
250 ////////////////////// CLogServViewDuplicate ///////////////////////////////////////////////////////
251 ///////////////////////////////////////////////////////////////////////////////////////////////////////
254 CLogServViewBase derived class.
256 @see CLogServViewBase
259 class CLogServViewDuplicate : public CLogServViewBase
262 static CLogServViewDuplicate* NewL(MLogServDatabaseTransactionInterface& aDatabase,
263 MLogServBackupInterface& aBackupInterface,
264 CLogPackage& aPackage,
266 const RMessage2& aMessage);
268 TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
269 void RemoveL(const RMessage2& aMessage);
272 CLogServViewDuplicate(MLogServDatabaseTransactionInterface& aDatabase,
273 MLogServBackupInterface& aBackupInterface,
274 CLogPackage& aPackage,
276 const RMessage2& aMessage);