os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServBackupManager.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 __LOGBACKUP_H__
    17 #define __LOGBACKUP_H__
    18 
    19 #include <babackup.h>
    20 #include "LogServBackupInterface.h"
    21 #include "LogServBackupObserver.h"
    22 
    23 
    24 /////////////////////////////////////////////////////////////////////////////////////////
    25 // -----> CLogServBackupManagerManager (header)
    26 /////////////////////////////////////////////////////////////////////////////////////////
    27 /**
    28 @internalComponent
    29 */
    30 class CLogServBackupManager : public CTimer, public MBackupObserver, public MLogServBackupInterface
    31 	{
    32 public:
    33 	static CLogServBackupManager* NewL(TInt aPriority = CActive::EPriorityStandard);
    34 	~CLogServBackupManager();
    35 
    36 private:
    37 	CLogServBackupManager(TInt aPriority);
    38 	void ConstructL();
    39 
    40 public: // From MLogServBackupInterface
    41 	void BIObserverAddL(MLogServBackupObserver& aObserver, TLogServBackupPriority aPriority);
    42 	void BIObserverRemove(MLogServBackupObserver& aObserver);
    43 	//
    44 	TLogServBackupState BIState() const;
    45 	TInt BIErrorValueForCurrentState() const;
    46 	//
    47 	void BISetDatabaseNameL(const TDesC& aDatabaseName);
    48 
    49 private: // From CActive
    50 	void RunL();
    51 	TInt RunError(TInt aError);
    52 
    53 private: // Internal structs
    54 	struct TLogBackupNotificationEntry
    55 		{
    56 	public:
    57 		inline TLogBackupNotificationEntry(MLogServBackupObserver& aObserver, TLogServBackupPriority aPriority) : iObserver(aObserver), iPriority(aPriority) { };
    58 
    59 	public:
    60 		MLogServBackupObserver& iObserver;
    61 		TLogServBackupPriority iPriority;
    62 		};
    63 
    64 private:
    65 	TInt NotifyObservers(MLogServBackupObserver::TLogServBackupEvent aEvent);
    66 	void ChangeFileLockL(const TDesC& aFileName,TFileLockFlags aFlags);
    67 	CBaBackupSessionWrapper* CreateBackupL(const TDesC& aLogDatabaseFileName);
    68 	static TInt CompareEntries(const TLogBackupNotificationEntry& aLeft, const TLogBackupNotificationEntry& aRight);
    69 
    70 private:
    71 	/**
    72 	 * So we can check we only act upon the correct backup event... essentially
    73 	 * we are not trusting the backup server to do the right thing.
    74 	 */
    75 	HBufC* iDatabaseName;
    76 	
    77 	/**
    78 	 * Interface to the backup server
    79 	 */
    80 	CBaBackupSessionWrapper* iBackup;
    81 
    82 	/**
    83 	 * Current state
    84 	 */
    85 	TLogServBackupState iState;
    86 
    87 	/**
    88 	 * Backup notification queue
    89 	 */
    90 	RArray<TLogBackupNotificationEntry> iObservers;
    91 	};
    92 
    93 
    94 #endif