harvester/harvesterserver/src/cblacklistmgr.cpp
changeset 1 6f2c1c46032b
parent 0 671dee74050a
child 7 a5fbfefd615f
equal deleted inserted replaced
0:671dee74050a 1:6f2c1c46032b
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "CBlacklistMgr.h"
    18 #include "CBlacklistMgr.h"
       
    19 #include "CBlacklistDb.h"
    19 #include <HarvesterServerLogger.h>
    20 #include <HarvesterServerLogger.h>
       
    21 #include "OstTraceDefinitions.h"
       
    22 #ifdef OST_TRACE_COMPILER_IN_USE
       
    23 #include "cblacklistmgrTraces.h"
       
    24 #endif
       
    25 
    20 
    26 
    21 // -----------------------------------------------------------------------------
    27 // -----------------------------------------------------------------------------
    22 // CBlacklistMgr::NewL()
    28 // CBlacklistMgr::NewL()
    23 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
    24 //
    30 //
    25 CBlacklistMgr* CBlacklistMgr::NewL()
    31 CBlacklistMgr* CBlacklistMgr::NewL()
    26     {
    32     {
       
    33     OstTraceFunctionEntry0( CBLACKLISTMGR_NEWL_ENTRY );
    27     CPIXLOGSTRING("CBlacklistMgr::NewL(): Entered");
    34     CPIXLOGSTRING("CBlacklistMgr::NewL(): Entered");
    28     CBlacklistMgr* instance = CBlacklistMgr::NewLC();
    35     CBlacklistMgr* instance = CBlacklistMgr::NewLC();
    29     CleanupStack::Pop( instance );
    36     CleanupStack::Pop( instance );
    30     CPIXLOGSTRING("CBlacklistMgr::NewL(): Exit");
    37     CPIXLOGSTRING("CBlacklistMgr::NewL(): Exit");
       
    38     OstTraceFunctionExit0( CBLACKLISTMGR_NEWL_EXIT );
    31     return instance;
    39     return instance;
    32     }
    40     }
    33 
    41 
    34 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    35 // CBlacklistMgr::NewLC()
    43 // CBlacklistMgr::NewLC()
    65 // CBlacklistMgr::ConstructL()
    73 // CBlacklistMgr::ConstructL()
    66 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    67 //
    75 //
    68 void CBlacklistMgr::ConstructL()
    76 void CBlacklistMgr::ConstructL()
    69     {
    77     {
       
    78     OstTraceFunctionEntry0( CBLACKLISTMGR_CONSTRUCTL_ENTRY );
    70     CPIXLOGSTRING("CBlacklistMgr::ConstructL(): Entered");    
    79     CPIXLOGSTRING("CBlacklistMgr::ConstructL(): Entered");    
    71     iBlacklistDb = CBlacklistDb::NewL();    
    80     iBlacklistDb = CBlacklistDb::NewL();    
    72     CPIXLOGSTRING("CBlacklistMgr::ConstructL(): Exit");    
    81     CPIXLOGSTRING("CBlacklistMgr::ConstructL(): Exit");    
       
    82     OstTraceFunctionExit0( CBLACKLISTMGR_CONSTRUCTL_EXIT );
    73     }
    83     }
    74 
    84 
    75 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
    76 // CBlacklistMgr::AddL()
    86 // CBlacklistMgr::AddL()
    77 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
    78 //
    88 //
    79 TInt CBlacklistMgr::AddL( TUid aPluginUid , TInt aVersion )
    89 TInt CBlacklistMgr::AddL( TUid aPluginUid , TInt aVersion )
    80     {
    90     {
       
    91     OstTraceFunctionEntry0( CBLACKLISTMGR_ADDL_ENTRY );
    81     //Add the item record to database
    92     //Add the item record to database
       
    93     OstTraceExt2( TRACE_NORMAL, CBLACKLISTMGR_ADDL, "CBlacklistMgr::AddL;Uid=%x;Version=%d", aPluginUid.iUid, aVersion );
    82     CPIXLOGSTRING3("CBlacklistMgr::AddL(): Uid = %x and Version = %d" , aPluginUid.iUid , aVersion);
    94     CPIXLOGSTRING3("CBlacklistMgr::AddL(): Uid = %x and Version = %d" , aPluginUid.iUid , aVersion);
    83     //Check if the record with given plugin uid is already available in database or not
    95     //Check if the record with given plugin uid is already available in database or not
    84     //If available just update version number in the same record
    96     //If available just update version number in the same record
    85     //If there is no record found in database with given uid, add new record with given details    
    97     //If there is no record found in database with given uid, add new record with given details    
    86     TInt err = KErrNone;
    98     TInt err = KErrNone;
    94         {
   106         {
    95         err = iBlacklistDb->AddL( aPluginUid.iUid , aVersion );
   107         err = iBlacklistDb->AddL( aPluginUid.iUid , aVersion );
    96         }
   108         }
    97       
   109       
    98     CPIXLOGSTRING("CBlacklistMgr::AddL(): Exit");
   110     CPIXLOGSTRING("CBlacklistMgr::AddL(): Exit");
       
   111     OstTraceFunctionExit0( CBLACKLISTMGR_ADDL_EXIT );
    99     return err;
   112     return err;
   100     }
   113     }
   101 
   114 
   102 // -----------------------------------------------------------------------------
   115 // -----------------------------------------------------------------------------
   103 // CBlacklistMgr::RemoveL()
   116 // CBlacklistMgr::RemoveL()
   104 // -----------------------------------------------------------------------------
   117 // -----------------------------------------------------------------------------
   105 //
   118 //
   106 void CBlacklistMgr::Remove( TUid aPluginUid )
   119 void CBlacklistMgr::Remove( TUid aPluginUid )
   107     {
   120     {
       
   121     OstTraceFunctionEntry0( CBLACKLISTMGR_REMOVE_ENTRY );
       
   122     OstTrace1( TRACE_NORMAL, CBLACKLISTMGR_REMOVE, "CBlacklistMgr::Remove;Uid=%x", aPluginUid.iUid );
   108     CPIXLOGSTRING2("CBlacklistMgr::RemoveL(): Uid = %x " , aPluginUid.iUid );
   123     CPIXLOGSTRING2("CBlacklistMgr::RemoveL(): Uid = %x " , aPluginUid.iUid );
   109     //Remove the item record to database
   124     //Remove the item record to database
   110     iBlacklistDb->Remove( aPluginUid.iUid );
   125     iBlacklistDb->Remove( aPluginUid.iUid );
   111     
   126     
   112     CPIXLOGSTRING("CBlacklistMgr::RemoveL(): Exit");    
   127     CPIXLOGSTRING("CBlacklistMgr::RemoveL(): Exit");    
       
   128     OstTraceFunctionExit0( CBLACKLISTMGR_REMOVE_EXIT );
   113     }
   129     }
   114 
   130 
   115 // -----------------------------------------------------------------------------
   131 // -----------------------------------------------------------------------------
   116 // CBlacklistMgr::iSAvailableL()
   132 // CBlacklistMgr::iSAvailableL()
   117 // -----------------------------------------------------------------------------
   133 // -----------------------------------------------------------------------------
   118 //
   134 //
   119 TBool CBlacklistMgr::FindL( TUid aPluginUid , TInt aVersion )
   135 TBool CBlacklistMgr::FindL( TUid aPluginUid , TInt aVersion )
   120     {
   136     {
       
   137     OstTraceExt2( TRACE_NORMAL, CBLACKLISTMGR_FINDL, "CBlacklistMgr::FindL;Uid=%x;Version=%d", aPluginUid.iUid, aVersion );
   121     CPIXLOGSTRING3("CBlacklistMgr::FindL(): Uid = %x and Version = %d" , aPluginUid.iUid , aVersion);
   138     CPIXLOGSTRING3("CBlacklistMgr::FindL(): Uid = %x and Version = %d" , aPluginUid.iUid , aVersion);
   122     //Check if the item is available in database
   139     //Check if the item is available in database
   123     TBool found = iBlacklistDb->FindWithVersionL( aPluginUid.iUid , aVersion );
   140     TBool found = iBlacklistDb->FindWithVersionL( aPluginUid.iUid , aVersion );
   124     
   141     
   125     if(found)
   142     if(found)
   126         {
   143         {
       
   144         OstTrace0( TRACE_NORMAL, DUP1_CBLACKLISTMGR_FINDL, "UID is Black listed" );
   127         CPIXLOGSTRING("UID is Black listed");
   145         CPIXLOGSTRING("UID is Black listed");
   128         }
   146         }
   129     else
   147     else
   130         {
   148         {
       
   149         OstTrace0( TRACE_NORMAL, DUP2_CBLACKLISTMGR_FINDL, "UID is not Black listed" );
   131         CPIXLOGSTRING("UID is not Black listed");
   150         CPIXLOGSTRING("UID is not Black listed");
   132         }
   151         }
   133     return found;
   152     return found;
   134     }
   153     }