omadrm/drmengine/server/inc/DRMActiveOperation.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:  Active object handling "Delete Expired Permission"
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DRMACTIVEOPERATION_H
       
    20 #define DRMACTIVEOPERATION_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <s32file.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 const TInt KOperationDeleteExpired  = 1;
       
    30 const TInt KOperationExportObsolete = 2;
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CDRMRightsDB;
       
    38 class CDRMDbSession;
       
    39 class RFs;
       
    40                                                      
       
    41 
       
    42 // FUNCTION PROTOTYPES
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 *  CDRMActiveOperation implements active objects for
       
    48 *  for drm rights server
       
    49 *
       
    50 *  @lib RightsServer.exe
       
    51 *  @since 3.0
       
    52 */
       
    53 NONSHARABLE_CLASS( CDRMActiveOperation ) : public CActive
       
    54     {
       
    55     public: // Typedefs
       
    56     typedef enum 
       
    57         {
       
    58         EOperationNone = 0,
       
    59         EOperationDeleteExpired  = 1,
       
    60         EOperationExportObsolete = 2    
       
    61         } TOperationType;
       
    62     
       
    63     public: // Constructors and destructor
       
    64         
       
    65         /**
       
    66         * NewLC
       
    67         *
       
    68         * Creates an instance of CDRMActiveOperation class and returns a pointer to it
       
    69         * also leaves the object to the cleanup stack
       
    70         *
       
    71         * @since    3.0
       
    72         * @param    aMessage: the asynchronous message
       
    73         * @param    aSession : Session this operation is connected to
       
    74         * @param    aOperation : The operation to perform
       
    75         * @return   Functional CDRMActiveOperation object, Function leaves if an error
       
    76         *           occurs.
       
    77         */
       
    78         static CDRMActiveOperation* NewLC( const RMessagePtr2& aMessage,
       
    79                                           CDRMDbSession& aSession,
       
    80                                           TOperationType aOperation );
       
    81           
       
    82         /**
       
    83         * Destructor
       
    84         */
       
    85         virtual ~CDRMActiveOperation();
       
    86 
       
    87     public: // New functions    
       
    88 
       
    89         /**
       
    90         * ActivateL
       
    91         * 
       
    92         * Activates the object by adding it to scheduler etc.
       
    93         *
       
    94         * @since    3.0
       
    95         * @return   None
       
    96         *
       
    97         */      
       
    98         void ActivateL( CDRMRightsDB& aDb,
       
    99                         const TTime& aSecureTime );
       
   100 
       
   101 
       
   102         /**
       
   103         * ActivateL
       
   104         * 
       
   105         * Activates the object by adding it to scheduler etc.
       
   106         *
       
   107         * @since    3.0
       
   108         * @return   None
       
   109         *
       
   110         */      
       
   111         void ActivateL( CDRMRightsDB& aDb,
       
   112                         RFs& aFileServer,
       
   113                         const TDesC& aTempPath, 
       
   114                         const TBool aPerformScan = EFalse );
       
   115          
       
   116          
       
   117         void Remove(); 
       
   118     protected:
       
   119     
       
   120         /**
       
   121         * Default Constructor - First phase.
       
   122         */
       
   123         CDRMActiveOperation( const RMessagePtr2& aMessage,
       
   124                             CDRMDbSession& aSession,
       
   125                             TOperationType aOperation ); 
       
   126         
       
   127         /**
       
   128         * From CActive: RunL.
       
   129         */
       
   130         void RunL();
       
   131 
       
   132         /**
       
   133         * From CActive: DoCancel performs cancel
       
   134         */        
       
   135         void DoCancel();
       
   136       
       
   137         /**
       
   138         * From CActive: RunError checks the errors from RunL.
       
   139         */
       
   140         // void RunError();                        
       
   141                         
       
   142     private:
       
   143         /**
       
   144         * Default Constructor - First phase. Prevented.
       
   145         */
       
   146         CDRMActiveOperation(); 
       
   147     
       
   148         /**
       
   149         * Assignment operator - Prevented
       
   150         */
       
   151         CDRMActiveOperation& operator =( const CDRMActiveOperation& );    
       
   152     
       
   153         /**
       
   154         * Copy constructor - Prevented
       
   155         */
       
   156         CDRMActiveOperation( const CDRMActiveOperation& );                
       
   157      
       
   158     private:
       
   159         // The message.
       
   160         const RMessagePtr2& iMessage;
       
   161         CDRMDbSession& iSession;
       
   162         
       
   163         // The operation to perform
       
   164         TOperationType iOperation;
       
   165         
       
   166         // The instance doing the operation.
       
   167         CActive* iActiveOperation;
       
   168         
       
   169         // File name of the operation
       
   170         TFileName* iFileName;
       
   171         RFileWriteStream iFileStream;
       
   172         RFs* iFileServer;
       
   173     };
       
   174 
       
   175 #endif      // DRMACTIVEOPERATION_H   
       
   176             
       
   177 // End of File