loggingservices/eventlogger/LogServ/inc/LogServDatabaseChangeTracker.h
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __LOGSERVDATABASECHANGETRACKER_H__
       
    17 #define __LOGSERVDATABASECHANGETRACKER_H__
       
    18 
       
    19 #include <d32dbms.h>
       
    20 #include "LogServBackupObserver.h"
       
    21 #include "LogServDatabaseChangeInterface.h"
       
    22 #include "LogServDatabaseChangeDefinition.h"
       
    23 
       
    24 // Classes referenced
       
    25 class CLogChangeDefinition;
       
    26 class MLogServBackupInterface;
       
    27 class MLogServDatabaseTransactionInterface;
       
    28 
       
    29 
       
    30 /////////////////////////////////////////////////////////////////////////////////////////
       
    31 // -----> CLogServDatabaseChangeTracker (header)
       
    32 /////////////////////////////////////////////////////////////////////////////////////////
       
    33 /**
       
    34 @internalComponent
       
    35 */
       
    36 class CLogServDatabaseChangeTracker : public CActive, public MLogServBackupObserver, public MLogServDatabaseChangeInterface
       
    37 	{
       
    38 /////////////////////////////////////////////////////////////////////////////////////////
       
    39 public:
       
    40 /////////////////////////////////////////////////////////////////////////////////////////
       
    41 	static CLogServDatabaseChangeTracker* NewL(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, TInt aPriority);
       
    42 	~CLogServDatabaseChangeTracker();
       
    43 
       
    44 /////////////////////////////////////////////////////////////////////////////////////////
       
    45 private: // INTERNAL CONSTRUCT
       
    46 /////////////////////////////////////////////////////////////////////////////////////////
       
    47 	CLogServDatabaseChangeTracker(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, TInt aPriority);
       
    48 	void ConstructL();
       
    49 
       
    50 /////////////////////////////////////////////////////////////////////////////////////////
       
    51 private: // FROM MLogServDatabaseChangeInterface
       
    52 /////////////////////////////////////////////////////////////////////////////////////////
       
    53 	void DCISubmitChangedEventContextL(TLogDatabaseChangeType aType, TLogId aEventId);
       
    54 	void DCISubmitGlobalChangeContextL(TUid aChangeType, TInt aContextParam1, TInt aContextParam2, TInt aContextParam3);
       
    55 	//
       
    56 	void DCIRequestChangeNotificationsL(MLogServDatabaseChangeObserver& aObserver);
       
    57 	void DCIRequestChangeNotificationsCancel(MLogServDatabaseChangeObserver& aObserver);
       
    58 
       
    59 /////////////////////////////////////////////////////////////////////////////////////////
       
    60 private: // FROM MLogServBackupObserver
       
    61 /////////////////////////////////////////////////////////////////////////////////////////
       
    62 	void BOHandleEventL(TLogServBackupEvent aEvent);
       
    63 
       
    64 /////////////////////////////////////////////////////////////////////////////////////////
       
    65 private: // FROM CActive
       
    66 /////////////////////////////////////////////////////////////////////////////////////////
       
    67 	void RunL();
       
    68 	void DoCancel();
       
    69 	TInt RunError(TInt aError);
       
    70 
       
    71 /////////////////////////////////////////////////////////////////////////////////////////
       
    72 private: // INTERNAL METHODS
       
    73 /////////////////////////////////////////////////////////////////////////////////////////
       
    74 	void Request();
       
    75 	void NotifyObserversL();
       
    76 	void NotifyGlobalChangeEventsL();
       
    77 	static TBool IdleNotifyGlobalChangeEvents(TAny* aSelf);
       
    78 
       
    79 /////////////////////////////////////////////////////////////////////////////////////////
       
    80 private: // MEMBER DATA
       
    81 /////////////////////////////////////////////////////////////////////////////////////////
       
    82 
       
    83 	/**
       
    84 	 * Watches the database for change events
       
    85 	 */
       
    86 	MLogServDatabaseTransactionInterface& iDatabase;
       
    87 
       
    88 	/**
       
    89 	 * Watches the database for change events
       
    90 	 */
       
    91 	MLogServBackupInterface& iBackupInterface;
       
    92 
       
    93 	/**
       
    94 	 * Watches the database for change events
       
    95 	 */
       
    96 	RDbNotifier iNotifier;
       
    97 
       
    98 	/**
       
    99 	 * Observers
       
   100 	 */
       
   101 	RPointerArray<MLogServDatabaseChangeObserver> iObservers;
       
   102 
       
   103 	/**
       
   104 	 * Track changes
       
   105 	 */
       
   106 	CLogChangeDefinition* iChanges;
       
   107 
       
   108 	/**
       
   109 	 * Used to ensure any global changes are pushed to clients
       
   110 	 * only after all other active object operations are complete.
       
   111 	 */
       
   112 	CIdle* iIdler;
       
   113 
       
   114 	/**
       
   115 	 * A queue of global change events
       
   116 	 */
       
   117 	RArray<TLogServDatabaseChangeDefinition> iGlobalChanges;
       
   118 	};
       
   119 
       
   120 
       
   121 #endif