sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __LOGSERVVIEW_H__
|
sl@0
|
17 |
#define __LOGSERVVIEW_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <logcli.h>
|
sl@0
|
20 |
#include "LOGQUERY.H"
|
sl@0
|
21 |
#include "LogCliServShared.h"
|
sl@0
|
22 |
#include "LogServBackupObserver.h"
|
sl@0
|
23 |
#include "LogServDatabaseChangeObserver.h"
|
sl@0
|
24 |
#include "LogServDatabaseTransactionInterface.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
// Classes referenced
|
sl@0
|
27 |
class CLogPackage;
|
sl@0
|
28 |
class CLogServViewLockObserver;
|
sl@0
|
29 |
class CLogServViewChangeManager;
|
sl@0
|
30 |
class MLogServDatabaseTransactionInterface;
|
sl@0
|
31 |
class MLogServBackupInterface;
|
sl@0
|
32 |
|
sl@0
|
33 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
34 |
////////////////////// CLogServViewBase /////////////////////////////////////////////////////////////
|
sl@0
|
35 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
36 |
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
Base class for the view that the LogEng server can create.
|
sl@0
|
39 |
Implements MLogServBackupObserver and MLogServDatabaseChangeObserver interfaces.
|
sl@0
|
40 |
|
sl@0
|
41 |
@see MLogServBackupObserver
|
sl@0
|
42 |
@see MLogServDatabaseChangeObserver
|
sl@0
|
43 |
@internalComponent
|
sl@0
|
44 |
*/
|
sl@0
|
45 |
class CLogServViewBase : public CBase, public MLogServBackupObserver, public MLogServDatabaseChangeObserver
|
sl@0
|
46 |
{
|
sl@0
|
47 |
public:
|
sl@0
|
48 |
~CLogServViewBase();
|
sl@0
|
49 |
void RequestChangeNotifications(const RMessage2& aMessage);
|
sl@0
|
50 |
void RequestChangeNotificationsCancel();
|
sl@0
|
51 |
void RequestLockStatusChanges(const RMessage2& aMessage);
|
sl@0
|
52 |
void RequestLockStatusChangesCancel();
|
sl@0
|
53 |
void RequestChangesL(const RMessage2& aMessage);
|
sl@0
|
54 |
void SetupL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
|
sl@0
|
55 |
virtual TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType)=0;
|
sl@0
|
56 |
virtual void RemoveL(const RMessage2& aMessage);
|
sl@0
|
57 |
virtual void ClearDuplicatesL(const RMessage2& aMessage);
|
sl@0
|
58 |
virtual void SetFlagsL(const RMessage2& aMessage);
|
sl@0
|
59 |
inline TLogViewId ViewId() const;
|
sl@0
|
60 |
TInt Count() const;
|
sl@0
|
61 |
TLogId At(TInt aIndex) const;
|
sl@0
|
62 |
inline TBool ViewIsReady() const;
|
sl@0
|
63 |
|
sl@0
|
64 |
protected:
|
sl@0
|
65 |
CLogServViewBase(MLogServDatabaseTransactionInterface& aDatabase,
|
sl@0
|
66 |
MLogServBackupInterface& aBackupInterface,
|
sl@0
|
67 |
CLogPackage& aPackage,
|
sl@0
|
68 |
TLogViewType aType,
|
sl@0
|
69 |
TLogViewId aViewId,
|
sl@0
|
70 |
const RMessage2& aMessage);
|
sl@0
|
71 |
|
sl@0
|
72 |
void ConstructL();
|
sl@0
|
73 |
static void DestroyList(TAny *aPtr);
|
sl@0
|
74 |
|
sl@0
|
75 |
private: // FROM MLogServDatabaseChangeObserver
|
sl@0
|
76 |
void DCOHandleChangeEventsL(const CLogChangeDefinition& aChanges);
|
sl@0
|
77 |
// FROM MLogServBackupObserver
|
sl@0
|
78 |
void BOHandleEventL(TLogServBackupEvent aEvent);
|
sl@0
|
79 |
|
sl@0
|
80 |
void InitializeColumnsL(RDbRowSet& aRowSet);
|
sl@0
|
81 |
inline TInt ClientSideCursorPosition() const;
|
sl@0
|
82 |
//
|
sl@0
|
83 |
void ResetViewContentsL(RDbRowSet& aRowSet);
|
sl@0
|
84 |
void PrepareViewContentsL(const TDesC& aSQL);
|
sl@0
|
85 |
TInt RebuildViewContentsIfNecessary();
|
sl@0
|
86 |
void DoHandleChangeEventsL(const CLogChangeDefinition& aChanges);
|
sl@0
|
87 |
void RebuildViewL();
|
sl@0
|
88 |
TBool IsAllowed(TEventOp aEventOp, TUint8 aEventTypeIndex);
|
sl@0
|
89 |
|
sl@0
|
90 |
protected:
|
sl@0
|
91 |
MLogServDatabaseTransactionInterface& iDatabase;
|
sl@0
|
92 |
CLogPackage& iPackage;
|
sl@0
|
93 |
|
sl@0
|
94 |
private:
|
sl@0
|
95 |
MLogServBackupInterface& iBackupInterface;
|
sl@0
|
96 |
TLogViewType iType;//The type of view that this object represents
|
sl@0
|
97 |
TLogViewId iViewId;//The id of this view
|
sl@0
|
98 |
RArray<TLogId> iViewContents;//An array which contains the log ids of all the items in this view
|
sl@0
|
99 |
TBool iViewContentsReady;
|
sl@0
|
100 |
HBufC* iSql;//The SQL filter/condition which is used to build this view
|
sl@0
|
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).
|
sl@0
|
102 |
CLogServViewLockObserver* iLockChangeObserver;//Manages lock change events
|
sl@0
|
103 |
CLogServViewChangeManager* iChangeManager;//Manages change events for this view
|
sl@0
|
104 |
const RMessage2& iMessage;//Passed in the constructor by the LogServOperationFactory - used to check security
|
sl@0
|
105 |
/**
|
sl@0
|
106 |
Data structure for storage of cached security information
|
sl@0
|
107 |
@internalComponent
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
struct SStandardTypeSecurity
|
sl@0
|
110 |
{
|
sl@0
|
111 |
TUid eventType;
|
sl@0
|
112 |
TBool readAccess;
|
sl@0
|
113 |
TBool writeAccess;
|
sl@0
|
114 |
};
|
sl@0
|
115 |
RArray<SStandardTypeSecurity> iStandardTypeSecurityCache;
|
sl@0
|
116 |
static TDbColNo iIdColNo;
|
sl@0
|
117 |
static TDbColNo iTypeColNo;
|
sl@0
|
118 |
static TDbColNo iFlagColNo[KLogFlagsCount];
|
sl@0
|
119 |
|
sl@0
|
120 |
};
|
sl@0
|
121 |
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
Returns the id of this view
|
sl@0
|
124 |
*/
|
sl@0
|
125 |
inline TLogViewId CLogServViewBase::ViewId() const
|
sl@0
|
126 |
{
|
sl@0
|
127 |
return iViewId;
|
sl@0
|
128 |
}
|
sl@0
|
129 |
|
sl@0
|
130 |
/**
|
sl@0
|
131 |
Is the view ready?
|
sl@0
|
132 |
*/
|
sl@0
|
133 |
inline TBool CLogServViewBase::ViewIsReady() const
|
sl@0
|
134 |
{
|
sl@0
|
135 |
return (iViewContentsReady && iSql);
|
sl@0
|
136 |
}
|
sl@0
|
137 |
|
sl@0
|
138 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
139 |
////////////////////// CLogServViewLockObserver ////////////////////////////////////////////////////
|
sl@0
|
140 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
141 |
|
sl@0
|
142 |
/**
|
sl@0
|
143 |
Implements MLogServBackupObserver interface.
|
sl@0
|
144 |
An instance of this class is data member of CLogServViewBase.
|
sl@0
|
145 |
It is used every time when the client side requests notification regarding the view status.
|
sl@0
|
146 |
The view status changes to "locked" during the backup/restore operations.
|
sl@0
|
147 |
|
sl@0
|
148 |
@see CLogServViewBase
|
sl@0
|
149 |
@see MLogServBackupObserver
|
sl@0
|
150 |
@internalComponent
|
sl@0
|
151 |
*/
|
sl@0
|
152 |
class CLogServViewLockObserver : public CBase, public MLogServBackupObserver
|
sl@0
|
153 |
{
|
sl@0
|
154 |
public:
|
sl@0
|
155 |
static CLogServViewLockObserver* NewL(MLogServBackupInterface& aBackupInterface);
|
sl@0
|
156 |
~CLogServViewLockObserver();
|
sl@0
|
157 |
void RequestLockStatusChanges(const RMessage2& aMessage);
|
sl@0
|
158 |
void RequestLockStatusChangesCancel();
|
sl@0
|
159 |
|
sl@0
|
160 |
private:
|
sl@0
|
161 |
CLogServViewLockObserver(MLogServBackupInterface& aBackupInterface);
|
sl@0
|
162 |
void ConstructL();
|
sl@0
|
163 |
// FROM MLogServBackupObserver
|
sl@0
|
164 |
void BOHandleEventL(TLogServBackupEvent aEvent);
|
sl@0
|
165 |
|
sl@0
|
166 |
inline TBool HaveLockStatusChangePointer() const;
|
sl@0
|
167 |
void CompleteLockStatusChangeMessage(TInt aCompletionCode);
|
sl@0
|
168 |
|
sl@0
|
169 |
private:
|
sl@0
|
170 |
MLogServBackupInterface& iBackupInterface;
|
sl@0
|
171 |
RArray<TLogViewLockStatus> iLockEvents;//Holds state changes when the client isn't able to receive them immediately.
|
sl@0
|
172 |
RMessagePtr2 iLockStatusChangeMessage;//Completed when the view is locked/unlocked
|
sl@0
|
173 |
|
sl@0
|
174 |
};
|
sl@0
|
175 |
|
sl@0
|
176 |
inline TBool CLogServViewLockObserver::HaveLockStatusChangePointer() const
|
sl@0
|
177 |
{
|
sl@0
|
178 |
return (iLockStatusChangeMessage != RMessagePtr2());
|
sl@0
|
179 |
}
|
sl@0
|
180 |
|
sl@0
|
181 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
182 |
////////////////////// CLogServViewEvent ///////////////////////////////////////////////////////////
|
sl@0
|
183 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
184 |
|
sl@0
|
185 |
/**
|
sl@0
|
186 |
CLogServViewBase derived class.
|
sl@0
|
187 |
|
sl@0
|
188 |
@see CLogServViewBase
|
sl@0
|
189 |
@internalComponent
|
sl@0
|
190 |
*/
|
sl@0
|
191 |
class CLogServViewEvent : public CLogServViewBase
|
sl@0
|
192 |
{
|
sl@0
|
193 |
public:
|
sl@0
|
194 |
static CLogServViewEvent* NewL(MLogServDatabaseTransactionInterface& aDatabase,
|
sl@0
|
195 |
MLogServBackupInterface& aBackupInterface,
|
sl@0
|
196 |
CLogPackage& aPackage,
|
sl@0
|
197 |
TLogViewId aViewId,
|
sl@0
|
198 |
const RMessage2& aMessage);
|
sl@0
|
199 |
|
sl@0
|
200 |
TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
|
sl@0
|
201 |
//
|
sl@0
|
202 |
private:
|
sl@0
|
203 |
CLogServViewEvent(MLogServDatabaseTransactionInterface& aDatabase,
|
sl@0
|
204 |
MLogServBackupInterface& aBackupInterface,
|
sl@0
|
205 |
CLogPackage& aPackage,
|
sl@0
|
206 |
TLogViewId aViewId,
|
sl@0
|
207 |
const RMessage2& aMessage);
|
sl@0
|
208 |
};
|
sl@0
|
209 |
|
sl@0
|
210 |
|
sl@0
|
211 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
212 |
////////////////////// CLogServViewRecent //////////////////////////////////////////////////////////
|
sl@0
|
213 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
214 |
|
sl@0
|
215 |
/**
|
sl@0
|
216 |
CLogServViewBase derived class.
|
sl@0
|
217 |
|
sl@0
|
218 |
@see CLogServViewBase
|
sl@0
|
219 |
@internalComponent
|
sl@0
|
220 |
*/
|
sl@0
|
221 |
class CLogServViewRecent : public CLogServViewBase
|
sl@0
|
222 |
{
|
sl@0
|
223 |
public:
|
sl@0
|
224 |
static CLogServViewRecent* NewL(MLogServDatabaseTransactionInterface& aDatabase,
|
sl@0
|
225 |
MLogServBackupInterface& aBackupInterface,
|
sl@0
|
226 |
CLogPackage& aPackage,
|
sl@0
|
227 |
TLogViewId aViewId,
|
sl@0
|
228 |
const RMessage2& aMessage);
|
sl@0
|
229 |
|
sl@0
|
230 |
TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
|
sl@0
|
231 |
void RemoveL(const RMessage2& aMessage);
|
sl@0
|
232 |
void ClearDuplicatesL(const RMessage2& aMessage);
|
sl@0
|
233 |
//
|
sl@0
|
234 |
|
sl@0
|
235 |
//
|
sl@0
|
236 |
private:
|
sl@0
|
237 |
CLogServViewRecent(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, CLogPackage& aPackage, TLogViewId aViewId, const RMessage2& aMessage);
|
sl@0
|
238 |
void InitializeColumns2L(RDbRowSet& aRowSet);
|
sl@0
|
239 |
//
|
sl@0
|
240 |
private:
|
sl@0
|
241 |
TLogRecentList iRecentList;
|
sl@0
|
242 |
|
sl@0
|
243 |
static TDbColNo iIdColNo;
|
sl@0
|
244 |
static TDbColNo iRecentColNo;
|
sl@0
|
245 |
static TDbColNo iDuplicateColNo;
|
sl@0
|
246 |
|
sl@0
|
247 |
};
|
sl@0
|
248 |
|
sl@0
|
249 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
250 |
////////////////////// CLogServViewDuplicate ///////////////////////////////////////////////////////
|
sl@0
|
251 |
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
252 |
|
sl@0
|
253 |
/**
|
sl@0
|
254 |
CLogServViewBase derived class.
|
sl@0
|
255 |
|
sl@0
|
256 |
@see CLogServViewBase
|
sl@0
|
257 |
@internalComponent
|
sl@0
|
258 |
*/
|
sl@0
|
259 |
class CLogServViewDuplicate : public CLogServViewBase
|
sl@0
|
260 |
{
|
sl@0
|
261 |
public:
|
sl@0
|
262 |
static CLogServViewDuplicate* NewL(MLogServDatabaseTransactionInterface& aDatabase,
|
sl@0
|
263 |
MLogServBackupInterface& aBackupInterface,
|
sl@0
|
264 |
CLogPackage& aPackage,
|
sl@0
|
265 |
TLogViewId aViewId,
|
sl@0
|
266 |
const RMessage2& aMessage);
|
sl@0
|
267 |
|
sl@0
|
268 |
TPtrC GetQueryStringL(const RMessage2& aMessage, TLogFilterConstructionType aFilterType);
|
sl@0
|
269 |
void RemoveL(const RMessage2& aMessage);
|
sl@0
|
270 |
//
|
sl@0
|
271 |
private:
|
sl@0
|
272 |
CLogServViewDuplicate(MLogServDatabaseTransactionInterface& aDatabase,
|
sl@0
|
273 |
MLogServBackupInterface& aBackupInterface,
|
sl@0
|
274 |
CLogPackage& aPackage,
|
sl@0
|
275 |
TLogViewId aViewId,
|
sl@0
|
276 |
const RMessage2& aMessage);
|
sl@0
|
277 |
//
|
sl@0
|
278 |
private:
|
sl@0
|
279 |
TLogId iSourceId;
|
sl@0
|
280 |
};
|
sl@0
|
281 |
|
sl@0
|
282 |
#endif
|