harvester/monitorplugins/fileplugin/inc/filemonitorao.h
changeset 0 c53acadfccc6
child 3 6752808b2036
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Monitors file creations, modifications and deletions.*
       
    15 */
       
    16 
       
    17 #ifndef __FILEMONITORAO_H__
       
    18 #define __FILEMONITORAO_H__
       
    19 
       
    20 #include <e32base.h>
       
    21 
       
    22 #include "mdsfileserverpluginclient.h"
       
    23 #include "harvesterdata.h"
       
    24 
       
    25 // FORWARD DECLARATION
       
    26 class CMdEHarvesterSession;
       
    27 class CProcessOriginMapper;
       
    28 class CHarvesterPluginFactory;
       
    29 class CFileEventHandlerAO;
       
    30 
       
    31 class CFileMonitorAO : public CActive
       
    32     {
       
    33     public:
       
    34         /**
       
    35         * Creates and constructs a new instance of CFileMonitorAO.
       
    36         *
       
    37         * @return A pointer to the new instance of CFileMonitorAO
       
    38         */
       
    39         static CFileMonitorAO* NewL();
       
    40         
       
    41         /**
       
    42         * Destructor
       
    43         */
       
    44         virtual ~CFileMonitorAO();
       
    45         
       
    46         /**
       
    47         * Starts monitoring file system for file creations, modifications and deletions
       
    48         * in the specified path.
       
    49         *
       
    50         * @param aObserver  All events are notified via aObserver.
       
    51         * @param aPath  The path to monitor.
       
    52         * @param aHarvesterPluginFactory  A pointer to the harvester plugin factory.
       
    53         * @return ETrue if success, EFalse if not
       
    54         */
       
    55         TBool StartMonitoring( MMonitorPluginObserver& aObserver,
       
    56         		CMdESession* aMdeSession, const TDesC& aPath,
       
    57         		CHarvesterPluginFactory* aHarvesterPluginFactory );
       
    58         
       
    59         /**
       
    60         * Stops monitoring.
       
    61         *
       
    62         * @return ETrue if success, EFalse if not
       
    63         */
       
    64         TBool StopMonitoring();
       
    65         
       
    66         /**
       
    67         * Inherited from CActive. This method will be called on file server notifying.
       
    68         */
       
    69         void RunL();
       
    70         
       
    71         /**
       
    72         * Handles a leave occurring in the request completion event handler RunL().
       
    73         *
       
    74         * @param aError  An error code.
       
    75         * @return An error code.
       
    76         */
       
    77         TInt RunError( TInt aError );
       
    78         
       
    79         /**
       
    80         * Cancels file server notifying. Inherited from CActive.
       
    81         */
       
    82         void DoCancel();
       
    83         
       
    84         /**
       
    85          * Gets a reference to process / origin mapper, which
       
    86          * can be used to register and match which process ids
       
    87          * with a mde object's Origin value.
       
    88          * @return Handle to File monitor's CProcessOriginMapper.
       
    89          */
       
    90         CProcessOriginMapper& Mapper();
       
    91         
       
    92         /**
       
    93          * Set file event caching on/off
       
    94          */
       
    95         void SetCachingStatus( TBool aCachingStatus );
       
    96         
       
    97         
       
    98     private:
       
    99         /**
       
   100         * C++ constructor - not exported;
       
   101         * implicitly called from NewL()
       
   102         */
       
   103         CFileMonitorAO();
       
   104         
       
   105         /**
       
   106         * 2nd phase construction, called by NewL()
       
   107         */
       
   108         void ConstructL();
       
   109         
       
   110         /**
       
   111         * Starts file server to notify us about file changes.
       
   112         */
       
   113         void StartNotify();
       
   114         
       
   115         /**
       
   116          * 
       
   117          */
       
   118         void ResetMdsFSPStatus();
       
   119         
       
   120     private:
       
   121         /**
       
   122          * @var An observer class to notify about file creations, modifications and deletions.
       
   123          */
       
   124     	MMonitorPluginObserver* iObserver;
       
   125         
       
   126         /**
       
   127          * @var A file server.
       
   128          */
       
   129         RFs iFs;
       
   130 
       
   131         /**
       
   132          * @var Flag to signal if iFs is connected.
       
   133          */
       
   134         TBool iFsConnectOk;
       
   135         
       
   136         /**
       
   137          * @var An ignore list. Contains paths not to monitor.
       
   138          */
       
   139         RPointerArray<TDesC> iIgnoreList;
       
   140 
       
   141         /**
       
   142          * 
       
   143          */
       
   144         RMdsFSPEngine iEngine;
       
   145         
       
   146         /**
       
   147          * 
       
   148          */
       
   149         TMdsFSPStatusPckg iStatusPckg;
       
   150 
       
   151         /**
       
   152          * @var Mde client session pointer.
       
   153          */
       
   154         CMdEHarvesterSession* iMdeSession;
       
   155         
       
   156         /**
       
   157          * @var Harvester plugin factory pointer.
       
   158          */
       
   159         CHarvesterPluginFactory* iHarvesterPluginFactory;
       
   160         
       
   161         CFileEventHandlerAO* iFileEventHandler;
       
   162     };
       
   163 
       
   164 #endif // __FILEMONITORAO_H__