omadrm/drmengine/server/inc/DRMObsoleteFinder.h
changeset 0 95b198f216e5
child 12 8a03a285ab14
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 DRMOBSOLETEFINDER_H
       
    20 #define DRMOBSOLETEFINDER_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include "drmpointerarray.h"
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // DATA TYPES
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class RFs;
       
    35 class CDir;
       
    36 class CDRMRightsDB;
       
    37 class CDcfRep;
       
    38                                                          
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  CDRMObsoleteFinder implements expired rights cleanup
       
    46 *  for drm rights database
       
    47 *
       
    48 *  @lib RightsServer.exe
       
    49 *  @since 3.0
       
    50 */
       
    51 
       
    52 NONSHARABLE_CLASS( CDRMObsoleteFinder ) : public CActive
       
    53     {
       
    54     public: // Constructors and destructor
       
    55         
       
    56         /**
       
    57         * NewL
       
    58         *
       
    59         * Creates an instance of the CDRMObsoleteFinder class and returns a pointer
       
    60         * to it
       
    61         *
       
    62         * @since    3.0
       
    63         * @param    aFs : Open file server session
       
    64         * @param    aDatabase : CDRMRightsDB object
       
    65         * @param    aStatus : The request status to complete when the operation is 
       
    66         *                     fully done
       
    67         * @param    aStream : stream to write the result into
       
    68         * @param    aPerformScan : if a filesystem scan need to be performed
       
    69         *
       
    70         * @return   Functional CDRMObsoleteFinder object, Function leaves if an error
       
    71         *           occurs.
       
    72         */
       
    73         static CDRMObsoleteFinder* NewL( RFs& aFs,
       
    74                                         CDRMRightsDB* aDatabase,
       
    75                                         TRequestStatus& aStatus,
       
    76                                         RWriteStream& aStream,
       
    77                                         TBool aPerformScan );
       
    78           
       
    79         /**
       
    80         * Destructor
       
    81         */
       
    82         virtual ~CDRMObsoleteFinder();
       
    83 
       
    84     public: // New functions    
       
    85 
       
    86         /**
       
    87         * ExecuteCleanupLD
       
    88         * 
       
    89         * Delete expired permissions. The object is deleted when
       
    90         * the function completes
       
    91         *
       
    92         * @since    3.0
       
    93         * @return   None
       
    94         *
       
    95         */      
       
    96         void ExecuteFinderLD();
       
    97         
       
    98         
       
    99         void DoCleanup();
       
   100          
       
   101     protected:
       
   102         /**
       
   103         * From CActive: RunL.
       
   104         */
       
   105         void RunL();
       
   106 
       
   107 
       
   108         /**
       
   109         * From CActive: DoCancel performs cancel
       
   110         */        
       
   111         void DoCancel();
       
   112       
       
   113         /**
       
   114         * From CActive: RunError checks the errors from RunL.
       
   115         */
       
   116         TInt RunError( TInt aError );                        
       
   117                         
       
   118     private:
       
   119         /**
       
   120         * Default Constructor - First phase. Prevented.
       
   121         */
       
   122         CDRMObsoleteFinder(); 
       
   123     
       
   124         /**
       
   125         * Default Constructor - First phase.
       
   126         */
       
   127         CDRMObsoleteFinder( RFs& aFs,
       
   128                             CDRMRightsDB* aDatabase,
       
   129                             TRequestStatus& aStatus,
       
   130                             RWriteStream& aStream ); 
       
   131         
       
   132         /**
       
   133         * ConstructL
       
   134         *
       
   135         * Second phase constructor
       
   136         *
       
   137         * @since  3.0
       
   138         * @return Leaves if an error occurs
       
   139         */  
       
   140         void ConstructL( const TBool aPerformScan );  
       
   141 
       
   142         /**
       
   143         * Assignment operator - Prevented
       
   144         */
       
   145         CDRMObsoleteFinder& operator =( const CDRMObsoleteFinder& );    
       
   146     
       
   147         /**
       
   148         * Copy constructor - Prevented
       
   149         */
       
   150         CDRMObsoleteFinder( const CDRMObsoleteFinder& );                
       
   151 
       
   152 
       
   153         /**
       
   154         * Get possible parents the content if there are any
       
   155         *
       
   156         * @since    3.0
       
   157         * @param    aContentId : identifier of the content whom to check for
       
   158         *                        parents
       
   159         * @param    aParents : pointer array of parents the new ones will be
       
   160         *                      inserted
       
   161         * @return none
       
   162         */
       
   163         void GetParentsL( const TDesC8& aContentId,
       
   164                           RPointerArray<HBufC8>& aParents );
       
   165 
       
   166         /**
       
   167         * Write the Obsolete contents to the stream
       
   168         *
       
   169         * @since    3.0
       
   170         * @return   none
       
   171         * @leave    Symbian OS error code
       
   172         */
       
   173         void ObsoleteToStreamL();
       
   174      
       
   175     private:
       
   176         // Dcf repository client
       
   177         CDcfRep* iDcfClient;
       
   178         
       
   179         // List of content id's
       
   180         CDRMPointerArray<HBufC8>* iContents;
       
   181         
       
   182         // List of content id's
       
   183         CDRMPointerArray<HBufC8>* iParents;
       
   184         
       
   185         // List of content id's
       
   186         CDRMPointerArray<HBufC8>* iNoContents;
       
   187                                
       
   188         // Index we are going at:
       
   189         TInt iIndex;
       
   190     
       
   191         // fileserver session
       
   192         RFs& iFileServer;
       
   193 
       
   194         // output stream
       
   195         RWriteStream& iStream;
       
   196     
       
   197         // rights database file, fileserver subsession
       
   198         CDRMRightsDB* iRightsDb;
       
   199     
       
   200         // request status to be set complete
       
   201         TRequestStatus& iOperationStatus;
       
   202         
       
   203         // State of the active object
       
   204         TInt iState;
       
   205         
       
   206         // Cancelling status
       
   207         TInt iCancel;
       
   208     };
       
   209 
       
   210 #endif      // DRMOBSOLETEFINDER_H   
       
   211             
       
   212 // End of File