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 __LOGSERVSESSION_H__
|
sl@0
|
17 |
#define __LOGSERVSESSION_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <logcli.h>
|
sl@0
|
20 |
#include "LogServDefs.h"
|
sl@0
|
21 |
#include "LogServDatabaseChangeObserver.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
// Classes referenced
|
sl@0
|
24 |
class TLogClientServerData;
|
sl@0
|
25 |
class MLogServSessionLifetimeObserver;
|
sl@0
|
26 |
class MLogServTaskInterface;
|
sl@0
|
27 |
class MLogServOperationManager;
|
sl@0
|
28 |
class MLogServBackupInterface;
|
sl@0
|
29 |
class MLogServDatabaseChangeInterface;
|
sl@0
|
30 |
class MLogServDatabaseTransactionInterface;
|
sl@0
|
31 |
class CLogServServer;
|
sl@0
|
32 |
class CLogNotify;
|
sl@0
|
33 |
class CLogServViewBase;
|
sl@0
|
34 |
|
sl@0
|
35 |
/**
|
sl@0
|
36 |
Handles client requests such as "add event", "change event", etc.
|
sl@0
|
37 |
and dispatches them for execution to the hitters.
|
sl@0
|
38 |
"Hitter" is an active object which class type is one of (CLogActive derived class):
|
sl@0
|
39 |
- CLogAddEvent;
|
sl@0
|
40 |
- CLogGetEvent;
|
sl@0
|
41 |
- CLogChangeEvent;
|
sl@0
|
42 |
- CLogDeleteEvent;
|
sl@0
|
43 |
- CLogChangeConfig;
|
sl@0
|
44 |
- CLogMaintenance;
|
sl@0
|
45 |
- CLogServViewWindowFetcher;
|
sl@0
|
46 |
|
sl@0
|
47 |
Every client request is processed asynchronously and consists of two IPC calls:
|
sl@0
|
48 |
- ELogOperationInitiate - the client initiates asynchronous operation that will be executed by
|
sl@0
|
49 |
one of the hitters;
|
sl@0
|
50 |
- ELogOperationGetResult - after the hitter completes the execution of the requested operation and
|
sl@0
|
51 |
if there is a result for the client, the client can collect the result issuing this IPC request;
|
sl@0
|
52 |
|
sl@0
|
53 |
The client requests processing is relatively complex and I hope the following "add event" step-by-step
|
sl@0
|
54 |
example can clarify how the LogEng server works.
|
sl@0
|
55 |
1. LogEng client issues "add event" request
|
sl@0
|
56 |
2. The request is handled by CLogServSession::ServiceL()
|
sl@0
|
57 |
3. CLogServSession::ServiceL() calls CLogServSession::ServiceOperationFunctionL() where the IPC command
|
sl@0
|
58 |
is identified as ELogOperationInitiate and a new operation is created by calling
|
sl@0
|
59 |
4. LogServFactory::NewOperationL(). Here the client request type is identified as ELogOperationEventAdd
|
sl@0
|
60 |
and an instance of CLogServOpEventAdd class is created
|
sl@0
|
61 |
5. The CLogServOpEventAdd class derives from CLogServOperationBase. The CLogServOperationBase constructor
|
sl@0
|
62 |
will add the just created operation to a queue of pending operations maintained by an instance of the
|
sl@0
|
63 |
CLogServOperationQueue class, which implements the MLogServOperationManager interface.
|
sl@0
|
64 |
The CLogServOpEventAdd instance is added to the queue by calling
|
sl@0
|
65 |
MLogServOperationManager::OMOperationQueueAdd().
|
sl@0
|
66 |
6. The CLogServOperationQueue instance is an active object.
|
sl@0
|
67 |
CLogServOperationQueue::OMOperationQueueAdd() completes itsef and calls SetActive().
|
sl@0
|
68 |
The execution control is returned to the server side session object. Later, when the active scheduler
|
sl@0
|
69 |
takes the execution control the CLogServOperationQueue::RunL() will be called.
|
sl@0
|
70 |
7. CLogServOperationQueue::RunL() will pick up the next pending operation from the queue and calls the
|
sl@0
|
71 |
operation's StartL() method - CLogServOpEventAdd::StartL().
|
sl@0
|
72 |
8. CLogServOpEventAdd::StartL() reads the client "add event" data from the message object and calls
|
sl@0
|
73 |
MLogServTaskInterface::TaskEventAddL() passing the client data as call arguments.
|
sl@0
|
74 |
9. MLogServTaskInterface, as the class name states, is an interface class implemented by the
|
sl@0
|
75 |
CLogServDatabaseDriver class.
|
sl@0
|
76 |
10. CLogServDatabaseDriver::TaskEventAddL() will call the StartL() method of the hitter -
|
sl@0
|
77 |
CLogAddEvent::StartL().
|
sl@0
|
78 |
11. CLogAddEvent::StartL() will complete itself and call SetActive().
|
sl@0
|
79 |
12. The next time when the active scheduler takes the execution control, it will call
|
sl@0
|
80 |
CLogActive::RunL() --> CLogAddEvent::DoRunL(). And the "add event" request will be executed
|
sl@0
|
81 |
13. The LogEng client then can complete the "add event" request by calling the server using the
|
sl@0
|
82 |
ELogOperationGetResult IPC code. CLogServOperationQueue::OMGetResultL() will retrieve the result of the
|
sl@0
|
83 |
operation and destroy the "add event" oeration.
|
sl@0
|
84 |
|
sl@0
|
85 |
@see LogServFactory
|
sl@0
|
86 |
@see CLogServOpEventAdd
|
sl@0
|
87 |
@see MLogServOperationManager
|
sl@0
|
88 |
@see CLogServOperationQueue
|
sl@0
|
89 |
@see MLogServTaskInterface
|
sl@0
|
90 |
@see CLogServDatabaseDriver
|
sl@0
|
91 |
@see CLogActive
|
sl@0
|
92 |
@see CLogAddEvent
|
sl@0
|
93 |
|
sl@0
|
94 |
@internalComponent
|
sl@0
|
95 |
*/
|
sl@0
|
96 |
class CLogServSession : public CSession2, public MLogServDatabaseChangeObserver
|
sl@0
|
97 |
{
|
sl@0
|
98 |
public:
|
sl@0
|
99 |
CLogServSession(TLogServSessionId aSessionId,
|
sl@0
|
100 |
MLogServSessionLifetimeObserver& aObserver,
|
sl@0
|
101 |
MLogServBackupInterface& aBackupInterface,
|
sl@0
|
102 |
MLogServTaskInterface& aTaskInterface,
|
sl@0
|
103 |
MLogServOperationManager& aOperationManager,
|
sl@0
|
104 |
MLogServDatabaseChangeInterface& aChangeInterface,
|
sl@0
|
105 |
MLogServDatabaseTransactionInterface& aDatabase);
|
sl@0
|
106 |
~CLogServSession();
|
sl@0
|
107 |
|
sl@0
|
108 |
inline TLogServSessionId Id() const;
|
sl@0
|
109 |
CLogServServer& Server() const;
|
sl@0
|
110 |
|
sl@0
|
111 |
private:
|
sl@0
|
112 |
void DCOHandleGlobalChangeEventL(const TLogServDatabaseChangeDefinition& aChange);//FROM MLogServDatabaseChangeObserver
|
sl@0
|
113 |
void CreateL();
|
sl@0
|
114 |
virtual void ServiceL(const RMessage2& aMessage);
|
sl@0
|
115 |
virtual void ServiceError(const RMessage2& aMessage,TInt aError);
|
sl@0
|
116 |
CLogServViewBase& ViewByIdL(TLogViewId aViewId);
|
sl@0
|
117 |
TInt ViewPositionById(TLogViewId aViewId) const;
|
sl@0
|
118 |
void ReadClientServerDataL(TLogClientServerData& aClientServerData,
|
sl@0
|
119 |
const RMessage2& aMessage, TInt aMinOperation, TInt aMaxOperation);
|
sl@0
|
120 |
void ServiceViewFunctionL(const RMessage2& aMessage);
|
sl@0
|
121 |
void ServiceOperationFunctionL(const RMessage2& aMessage);
|
sl@0
|
122 |
void ExtendedNotifyCompleteL(TInt aCompletionCode);
|
sl@0
|
123 |
|
sl@0
|
124 |
private:
|
sl@0
|
125 |
TLogServSessionId iSessionId;
|
sl@0
|
126 |
MLogServSessionLifetimeObserver& iObserver;
|
sl@0
|
127 |
MLogServBackupInterface& iBackupInterface;
|
sl@0
|
128 |
MLogServTaskInterface& iTaskInterface;
|
sl@0
|
129 |
MLogServOperationManager& iOperationManager;
|
sl@0
|
130 |
MLogServDatabaseChangeInterface& iChangeInterface;
|
sl@0
|
131 |
MLogServDatabaseTransactionInterface& iDatabase;
|
sl@0
|
132 |
CLogPackage* iPackage;
|
sl@0
|
133 |
CLogNotify* iNotify;
|
sl@0
|
134 |
RPointerArray<CLogServViewBase> iViewList;
|
sl@0
|
135 |
RMessage2 iExtendedNotificationMessage;
|
sl@0
|
136 |
RArray<TLogServDatabaseChangeDefinition> iPendingGlobalChanges;
|
sl@0
|
137 |
TBool iExtendedNotificationRequested;
|
sl@0
|
138 |
#ifdef LOGGING_ENABLED
|
sl@0
|
139 |
TName iClientThreadName;
|
sl@0
|
140 |
#endif
|
sl@0
|
141 |
|
sl@0
|
142 |
};
|
sl@0
|
143 |
|
sl@0
|
144 |
inline TLogServSessionId CLogServSession::Id() const
|
sl@0
|
145 |
{
|
sl@0
|
146 |
return iSessionId;
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
#endif//__LOGSERVSESSION_H__
|