1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogServ/inc/logservsession.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,149 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __LOGSERVSESSION_H__
1.20 +#define __LOGSERVSESSION_H__
1.21 +
1.22 +#include <logcli.h>
1.23 +#include "LogServDefs.h"
1.24 +#include "LogServDatabaseChangeObserver.h"
1.25 +
1.26 +// Classes referenced
1.27 +class TLogClientServerData;
1.28 +class MLogServSessionLifetimeObserver;
1.29 +class MLogServTaskInterface;
1.30 +class MLogServOperationManager;
1.31 +class MLogServBackupInterface;
1.32 +class MLogServDatabaseChangeInterface;
1.33 +class MLogServDatabaseTransactionInterface;
1.34 +class CLogServServer;
1.35 +class CLogNotify;
1.36 +class CLogServViewBase;
1.37 +
1.38 +/**
1.39 +Handles client requests such as "add event", "change event", etc.
1.40 +and dispatches them for execution to the hitters.
1.41 +"Hitter" is an active object which class type is one of (CLogActive derived class):
1.42 + - CLogAddEvent;
1.43 + - CLogGetEvent;
1.44 + - CLogChangeEvent;
1.45 + - CLogDeleteEvent;
1.46 + - CLogChangeConfig;
1.47 + - CLogMaintenance;
1.48 + - CLogServViewWindowFetcher;
1.49 +
1.50 +Every client request is processed asynchronously and consists of two IPC calls:
1.51 + - ELogOperationInitiate - the client initiates asynchronous operation that will be executed by
1.52 + one of the hitters;
1.53 + - ELogOperationGetResult - after the hitter completes the execution of the requested operation and
1.54 + if there is a result for the client, the client can collect the result issuing this IPC request;
1.55 +
1.56 +The client requests processing is relatively complex and I hope the following "add event" step-by-step
1.57 +example can clarify how the LogEng server works.
1.58 + 1. LogEng client issues "add event" request
1.59 + 2. The request is handled by CLogServSession::ServiceL()
1.60 + 3. CLogServSession::ServiceL() calls CLogServSession::ServiceOperationFunctionL() where the IPC command
1.61 + is identified as ELogOperationInitiate and a new operation is created by calling
1.62 + 4. LogServFactory::NewOperationL(). Here the client request type is identified as ELogOperationEventAdd
1.63 + and an instance of CLogServOpEventAdd class is created
1.64 + 5. The CLogServOpEventAdd class derives from CLogServOperationBase. The CLogServOperationBase constructor
1.65 + will add the just created operation to a queue of pending operations maintained by an instance of the
1.66 + CLogServOperationQueue class, which implements the MLogServOperationManager interface.
1.67 + The CLogServOpEventAdd instance is added to the queue by calling
1.68 + MLogServOperationManager::OMOperationQueueAdd().
1.69 + 6. The CLogServOperationQueue instance is an active object.
1.70 + CLogServOperationQueue::OMOperationQueueAdd() completes itsef and calls SetActive().
1.71 + The execution control is returned to the server side session object. Later, when the active scheduler
1.72 + takes the execution control the CLogServOperationQueue::RunL() will be called.
1.73 + 7. CLogServOperationQueue::RunL() will pick up the next pending operation from the queue and calls the
1.74 + operation's StartL() method - CLogServOpEventAdd::StartL().
1.75 + 8. CLogServOpEventAdd::StartL() reads the client "add event" data from the message object and calls
1.76 + MLogServTaskInterface::TaskEventAddL() passing the client data as call arguments.
1.77 + 9. MLogServTaskInterface, as the class name states, is an interface class implemented by the
1.78 + CLogServDatabaseDriver class.
1.79 +10. CLogServDatabaseDriver::TaskEventAddL() will call the StartL() method of the hitter -
1.80 + CLogAddEvent::StartL().
1.81 +11. CLogAddEvent::StartL() will complete itself and call SetActive().
1.82 +12. The next time when the active scheduler takes the execution control, it will call
1.83 + CLogActive::RunL() --> CLogAddEvent::DoRunL(). And the "add event" request will be executed
1.84 +13. The LogEng client then can complete the "add event" request by calling the server using the
1.85 + ELogOperationGetResult IPC code. CLogServOperationQueue::OMGetResultL() will retrieve the result of the
1.86 + operation and destroy the "add event" oeration.
1.87 +
1.88 +@see LogServFactory
1.89 +@see CLogServOpEventAdd
1.90 +@see MLogServOperationManager
1.91 +@see CLogServOperationQueue
1.92 +@see MLogServTaskInterface
1.93 +@see CLogServDatabaseDriver
1.94 +@see CLogActive
1.95 +@see CLogAddEvent
1.96 +
1.97 +@internalComponent
1.98 +*/
1.99 +class CLogServSession : public CSession2, public MLogServDatabaseChangeObserver
1.100 + {
1.101 +public:
1.102 + CLogServSession(TLogServSessionId aSessionId,
1.103 + MLogServSessionLifetimeObserver& aObserver,
1.104 + MLogServBackupInterface& aBackupInterface,
1.105 + MLogServTaskInterface& aTaskInterface,
1.106 + MLogServOperationManager& aOperationManager,
1.107 + MLogServDatabaseChangeInterface& aChangeInterface,
1.108 + MLogServDatabaseTransactionInterface& aDatabase);
1.109 + ~CLogServSession();
1.110 +
1.111 + inline TLogServSessionId Id() const;
1.112 + CLogServServer& Server() const;
1.113 +
1.114 +private:
1.115 + void DCOHandleGlobalChangeEventL(const TLogServDatabaseChangeDefinition& aChange);//FROM MLogServDatabaseChangeObserver
1.116 + void CreateL();
1.117 + virtual void ServiceL(const RMessage2& aMessage);
1.118 + virtual void ServiceError(const RMessage2& aMessage,TInt aError);
1.119 + CLogServViewBase& ViewByIdL(TLogViewId aViewId);
1.120 + TInt ViewPositionById(TLogViewId aViewId) const;
1.121 + void ReadClientServerDataL(TLogClientServerData& aClientServerData,
1.122 + const RMessage2& aMessage, TInt aMinOperation, TInt aMaxOperation);
1.123 + void ServiceViewFunctionL(const RMessage2& aMessage);
1.124 + void ServiceOperationFunctionL(const RMessage2& aMessage);
1.125 + void ExtendedNotifyCompleteL(TInt aCompletionCode);
1.126 +
1.127 +private:
1.128 + TLogServSessionId iSessionId;
1.129 + MLogServSessionLifetimeObserver& iObserver;
1.130 + MLogServBackupInterface& iBackupInterface;
1.131 + MLogServTaskInterface& iTaskInterface;
1.132 + MLogServOperationManager& iOperationManager;
1.133 + MLogServDatabaseChangeInterface& iChangeInterface;
1.134 + MLogServDatabaseTransactionInterface& iDatabase;
1.135 + CLogPackage* iPackage;
1.136 + CLogNotify* iNotify;
1.137 + RPointerArray<CLogServViewBase> iViewList;
1.138 + RMessage2 iExtendedNotificationMessage;
1.139 + RArray<TLogServDatabaseChangeDefinition> iPendingGlobalChanges;
1.140 + TBool iExtendedNotificationRequested;
1.141 +#ifdef LOGGING_ENABLED
1.142 + TName iClientThreadName;
1.143 +#endif
1.144 +
1.145 + };
1.146 +
1.147 +inline TLogServSessionId CLogServSession::Id() const
1.148 + {
1.149 + return iSessionId;
1.150 + }
1.151 +
1.152 +#endif//__LOGSERVSESSION_H__