1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServBackupManager.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,94 @@
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 __LOGBACKUP_H__
1.20 +#define __LOGBACKUP_H__
1.21 +
1.22 +#include <babackup.h>
1.23 +#include "LogServBackupInterface.h"
1.24 +#include "LogServBackupObserver.h"
1.25 +
1.26 +
1.27 +/////////////////////////////////////////////////////////////////////////////////////////
1.28 +// -----> CLogServBackupManagerManager (header)
1.29 +/////////////////////////////////////////////////////////////////////////////////////////
1.30 +/**
1.31 +@internalComponent
1.32 +*/
1.33 +class CLogServBackupManager : public CTimer, public MBackupObserver, public MLogServBackupInterface
1.34 + {
1.35 +public:
1.36 + static CLogServBackupManager* NewL(TInt aPriority = CActive::EPriorityStandard);
1.37 + ~CLogServBackupManager();
1.38 +
1.39 +private:
1.40 + CLogServBackupManager(TInt aPriority);
1.41 + void ConstructL();
1.42 +
1.43 +public: // From MLogServBackupInterface
1.44 + void BIObserverAddL(MLogServBackupObserver& aObserver, TLogServBackupPriority aPriority);
1.45 + void BIObserverRemove(MLogServBackupObserver& aObserver);
1.46 + //
1.47 + TLogServBackupState BIState() const;
1.48 + TInt BIErrorValueForCurrentState() const;
1.49 + //
1.50 + void BISetDatabaseNameL(const TDesC& aDatabaseName);
1.51 +
1.52 +private: // From CActive
1.53 + void RunL();
1.54 + TInt RunError(TInt aError);
1.55 +
1.56 +private: // Internal structs
1.57 + struct TLogBackupNotificationEntry
1.58 + {
1.59 + public:
1.60 + inline TLogBackupNotificationEntry(MLogServBackupObserver& aObserver, TLogServBackupPriority aPriority) : iObserver(aObserver), iPriority(aPriority) { };
1.61 +
1.62 + public:
1.63 + MLogServBackupObserver& iObserver;
1.64 + TLogServBackupPriority iPriority;
1.65 + };
1.66 +
1.67 +private:
1.68 + TInt NotifyObservers(MLogServBackupObserver::TLogServBackupEvent aEvent);
1.69 + void ChangeFileLockL(const TDesC& aFileName,TFileLockFlags aFlags);
1.70 + CBaBackupSessionWrapper* CreateBackupL(const TDesC& aLogDatabaseFileName);
1.71 + static TInt CompareEntries(const TLogBackupNotificationEntry& aLeft, const TLogBackupNotificationEntry& aRight);
1.72 +
1.73 +private:
1.74 + /**
1.75 + * So we can check we only act upon the correct backup event... essentially
1.76 + * we are not trusting the backup server to do the right thing.
1.77 + */
1.78 + HBufC* iDatabaseName;
1.79 +
1.80 + /**
1.81 + * Interface to the backup server
1.82 + */
1.83 + CBaBackupSessionWrapper* iBackup;
1.84 +
1.85 + /**
1.86 + * Current state
1.87 + */
1.88 + TLogServBackupState iState;
1.89 +
1.90 + /**
1.91 + * Backup notification queue
1.92 + */
1.93 + RArray<TLogBackupNotificationEntry> iObservers;
1.94 + };
1.95 +
1.96 +
1.97 +#endif