sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __LOGSERVDATABASECHANGETRACKER_H__ sl@0: #define __LOGSERVDATABASECHANGETRACKER_H__ sl@0: sl@0: #include sl@0: #include "LogServBackupObserver.h" sl@0: #include "LogServDatabaseChangeInterface.h" sl@0: #include "LogServDatabaseChangeDefinition.h" sl@0: sl@0: // Classes referenced sl@0: class CLogChangeDefinition; sl@0: class MLogServBackupInterface; sl@0: class MLogServDatabaseTransactionInterface; sl@0: sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: // -----> CLogServDatabaseChangeTracker (header) sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: class CLogServDatabaseChangeTracker : public CActive, public MLogServBackupObserver, public MLogServDatabaseChangeInterface sl@0: { sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: public: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: static CLogServDatabaseChangeTracker* NewL(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, TInt aPriority); sl@0: ~CLogServDatabaseChangeTracker(); sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: private: // INTERNAL CONSTRUCT sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: CLogServDatabaseChangeTracker(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, TInt aPriority); sl@0: void ConstructL(); sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: private: // FROM MLogServDatabaseChangeInterface sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: void DCISubmitChangedEventContextL(TLogDatabaseChangeType aType, TLogId aEventId); sl@0: void DCISubmitGlobalChangeContextL(TUid aChangeType, TInt aContextParam1, TInt aContextParam2, TInt aContextParam3); sl@0: // sl@0: void DCIRequestChangeNotificationsL(MLogServDatabaseChangeObserver& aObserver); sl@0: void DCIRequestChangeNotificationsCancel(MLogServDatabaseChangeObserver& aObserver); sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: private: // FROM MLogServBackupObserver sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: void BOHandleEventL(TLogServBackupEvent aEvent); sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: private: // FROM CActive sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: void RunL(); sl@0: void DoCancel(); sl@0: TInt RunError(TInt aError); sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: private: // INTERNAL METHODS sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: void Request(); sl@0: void NotifyObserversL(); sl@0: void NotifyGlobalChangeEventsL(); sl@0: static TBool IdleNotifyGlobalChangeEvents(TAny* aSelf); sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: private: // MEMBER DATA sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: /** sl@0: * Watches the database for change events sl@0: */ sl@0: MLogServDatabaseTransactionInterface& iDatabase; sl@0: sl@0: /** sl@0: * Watches the database for change events sl@0: */ sl@0: MLogServBackupInterface& iBackupInterface; sl@0: sl@0: /** sl@0: * Watches the database for change events sl@0: */ sl@0: RDbNotifier iNotifier; sl@0: sl@0: /** sl@0: * Observers sl@0: */ sl@0: RPointerArray iObservers; sl@0: sl@0: /** sl@0: * Track changes sl@0: */ sl@0: CLogChangeDefinition* iChanges; sl@0: sl@0: /** sl@0: * Used to ensure any global changes are pushed to clients sl@0: * only after all other active object operations are complete. sl@0: */ sl@0: CIdle* iIdler; sl@0: sl@0: /** sl@0: * A queue of global change events sl@0: */ sl@0: RArray iGlobalChanges; sl@0: }; sl@0: sl@0: sl@0: #endif