os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServDatabaseChangeTracker.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServDatabaseChangeTracker.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,121 @@
     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 __LOGSERVDATABASECHANGETRACKER_H__
    1.20 +#define __LOGSERVDATABASECHANGETRACKER_H__
    1.21 +
    1.22 +#include <d32dbms.h>
    1.23 +#include "LogServBackupObserver.h"
    1.24 +#include "LogServDatabaseChangeInterface.h"
    1.25 +#include "LogServDatabaseChangeDefinition.h"
    1.26 +
    1.27 +// Classes referenced
    1.28 +class CLogChangeDefinition;
    1.29 +class MLogServBackupInterface;
    1.30 +class MLogServDatabaseTransactionInterface;
    1.31 +
    1.32 +
    1.33 +/////////////////////////////////////////////////////////////////////////////////////////
    1.34 +// -----> CLogServDatabaseChangeTracker (header)
    1.35 +/////////////////////////////////////////////////////////////////////////////////////////
    1.36 +/**
    1.37 +@internalComponent
    1.38 +*/
    1.39 +class CLogServDatabaseChangeTracker : public CActive, public MLogServBackupObserver, public MLogServDatabaseChangeInterface
    1.40 +	{
    1.41 +/////////////////////////////////////////////////////////////////////////////////////////
    1.42 +public:
    1.43 +/////////////////////////////////////////////////////////////////////////////////////////
    1.44 +	static CLogServDatabaseChangeTracker* NewL(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, TInt aPriority);
    1.45 +	~CLogServDatabaseChangeTracker();
    1.46 +
    1.47 +/////////////////////////////////////////////////////////////////////////////////////////
    1.48 +private: // INTERNAL CONSTRUCT
    1.49 +/////////////////////////////////////////////////////////////////////////////////////////
    1.50 +	CLogServDatabaseChangeTracker(MLogServDatabaseTransactionInterface& aDatabase, MLogServBackupInterface& aBackupInterface, TInt aPriority);
    1.51 +	void ConstructL();
    1.52 +
    1.53 +/////////////////////////////////////////////////////////////////////////////////////////
    1.54 +private: // FROM MLogServDatabaseChangeInterface
    1.55 +/////////////////////////////////////////////////////////////////////////////////////////
    1.56 +	void DCISubmitChangedEventContextL(TLogDatabaseChangeType aType, TLogId aEventId);
    1.57 +	void DCISubmitGlobalChangeContextL(TUid aChangeType, TInt aContextParam1, TInt aContextParam2, TInt aContextParam3);
    1.58 +	//
    1.59 +	void DCIRequestChangeNotificationsL(MLogServDatabaseChangeObserver& aObserver);
    1.60 +	void DCIRequestChangeNotificationsCancel(MLogServDatabaseChangeObserver& aObserver);
    1.61 +
    1.62 +/////////////////////////////////////////////////////////////////////////////////////////
    1.63 +private: // FROM MLogServBackupObserver
    1.64 +/////////////////////////////////////////////////////////////////////////////////////////
    1.65 +	void BOHandleEventL(TLogServBackupEvent aEvent);
    1.66 +
    1.67 +/////////////////////////////////////////////////////////////////////////////////////////
    1.68 +private: // FROM CActive
    1.69 +/////////////////////////////////////////////////////////////////////////////////////////
    1.70 +	void RunL();
    1.71 +	void DoCancel();
    1.72 +	TInt RunError(TInt aError);
    1.73 +
    1.74 +/////////////////////////////////////////////////////////////////////////////////////////
    1.75 +private: // INTERNAL METHODS
    1.76 +/////////////////////////////////////////////////////////////////////////////////////////
    1.77 +	void Request();
    1.78 +	void NotifyObserversL();
    1.79 +	void NotifyGlobalChangeEventsL();
    1.80 +	static TBool IdleNotifyGlobalChangeEvents(TAny* aSelf);
    1.81 +
    1.82 +/////////////////////////////////////////////////////////////////////////////////////////
    1.83 +private: // MEMBER DATA
    1.84 +/////////////////////////////////////////////////////////////////////////////////////////
    1.85 +
    1.86 +	/**
    1.87 +	 * Watches the database for change events
    1.88 +	 */
    1.89 +	MLogServDatabaseTransactionInterface& iDatabase;
    1.90 +
    1.91 +	/**
    1.92 +	 * Watches the database for change events
    1.93 +	 */
    1.94 +	MLogServBackupInterface& iBackupInterface;
    1.95 +
    1.96 +	/**
    1.97 +	 * Watches the database for change events
    1.98 +	 */
    1.99 +	RDbNotifier iNotifier;
   1.100 +
   1.101 +	/**
   1.102 +	 * Observers
   1.103 +	 */
   1.104 +	RPointerArray<MLogServDatabaseChangeObserver> iObservers;
   1.105 +
   1.106 +	/**
   1.107 +	 * Track changes
   1.108 +	 */
   1.109 +	CLogChangeDefinition* iChanges;
   1.110 +
   1.111 +	/**
   1.112 +	 * Used to ensure any global changes are pushed to clients
   1.113 +	 * only after all other active object operations are complete.
   1.114 +	 */
   1.115 +	CIdle* iIdler;
   1.116 +
   1.117 +	/**
   1.118 +	 * A queue of global change events
   1.119 +	 */
   1.120 +	RArray<TLogServDatabaseChangeDefinition> iGlobalChanges;
   1.121 +	};
   1.122 +
   1.123 +
   1.124 +#endif