omadrm/drmengine/server/inc/DRMRightsCleaner.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Interface for the DRM Rights database
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DRMRIGHTSCLEANER_H
       
    20 #define DRMRIGHTSCLEANER_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // MACROS
       
    29 
       
    30 // DATA TYPES
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class RFs;
       
    34 class CDir;
       
    35 class CDRMRightsDB;
       
    36                                                          
       
    37 
       
    38 // FUNCTION PROTOTYPES
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  CDRMRightsCleaner implements expired rights cleanup
       
    44 *  for drm rights database
       
    45 *
       
    46 *  @lib RightsServer.exe
       
    47 *  @since 3.0
       
    48 */
       
    49 
       
    50 NONSHARABLE_CLASS( CDRMRightsCleaner ) : public CActive
       
    51     {
       
    52     public: // Constructors and destructor
       
    53         
       
    54         /**
       
    55         * NewL
       
    56         *
       
    57         * Creates an instance of the CDRMRightCleaner class and returns a pointer
       
    58         * to it
       
    59         *
       
    60         * @since    3.0
       
    61         * @param    aFs : Open file server session
       
    62         * @param    aDatabase : CDRMRightsDB object
       
    63         * @param    aStatus : The request status to complete when the operation is 
       
    64         *                     fully done
       
    65         * @param    aDatabasePath : full pathname of the database path
       
    66         * @param    aTime : Time to check expiration against 
       
    67         *
       
    68         * @return   Functional CDRMRightsCleaner object, Function leaves if an error
       
    69         *           occurs.
       
    70         */
       
    71         static CDRMRightsCleaner* NewL( RFs& aFs,
       
    72                                         CDRMRightsDB* aDatabase,
       
    73                                         TRequestStatus& aStatus,
       
    74                                         const TDesC& aDatabasePath,
       
    75                                         const TTime& aTime );
       
    76           
       
    77         /**
       
    78         * Destructor
       
    79         */
       
    80         virtual ~CDRMRightsCleaner();
       
    81 
       
    82     public: // New functions    
       
    83 
       
    84         /**
       
    85         * ExecuteCleanupLD
       
    86         * 
       
    87         * Delete expired permissions. The object is deleted when
       
    88         * the function completes
       
    89         *
       
    90         * @since    3.0
       
    91         * @return   None
       
    92         *
       
    93         */      
       
    94         void ExecuteCleanupLD();
       
    95         
       
    96         void DoCleanup();
       
    97          
       
    98     protected:
       
    99         /**
       
   100         * From CActive: RunL.
       
   101         */
       
   102         void RunL();
       
   103 
       
   104 
       
   105         /**
       
   106         * From CActive: DoCancel performs cancel
       
   107         */        
       
   108         void DoCancel();
       
   109       
       
   110         /**
       
   111         * From CActive: RunError checks the errors from RunL.
       
   112         */
       
   113         TInt RunError( TInt aError );                        
       
   114                         
       
   115     private:
       
   116         /**
       
   117         * Default Constructor - First phase. Prevented.
       
   118         */
       
   119         CDRMRightsCleaner(); 
       
   120     
       
   121         /**
       
   122         * Default Constructor - First phase.
       
   123         */
       
   124         CDRMRightsCleaner( RFs& aFs,
       
   125                            CDRMRightsDB* aDatabase,
       
   126                            TRequestStatus& aStatus,
       
   127                            const TDesC& aDatabasePath,
       
   128                            const TTime& aTime ); 
       
   129         
       
   130         /**
       
   131         * ConstructL
       
   132         *
       
   133         * Second phase constructor
       
   134         *
       
   135         * @since  3.0
       
   136         * @return Leaves if an error occurs
       
   137         */  
       
   138         void ConstructL();  
       
   139 
       
   140         /**
       
   141         * Assignment operator - Prevented
       
   142         */
       
   143         CDRMRightsCleaner& operator =( const CDRMRightsCleaner& );    
       
   144     
       
   145         /**
       
   146         * Copy constructor - Prevented
       
   147         */
       
   148         CDRMRightsCleaner( const CDRMRightsCleaner& );                
       
   149      
       
   150     private:
       
   151         // fileserver session
       
   152         RFs& iFileServer;
       
   153     
       
   154         // rights database file, fileserver subsession
       
   155         CDRMRightsDB* iRightsDb;
       
   156     
       
   157         // request status to be set complete
       
   158         TRequestStatus& iOperationStatus;
       
   159         
       
   160         // Path of the rights database
       
   161         TFileName iDatabasePath;
       
   162         
       
   163         // Expiration time to check against
       
   164         TTime iExpirationTime;
       
   165         
       
   166         // Looping calculators
       
   167         CDir* iCurrentDirectory;
       
   168         
       
   169         // directory index:
       
   170         TInt iDirIndex;
       
   171         
       
   172         // FileIndex
       
   173         TInt iCurrentFile;
       
   174         
       
   175         // Cancelling call:
       
   176         TInt iCancel;
       
   177     };
       
   178 
       
   179 #endif      // DRMRIGHTSCLEANER_H   
       
   180             
       
   181 // End of File