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 __LOGBACKUP_H__ sl@0: #define __LOGBACKUP_H__ sl@0: sl@0: #include sl@0: #include "LogServBackupInterface.h" sl@0: #include "LogServBackupObserver.h" sl@0: sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: // -----> CLogServBackupManagerManager (header) sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: class CLogServBackupManager : public CTimer, public MBackupObserver, public MLogServBackupInterface sl@0: { sl@0: public: sl@0: static CLogServBackupManager* NewL(TInt aPriority = CActive::EPriorityStandard); sl@0: ~CLogServBackupManager(); sl@0: sl@0: private: sl@0: CLogServBackupManager(TInt aPriority); sl@0: void ConstructL(); sl@0: sl@0: public: // From MLogServBackupInterface sl@0: void BIObserverAddL(MLogServBackupObserver& aObserver, TLogServBackupPriority aPriority); sl@0: void BIObserverRemove(MLogServBackupObserver& aObserver); sl@0: // sl@0: TLogServBackupState BIState() const; sl@0: TInt BIErrorValueForCurrentState() const; sl@0: // sl@0: void BISetDatabaseNameL(const TDesC& aDatabaseName); sl@0: sl@0: private: // From CActive sl@0: void RunL(); sl@0: TInt RunError(TInt aError); sl@0: sl@0: private: // Internal structs sl@0: struct TLogBackupNotificationEntry sl@0: { sl@0: public: sl@0: inline TLogBackupNotificationEntry(MLogServBackupObserver& aObserver, TLogServBackupPriority aPriority) : iObserver(aObserver), iPriority(aPriority) { }; sl@0: sl@0: public: sl@0: MLogServBackupObserver& iObserver; sl@0: TLogServBackupPriority iPriority; sl@0: }; sl@0: sl@0: private: sl@0: TInt NotifyObservers(MLogServBackupObserver::TLogServBackupEvent aEvent); sl@0: void ChangeFileLockL(const TDesC& aFileName,TFileLockFlags aFlags); sl@0: CBaBackupSessionWrapper* CreateBackupL(const TDesC& aLogDatabaseFileName); sl@0: static TInt CompareEntries(const TLogBackupNotificationEntry& aLeft, const TLogBackupNotificationEntry& aRight); sl@0: sl@0: private: sl@0: /** sl@0: * So we can check we only act upon the correct backup event... essentially sl@0: * we are not trusting the backup server to do the right thing. sl@0: */ sl@0: HBufC* iDatabaseName; sl@0: sl@0: /** sl@0: * Interface to the backup server sl@0: */ sl@0: CBaBackupSessionWrapper* iBackup; sl@0: sl@0: /** sl@0: * Current state sl@0: */ sl@0: TLogServBackupState iState; sl@0: sl@0: /** sl@0: * Backup notification queue sl@0: */ sl@0: RArray iObservers; sl@0: }; sl@0: sl@0: sl@0: #endif