contentstorage/casrv/causifscanner/inc/causifscanner.h
changeset 66 32469d7d46ff
parent 60 f62f87b200ec
child 80 397d00875918
equal deleted inserted replaced
61:8e5041d13c84 66:32469d7d46ff
    22 #include <e32std.h>
    22 #include <e32std.h>
    23 #include <usif/sif/sifcommon.h>
    23 #include <usif/sif/sifcommon.h>
    24 #include <usif/scr/scr.h>
    24 #include <usif/scr/scr.h>
    25 
    25 
    26 #include "casrvplugin.h"
    26 #include "casrvplugin.h"
       
    27 #include "cainstallnotifier.h"
       
    28 #include "cammcwatcher.h"
    27 
    29 
    28 class CCaStorageProxy;
    30 class CCaStorageProxy;
    29 class CCaInnerEntry;
    31 class CCaInnerEntry;
    30 
    32 
    31 using namespace Usif;
    33 using namespace Usif;
    32 
    34 
    33 /*
    35 /*
    34  An implementation of the CCaSrvPlugin interface for the Reference Installer.
    36  An implementation of the CCaSrvPlugin interface for the Reference Installer.
    35 
    37 
    36  The CaSrvManager loads and uses this plug-in when the MIME type of a package is 'binary/sif-refpkg'.
    38  The CaSrvManager loads and uses this plug-in when the MIME type of a package
       
    39  is 'binary/sif-refpkg'.
    37  */
    40  */
    38 NONSHARABLE_CLASS(CCaUsifScanner): public CCaSrvPlugin
    41 NONSHARABLE_CLASS(CCaUsifScanner): public CCaSrvPlugin,
       
    42         public MCaInstallListener, public MMmcWatcherCallback
    39     {
    43     {
    40 public:
    44 public:
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      * @param aPLuginParam plugin param consist of storage, storage utils.
       
    49      * @retval New object.
       
    50      */
    41     static CCaUsifScanner* NewL( TPluginParams* aPluginParams );
    51     static CCaUsifScanner* NewL( TPluginParams* aPluginParams );
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
    42     ~CCaUsifScanner();
    56     ~CCaUsifScanner();
    43 
    57 
    44     void InstallL( const TDesC& aFileName );
    58     /**
       
    59      * Installs application.
       
    60      * @param aFileName File name to be installed.
       
    61      */
       
    62     //    void InstallL( const TDesC& aFileName );
       
    63 
       
    64 public:
       
    65     // from MCaInstallListener
       
    66 
       
    67     /**
       
    68      * Handle Install/Uninstall Event.
       
    69      * @since S60 v5.0
       
    70      * @param aUid installed uid.
       
    71      */
       
    72     void HandleInstallNotifyL( TInt aUid );
       
    73 
       
    74     /**
       
    75      * MmcChangeL is called when the MMC is removed or inserted.
       
    76      */
       
    77     void MmcChangeL();
    45 
    78 
    46 private:
    79 private:
       
    80 
       
    81     /**
       
    82      * Constructor
       
    83      * @param aStorageProxy Storage handler.
       
    84      */
    47     CCaUsifScanner( CCaStorageProxy& aStorageProxy );
    85     CCaUsifScanner( CCaStorageProxy& aStorageProxy );
       
    86 
       
    87     /**
       
    88      * Second phased constructor.
       
    89      */
    48     void ConstructL();
    90     void ConstructL();
       
    91 
       
    92     /**
       
    93      * Copy constructor.
       
    94      */
    49     CCaUsifScanner( const CCaUsifScanner & );
    95     CCaUsifScanner( const CCaUsifScanner & );
       
    96 
       
    97     /**
       
    98      * Operator "=". Assigns new object.
       
    99      *
       
   100      */
    50     CCaUsifScanner& operator =( const CCaUsifScanner & );
   101     CCaUsifScanner& operator =( const CCaUsifScanner & );
    51 
   102 
    52     void AddCollectionUsifL();
   103     /**
    53     TInt GetCollectionUsifIdL();
   104      * Creates AppLib's entry from Usif's entry
    54 
   105      * @param aEntry Usif entry obtained from Sif database.
       
   106      * @param aCaEntry AppLib entry to be filled from Usif entry.
       
   107      */
    55     void CreateCaEntryFromEntryL( const CComponentEntry* aEntry,
   108     void CreateCaEntryFromEntryL( const CComponentEntry* aEntry,
    56             CCaInnerEntry* aCaEntry );
   109             CCaInnerEntry* aCaEntry );
    57 
   110 
    58     void AddNativeAppsL();
   111     /**
    59 
   112      * Adds package to database. Scans Sif db and adds entries to AppLib db.
    60     void GetCaAppEntriesL( RPointerArray<CCaInnerEntry>& aArray );
   113      */
    61 
   114     void AddPackageL();
    62     TInt AppExist( RPointerArray<CCaInnerEntry>& aArray,
   115 
    63             CCaInnerEntry* aEntry );
   116     /**
       
   117      * Updates package in the database.
       
   118      */
       
   119     void UpdatePackagesL();
       
   120 
       
   121     /**
       
   122      * Gets entries from AppLib story.
       
   123      * @param aArray Array of entries to be obtained from db.
       
   124      */
       
   125     void GetCaPackageEntriesL( RPointerArray<CCaInnerEntry>& aArray );
       
   126 
       
   127     /**
       
   128      * Gets entries from Usif story.
       
   129      * @param aArray Array of entries to be obtained from db.
       
   130      */
       
   131     void GetUsifPackageEntriesL( RPointerArray<CComponentEntry>& aArray );
       
   132 
       
   133     /**
       
   134      *  Checks if entry exists in AppLib db.
       
   135      *  @param aArray Array of entries from AppLib db.
       
   136      *  @param aEntry Entry data to be checked if exists.
       
   137      *  @retval Returns array index if exists, otherwise KErrNotFound.
       
   138      */
       
   139     TInt PackageExistL( RPointerArray<CCaInnerEntry>& aArray,
       
   140             const CComponentEntry* aEntry );
       
   141 
       
   142     /**
       
   143      *  Finds deleted entries from Usif. Updates aCaArray.
       
   144      *  @param aCaArray Entries from AppLib db.
       
   145      *  @param aUsifArray Entries from Usif db.
       
   146      */
       
   147     void FindDeletedEntriesL( RPointerArray<CCaInnerEntry>& aCaArray,
       
   148             const RPointerArray<CComponentEntry>& aUsifArray );
       
   149 
       
   150     /**
       
   151      * Removes entries from db.
       
   152      * @param aCaArray Entries to be removed.
       
   153      */
       
   154     void RemoveEntriesFromDbL( RPointerArray<CCaInnerEntry>& aCaArray );
       
   155 
       
   156     /**
       
   157      * Update usif list.
       
   158      */
       
   159     void UpdateUsifListL();
    64 
   160 
    65 private:
   161 private:
    66     /*
   162     /**
    67      * not own
   163      * not own
       
   164      * Storage proxy.
    68      */
   165      */
    69     CCaStorageProxy& iStorageProxy;
   166     CCaStorageProxy& iStorageProxy;
    70 
   167 
    71     /*
   168     /**
    72      * Usif Collection id. Temporary solution.
   169      * Install notifier. Own.
    73      */
   170      */
    74     TInt iCollectionUsifId;
   171     CCaInstallNotifier *iSystemInstallNotifier;
       
   172 
       
   173     /**
       
   174      * Uninstall notifier. Own.
       
   175      */
       
   176     CCaInstallNotifier *iUsifUninstallNotifier;
       
   177 
       
   178     /**
       
   179      * Install and uninstall notifier. Own.
       
   180      */
       
   181     CCaInstallNotifier *iJavaInstallNotifier;
       
   182 
       
   183     /**
       
   184      * File session. Own
       
   185      */
       
   186     RFs iFs;
       
   187 
       
   188     /**
       
   189      * Mmc watcher. Own.
       
   190      */
       
   191     CCaMmcWatcher* iMmcWatcher;
       
   192 
       
   193     /**
       
   194      * Software component registry. Own.
       
   195      */
       
   196     RSoftwareComponentRegistry iSoftwareRegistry;
       
   197 
    75     };
   198     };
    76 
   199 
    77 #endif // CAUSIFSCANNER_H
   200 #endif // CAUSIFSCANNER_H