brandingserver/BSServer/cbsinstallhandler.h
changeset 31 9dbc70490d9a
equal deleted inserted replaced
30:1fa9b890f29c 31:9dbc70490d9a
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:  cbsinstallhandler.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CBSINSTALLHANDLER_H__
       
    21 #define __CBSINSTALLHANDLER_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class RFs;
       
    27 
       
    28 /**
       
    29  * CBSInstallHandler
       
    30  *
       
    31  * Handles installation and uninstallation of brand packages.
       
    32  * Calls external application "bsinstall.exe" to do the actual work.
       
    33  * Can Observe the installation directory so that any sis installation
       
    34  * can be detected while the server is running.
       
    35  *
       
    36  */
       
    37 NONSHARABLE_CLASS( CBSInstallHandler ): public CActive
       
    38 	{
       
    39 	public: 
       
    40 	    
       
    41 	    // Operations for folder synchronization:
       
    42 	    enum TInstallOperation
       
    43 	        {
       
    44 	        // copy files from source to destination if they don't
       
    45 	        // already exists. 
       
    46 	        EInstallCopyNewToDest,
       
    47 	        
       
    48 	        // Delete files from source directory if the same
       
    49 	        // files doesn't exist in destination directory.
       
    50 	        EInstallDeleteFromSrc
       
    51 	        };
       
    52 	
       
    53 	public: // constructors
       
    54 		
       
    55 		static CBSInstallHandler* NewL();
       
    56 
       
    57     	virtual ~CBSInstallHandler();
       
    58 
       
    59 	private: // constructors
       
    60 	
       
    61 		void ConstructL();
       
    62 						 
       
    63 		CBSInstallHandler();
       
    64 
       
    65 	public:
       
    66 	
       
    67         /**
       
    68         * Uninstall removed brands and installs new brands.
       
    69         * This should be called right after construction to sync the
       
    70         * installation state.
       
    71         */
       
    72         void InstallNewFilesL();
       
    73         
       
    74         /**
       
    75         * Start observing installation folder. Detects new brands if they
       
    76         * are installed while the server is active.
       
    77         */
       
    78         void StartObservingL();
       
    79         
       
    80         /**
       
    81         * Stop observing installation folder. All new brands are installed
       
    82         * only when calling InstallNewFilesL.
       
    83         */
       
    84         void StopObserving();
       
    85 
       
    86     private: // From CActive
       
    87     
       
    88         /**
       
    89         * @see CActive
       
    90         */
       
    91         void RunL();
       
    92         
       
    93         /**
       
    94         * @see CActive
       
    95         */
       
    96         void DoCancel();
       
    97 
       
    98     private: // new methods
       
    99         
       
   100         /**
       
   101         * Launches external installer application. It should install all
       
   102         * available brands into server.
       
   103         */
       
   104         void LaunchInstallerAppL();
       
   105                
       
   106         /**
       
   107         * Sync files between aSrcDir and aDestDir, according to given 
       
   108         * operation. See TInstallOperation for operations. Calls 
       
   109         * OperationNotifyL before every operation.
       
   110         *
       
   111         * @param aSrcDir Source directory
       
   112         * @param aDestDir Destination directory
       
   113         * @param aOperation Sync operation to execute
       
   114         * @return ETrue  - Something synchronized
       
   115         *         EFalse - Nothing synchronized
       
   116         */
       
   117         TBool SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, 
       
   118                           TInstallOperation aOperation );
       
   119         
       
   120         /**
       
   121         * Notification that file is about to be synchronized. 
       
   122         *
       
   123         * @param aOperation operation type which will be executed
       
   124         * @param aSrcFile file under operation
       
   125         */
       
   126         void OperationNotifyL( TInstallOperation aOperation, 
       
   127                                const TDesC& aSrcFile );
       
   128         
       
   129         /**
       
   130         * check if some version of given brand is installed in
       
   131         * branding server. 
       
   132         *
       
   133         * @param aBrand brand installation file to check
       
   134         *        this has to be brand file name without extension and 
       
   135         *        version information.
       
   136         */
       
   137         TBool IsBrandInstalled( const TDesC& aBrand );                  
       
   138 
       
   139         /**
       
   140         * Helper method to get servers private path
       
   141         * @param aPath contains the path to servers private folder
       
   142         * @param aAppend text to add into private path.
       
   143         */
       
   144         void GetPrivateFolder( TDes& aPath, const TDesC& aAppend = KNullDesC );
       
   145 	
       
   146         /**
       
   147         * To create a flag file if brand gets discarded
       
   148         * @param aSrcFile file under operation
       
   149         */
       
   150 		void CreateFlagFile(const TDesC& aSrcFile);
       
   151 
       
   152         /**
       
   153         * Checks if an discarded brand exists.
       
   154         * (It also writes the RProperty for the bsinstall.exe)
       
   155         *
       
   156         * @param aDir the folder of the data storages
       
   157         * @return ETrue, in case a discarded brand was found, EFalse otherwise
       
   158         */
       
   159         TBool CheckForDiscardedBrandsL( const TDesC& aDir );
       
   160         
       
   161         
       
   162         /**
       
   163         * Updates the RProperty. The specified string is added to the
       
   164         * RProperty only if RProperty does not contain the same string yet.
       
   165         *
       
   166         * @param aUninstallationString a string
       
   167         */
       
   168         void UpdateRPropertyL( const TDesC& aUninstallationString );
       
   169         
       
   170 	private: // data
       
   171 
       
   172         // Own. File server session handle.
       
   173         RFs     iFs;
       
   174     };
       
   175 
       
   176 #endif      //  __CBSINSTALLHANDLER_H__
       
   177 //  END OF FILE