homescreenpluginsrv/hspsmanager/inc/hspsinstallationhandler.h
changeset 0 79c6a41cd166
child 8 d0529222e3f0
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 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:  
       
    15 *
       
    16 *  Installation Handler.
       
    17 * 
       
    18 *  
       
    19 *  ChspsInstallatioHandler is a server-side implementation of HSPS Configuration 
       
    20 *  Management Services.
       
    21 *  The Installation Service is intended to serve the HSPS SAPI client only.
       
    22 *   
       
    23 *  Services:
       
    24 *  1) reads installation instructions from a manifest-file 
       
    25 *  2) parses and updates xml configuration into a binary representation (ODT's DOM)
       
    26 *  3) stores various resources, localized and common, into Plug-in Repository  
       
    27 *     (a.k.a. Definition Repository)
       
    28 *    
       
    29 *  When installation is successful, Installation Handler utilizes HSPS Definition 
       
    30 *  Repository to store the results. All resources are stored on Definition Repository 
       
    31 *  and their related information is stored on the list of ChspsResource-objects 
       
    32 *  - a resource list. This list of ChspsResource-objects is called Resource List. 
       
    33 *  For more information, see hspsResource documentation.
       
    34 * 
       
    35 *  On theme updates, Installation Handler deploys ChspsSecurityEnforcer to control 
       
    36 *  update rights. For more information, see ChspsSecurityEnforcer documentation  
       
    37 *  and ChspsInstallatioHandler documentation
       
    38 *
       
    39 *
       
    40 */
       
    41 
       
    42 
       
    43 
       
    44 #ifndef __hspsINSTALLATIONHANDLER_H__
       
    45 #define __hspsINSTALLATIONHANDLER_H__
       
    46 
       
    47 #include <contenthandler.h>
       
    48 #include <parser.h>
       
    49 
       
    50 #include "hspsthememanagement.h"
       
    51 #include "hspsresource.h"
       
    52 #include "hspsresult.h"
       
    53 
       
    54 #ifdef HSPS_LOG_ACTIVE
       
    55 class ChspsLogBus;
       
    56 #endif
       
    57 class CRepository;
       
    58 class ChspsThemeServer;
       
    59 class ChspsDefinitionRepository;
       
    60 class ChspsDefinitionEngineInterface;
       
    61 class ChspsODT;
       
    62 class ChspsDomNode;
       
    63 class ChspsDomStringPool;
       
    64 class ChspsSecurityEnforcer;
       
    65 class ChspsResource;
       
    66 class ChspsDomList; 
       
    67 
       
    68 using namespace Xml;
       
    69 
       
    70 #if defined(WINSCW) || defined(__WINS__)
       
    71 const ThspsFamily KDefaultFamily = EhspsFamilyQhd_tch;
       
    72 #endif
       
    73 
       
    74 enum TInstallationMode
       
    75     {
       
    76     EAsynchronousObject,
       
    77     EServiceHandler
       
    78     };
       
    79 
       
    80 /**
       
    81 *  Class ChspsInstallationHandler.
       
    82 *  ChspsInstallationHandler performs all theme installation related functionality for hspsThemeServer.
       
    83 *
       
    84 *  Class inheritance:
       
    85 *  ==================
       
    86 *  ChspsInstallationHandler implements MhspsInstallationService from HSPS Theme Management Service
       
    87 *  and MContentHandler for XML-parsing of manifest file. For more information, see the architecture 
       
    88 *  description in the beginning of this file. 
       
    89 *
       
    90 *  Functionality:
       
    91 *  ============== 
       
    92 *  ChspsInstallationHandler offer high- and low-level API-functionality. High-level and low-level 
       
    93 *  calls are diffrentiated by their parametrization. High-level parametrization is directed to the
       
    94 *  be used by applications which need human readable data and offer a user interface. Low-level 
       
    95 *  parametrization is directed to the machine-originated requestors like OTA Push or DM (Device 
       
    96 *  Management) sub-systems where data is not needed to understand semanticly.
       
    97 *  Processing the installation task can be synchronous or asynchronous. Synchronous mode is 
       
    98 *  applied everytime an installation is initiated. Application Theme may include resources. 
       
    99 *  Importing these resources to the target device may need conversions. Such resources like some
       
   100 *  audio files etc., can be imported directly, however, most of the image-resources must be fitted
       
   101 *  for the target device because target screen device's color depth and/or pixel density varies.
       
   102 *  In this case, the needed conversions will be executed asynchronously. Asynchronous installation
       
   103 *  is executed in phases - resource by resource. Client application must initiate asynchronous mode
       
   104 *  by calling hspsInstallNextPhaseL() after testing that the synchronous call hspsInstallTheme() 
       
   105 *  has returned EhspsInstallPhaseSuccess return code. This means that there are resources to convert 
       
   106 *  asynchronoulsly. The rest of the asynchronous installation phases will be executed automatically, 
       
   107 *  however, installation can be interrupted by calling hspsCancelInstallTheme() at any time. 
       
   108 *  If installation is canceled, installation handler initiates roll-back functionality removing 
       
   109 *  inconsistent installation.
       
   110 *  Installation Service uses specific manifest-file format to get informed about the xml, css, dtd,
       
   111 *  and resource files to be installed. Resource files might be locale-specific or generic as well.
       
   112 *  HSPS Definition Repository takes care of saving everything on their appropriate places in the
       
   113 *  target device. Repository, i.e. theme storage, is loacted on hspsThemeServer's private-folder. 
       
   114 *  The storage is organized by the information contained in ODT-header.
       
   115 *  Locales are instructed in manifest file also. Manifest file's file-extension must be .dat, but
       
   116 *  actually, the file-name can be whatever, however, when low-level parametrization is used, the 
       
   117 *  name must be "manifest.dat" and it must be the last file extracted from the installation package.
       
   118 *  For more information of manifest-file format, see "HSPS Manifest File User Guide.doc".
       
   119 *
       
   120 *  Installation functions can return one of the following ThspsServiceCompletedMessage-codes:
       
   121 *  - EhspsInstallThemeSuccess,
       
   122 *  - EhspsInstallPhaseSuccess, or
       
   123 *  - EhspsInstallThemeFailed.
       
   124 *
       
   125 *  Client application must implement MhspsThemeManagementServiceObserver-interface and listen the 
       
   126 *  messages mentionaed. Let it be emphasised that both synchronous and asynchronous calls can return
       
   127 *  the codes above. Installation functions may also return one of the following codes:
       
   128 *  - EhspsServiceRequestSheduled, or
       
   129 *  - EhspsServiceRequestError.
       
   130 *
       
   131 *  For explanation of the meanings of these messages, see ThspsServiceCompletedMessage-documentation.
       
   132 *  
       
   133 *  @ingroup group_hspsserversession
       
   134 *  @lib hspsThemeServer.exe
       
   135 *  @since S60 5.0
       
   136 */
       
   137 class ChspsInstallationHandler : public CBase, 
       
   138                                  public MhspsInstallationService, 
       
   139                                  public MContentHandler
       
   140     {
       
   141     public:
       
   142         
       
   143     public:
       
   144         /**
       
   145         * Two-phased constructor.
       
   146         */
       
   147         static ChspsInstallationHandler* NewL( ChspsThemeServer& aThemeServer );
       
   148         static ChspsInstallationHandler* NewLC( ChspsThemeServer& aThemeServer );
       
   149 
       
   150         /**
       
   151         * Destructor.
       
   152         */      
       
   153         ~ChspsInstallationHandler();
       
   154   
       
   155     public:  // New functions
       
   156 
       
   157         /**
       
   158         * ServiceInstallThemeL
       
   159         * Starts the actual installation in ChspsInstallationHandler.
       
   160         * @since S60 5.0
       
   161         * @param aMessage Message from client
       
   162         */      
       
   163         void ServiceInstallThemeL(
       
   164                 const RMessage2& aMessage);
       
   165       
       
   166         /**
       
   167         * ServiceInstallNextPhaseL
       
   168         * Starts subsequent installation phases.
       
   169         * @since S60 5.0
       
   170         * @param aMessage Message from client
       
   171         */            
       
   172         void ServiceInstallNextPhaseL(
       
   173                 const RMessage2& aMessage);
       
   174       
       
   175         /** 
       
   176         * hspsInstallNextPhase
       
   177         * @since S60 5.0
       
   178         * This is server-side only function.
       
   179         * @param aHeaderData will return ODT-header of the latest installation phase in serialized 
       
   180         *        (i.e. marshalled)
       
   181         *        data mode. This follows the low-level parametrization schema.  
       
   182         * @param aRequestStatus will return the status of the asynchronous request returned by 
       
   183         *        installer.
       
   184         * @return TInthspsServiceCompletedMessage expressing the result of the call.
       
   185         */
       
   186         void hspsInstallNextPhaseL( 
       
   187                 TDes8& aHeaderData, 
       
   188                 TRequestStatus& aRequestStatus );
       
   189         
       
   190         /** 
       
   191         * CheckAutoInstallationValidityL
       
   192         * Checks if auto installation of a theme is permitted
       
   193         * @since S60 5.0
       
   194         * This is server-side only function.
       
   195         * @return TBool ETrue if auto installation can proceed.
       
   196         */
       
   197         TBool CheckAutoInstallationValidityL();
       
   198 
       
   199 #ifdef HSPS_LOG_ACTIVE        
       
   200         /** 
       
   201         * Set log bus.
       
   202         */
       
   203         void SetLogBus( ChspsLogBus* aLogBus );
       
   204 #endif        
       
   205     
       
   206         /**
       
   207          * Disables "configuration was installed" notifications
       
   208          * @since S60 5.0
       
   209          */
       
   210         void DisableNotifications();
       
   211         
       
   212     public: // Functions from base classes
       
   213 
       
   214         /**
       
   215         * From MhspsInstallationService hspsInstallTheme
       
   216         * 
       
   217         * @since S60 5.0
       
   218         * @param aManifestFileName is the full path to the installation script file - a manifest 
       
   219         *        file.
       
   220         * @param aHeader is an empty ChspsODT-object in which a valid ODT-header of the newly 
       
   221         *        installed theme will be returned if the request is successful. The use of 
       
   222         *        ChspsODT-type parameter follows the high-level parametrization schema.
       
   223         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   224         */
       
   225         inline ThspsServiceCompletedMessage hspsInstallTheme( 
       
   226                 const TDesC& /*aManifestFileName*/, 
       
   227                 ChspsODT& /*aHeader*/ );
       
   228         
       
   229         /**
       
   230         * From MhspsInstallationService hspsInstallTheme
       
   231         * 
       
   232         * @since S60 5.0
       
   233         * @param aManifestFileName is full path of the installation script file - a manifest file
       
   234         * @param aHeaderData will return ODT-header of the newly installed theme in serialized 
       
   235         *        (i.e. marshalled)
       
   236         *        data mode. This follows the low-level parametrization schema.  
       
   237         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   238         */
       
   239         ThspsServiceCompletedMessage hspsInstallTheme( 
       
   240                 const TDesC& aManifestFileName, 
       
   241                 TDes8& aHeaderData );
       
   242                         
       
   243         /**
       
   244         * From MhspsInstallationService hspsInstallNextPhaseL
       
   245         * 
       
   246         * @since S60 5.0
       
   247         * @param aHeader is an empty ChspsODT-object in which a valid ODT-header of the latest 
       
   248         *        installation phase completed if the request was successful. The use of ChspsODT-type
       
   249         *        parameter follow the high-level parametrization schema.
       
   250         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   251         */
       
   252         inline ThspsServiceCompletedMessage hspsInstallNextPhaseL( 
       
   253                 ChspsODT& /*aHeader*/ );
       
   254 
       
   255         /**
       
   256         * From MhspsInstallationService hspsInstallNextPhaseL
       
   257         * 
       
   258         * @since S60 5.0
       
   259         * @param aHeaderData will return ODT-header of the latest installation phase in 
       
   260         *        serialized (i.e. marshalled) data mode. This follows the low-level 
       
   261         *        parametrization schema.  
       
   262         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   263         */
       
   264         ThspsServiceCompletedMessage hspsInstallNextPhaseL( 
       
   265                 TDes8& aHeaderData );
       
   266         
       
   267         /**
       
   268         * From MhspsInstallationService hspsCancelInstallTheme
       
   269         * 
       
   270         * @since S60 5.0
       
   271         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   272         */
       
   273         ThspsServiceCompletedMessage hspsCancelInstallTheme();
       
   274 
       
   275         //From MContentHandler
       
   276         
       
   277         /**
       
   278         * OnStartDocumentL
       
   279         * @since S60 5.0
       
   280         * This method is a callback to indicate the start of the document.
       
   281         * @param  aDocParam Specifies the various parameters of the document.
       
   282         * @arg  aDocParam.iCharacterSetName The character encoding of the document.
       
   283         * @param  aErrorCode is the error code. 
       
   284         * If this is not KErrNone then special action may be required.
       
   285         */
       
   286         inline void OnStartDocumentL(
       
   287                 const RDocumentParameters& aDocParam, 
       
   288                 TInt aErrorCode);
       
   289 
       
   290         /**
       
   291         * OnEndDocumentL
       
   292         * @since S60 5.0
       
   293         * This method is a callback to indicate the end of the document.
       
   294         * @param  aErrorCode is the error code. 
       
   295         * If this is not KErrNone then special action may be required.
       
   296         */
       
   297         inline void OnEndDocumentL(
       
   298                 TInt aErrorCode);
       
   299 
       
   300         /**
       
   301         * OnStartElementL
       
   302         * @since S60 5.0
       
   303         * This method is a callback to indicate an element has been parsed.
       
   304         * @param  aElement is a handle to the element's details.
       
   305         * @param  aAttributes contains the attributes for the element.
       
   306         * @param  aErrorCode is the error code.
       
   307         *    If this is not KErrNone then special action may be required.
       
   308         */
       
   309         void OnStartElementL(
       
   310                 const RTagInfo& aElement, 
       
   311                 const RAttributeArray& aAttributes, 
       
   312                 TInt aErrorCode);
       
   313 
       
   314         /**
       
   315         * OnEndElementL
       
   316         * @since S60 5.0
       
   317         * This method is a callback to indicate the end of the element has been reached.
       
   318         * @param  aElement is a handle to the element's details.
       
   319         * @param  aErrorCode is the error code.
       
   320         * If this is not KErrNone then special action may be required.
       
   321         */
       
   322         void OnEndElementL(
       
   323                 const RTagInfo& aElement, 
       
   324                 TInt aErrorCode);
       
   325 
       
   326         /**
       
   327         * OnContentL
       
   328         * @since S60 5.0
       
   329         * This method is a callback that sends the content of the element.
       
   330         * Not all the content may be returned in one go. The data may be sent in chunks.
       
   331         * When an OnEndElementL is received this means there is no more content to be sent.
       
   332         * @param  aBytes is the raw content data for the element. 
       
   333         *     The client is responsible for converting the data to the 
       
   334         *     required character set if necessary.
       
   335         *     In some instances the content may be binary and must not be converted.
       
   336         * @param  aErrorCode is the error code.
       
   337         *     If this is not KErrNone then special action may be required.
       
   338         */
       
   339         void OnContentL(
       
   340                 const TDesC8& aBytes, 
       
   341                 TInt aErrorCode);
       
   342   
       
   343         /**
       
   344         * OnStartPrefixMappingL
       
   345         * @since S60 5.0
       
   346         * This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping.
       
   347         * This method is always called before the corresponding OnStartElementL method.
       
   348         * @param  aPrefix is the Namespace prefix being declared.
       
   349         * @param  aUri is the Namespace URI the prefix is mapped to.
       
   350         * @param  aErrorCode is the error code.
       
   351         *         If this is not KErrNone then special action may be required.
       
   352         */
       
   353         inline void OnStartPrefixMappingL(
       
   354                 const RString& aPrefix, 
       
   355                 const RString& aUri, 
       
   356                 TInt aErrorCode);
       
   357 
       
   358         /**
       
   359         * OnEndPrefixMappingL
       
   360         * @since S60 5.0
       
   361         * This method is a notification of the end of the scope of a prefix-URI mapping.
       
   362         * This method is called after the corresponding DoEndElementL method.
       
   363         * @param aPrefix is the Namespace prefix that was mapped.
       
   364         * @param aErrorCode is the error code.
       
   365         *        If this is not KErrNone then special action may be required.
       
   366         */
       
   367         inline void OnEndPrefixMappingL(
       
   368                 const RString& aPrefix, 
       
   369                 TInt aErrorCode);
       
   370 
       
   371         /**
       
   372         * OnIgnorableWhiteSpaceL
       
   373         * @since S60 5.0
       
   374         * This method is a notification of ignorable whitespace in element content.
       
   375         * @param  aBytes are the ignored bytes from the document being parsed.
       
   376         * @param  aErrorCode is the error code.
       
   377         * If this is not KErrNone then special action may be required.
       
   378         */
       
   379         inline void OnIgnorableWhiteSpaceL(
       
   380                 const TDesC8& aBytes, 
       
   381                 TInt aErrorCode);
       
   382 
       
   383         /**
       
   384         * OnSkippedEntityL
       
   385         * @since S60 5.0
       
   386         * This method is a notification of a skipped entity. If the parser encounters an 
       
   387         * external entity it does not need to expand it - it can return the entity as aName 
       
   388         * for the client to deal with.
       
   389         * @param  aName is the name of the skipped entity.
       
   390         * @param  aErrorCode is the error code.
       
   391         * If this is not KErrNone then special action may be required.
       
   392         */
       
   393         inline void OnSkippedEntityL(
       
   394                 const RString& aName, 
       
   395                 TInt aErrorCode);
       
   396 
       
   397         /**
       
   398         * OnProcessingInstructionL
       
   399         * @since S60 5.0
       
   400         * This method is a receive notification of a processing instruction.
       
   401         * @param  aTarget is the processing instruction target.
       
   402         * @param  aData is the processing instruction data. If empty none was supplied.
       
   403         * @param  aErrorCode is the error code.
       
   404         * If this is not KErrNone then special action may be required.
       
   405         */
       
   406         inline void OnProcessingInstructionL(
       
   407                 const TDesC8& aTarget, 
       
   408                 const TDesC8& aData,
       
   409                 TInt aErrorCode);
       
   410 
       
   411         /**
       
   412         * OnError
       
   413         * @since S60 5.0
       
   414         * This method indicates an error has occurred.
       
   415         * @param  aError is the error code
       
   416         */
       
   417         inline void OnError(
       
   418                 TInt aErrorCode);
       
   419 
       
   420         /**
       
   421         * GetExtendedInterface
       
   422         * @since S60 5.0
       
   423         * This method obtains the interface matching the specified uid.
       
   424         * @return 0 if no interface matching the uid is found.
       
   425         *         Otherwise, the this pointer cast to that interface.
       
   426         * @param  aUid the uid identifying the required interface.
       
   427         */
       
   428         inline TAny* GetExtendedInterface(
       
   429                 const TInt32 aUid);
       
   430   
       
   431     protected:  // New functions
       
   432        
       
   433         /**
       
   434         * Rolls back the installation if it fails or is cancelled.
       
   435         * @since S60 5.0
       
   436         * @param aOdt The ODT of the theme
       
   437         */
       
   438         void RollBackL( ChspsODT& aOdt );
       
   439  
       
   440     private:    
       
   441         /**
       
   442         * C++ default constructor.
       
   443         * @since S60 5.0
       
   444         */
       
   445         ChspsInstallationHandler( 
       
   446                 ChspsThemeServer& aThemeServer );
       
   447           
       
   448         /**
       
   449         * By default Symbian 2nd phase constructor is private.
       
   450         * @since S60 5.0
       
   451         */ 
       
   452         void ConstructL();
       
   453       
       
   454         /**
       
   455         * CheckHeaderL
       
   456         * Checks the header information and stores it to iOdt
       
   457         * @since S60 5.0
       
   458         */
       
   459         void CheckHeaderL();
       
   460         
       
   461         /**
       
   462         * InstallOdtL
       
   463         * Installs the theme skeleton
       
   464         * @since S60 5.0
       
   465         */
       
   466         void InstallSkeletonL( 
       
   467                 ThspsServiceCompletedMessage& aReturnMsg );        
       
   468                 
       
   469         /**
       
   470          * Adds parsed resource into a temporary resource list, from which the resources
       
   471          * are applied to an ODT instance at later phase
       
   472          * @since S60 5.0
       
   473          * @param aArray is either iResourceArray or iLocalizedResourceArray instance 
       
   474          * @param aFilename is full path and filename to the resource in an installation folder
       
   475          * @param aLanguage is language of the resource (use ELangNone if it's a common resource)
       
   476          * @param aResourceType is MIME type or NULL      
       
   477          * @param aMimetype (Optional)   
       
   478          * @param aTag (Optional)
       
   479          */
       
   480         void AddResourceL(
       
   481                 CArrayPtrSeg<ChspsResource>& aArray, 
       
   482                 const TPtrC aFilename,
       
   483                 const TLanguage aLanguage,
       
   484                 const ThspsResourceType aResourceType,
       
   485                 const TPtrC8 aMimetype,
       
   486                 const TPtrC8 aTag );
       
   487                                 
       
   488         /**
       
   489         * CleanupL
       
   490         * Executes cleaning of the target folder prior to the installation process
       
   491         * @since S60 5.0
       
   492         */
       
   493         void CleanupL( 
       
   494                 const ChspsODT& aUpdateMask );
       
   495                 
       
   496         /**
       
   497          * ImportPluginsL         
       
   498          * Imports plug-in DOMs referenced by application configuration, other 
       
   499          * configuration types are ignored.
       
   500          * @since S60 5.0
       
   501          */
       
   502         void ImportPluginsL( );
       
   503         
       
   504         /**
       
   505         * ParseDocumentL
       
   506         * Calls the definition engine to create the dom 
       
   507         * @since S60 5.0
       
   508         */
       
   509         void ParseDocumentL( 
       
   510                 ChspsODT& aOdt );
       
   511         
       
   512         /**
       
   513         * CompleteRequestL
       
   514         * Completes the request message
       
   515         * @since S60 5.0
       
   516         */
       
   517         void CompleteRequestL(const ThspsServiceCompletedMessage aReturnMessage, 
       
   518                 const TDesC8& aHeaderData = KNullDesC8 );
       
   519 
       
   520         /**
       
   521         * Send update notifications if necessary.
       
   522         * @since S60 5.0
       
   523         */        
       
   524         void NotifyOdtUpdatedL();        
       
   525 
       
   526         /**
       
   527         * Get active application configurations.
       
   528         * @since S60 5.0        
       
   529         * @param aActiveAppConfs    Target list for active application configurations.
       
   530         */        
       
   531         void GetActiveAppConfsL( CArrayPtrSeg<ChspsODT>& aActiveAppConfs );
       
   532         
       
   533         /**
       
   534         * SetODTAsResourceL
       
   535         * Stores the given ODT as a resources on the resource list
       
   536         * @since S60 5.0
       
   537         */
       
   538         void SetODTAsResourceL( 
       
   539                 ChspsODT& aOdt );
       
   540 
       
   541         /**
       
   542         * ActivateThemeL
       
   543         * Activates the installed theme.
       
   544         * @since S60 5.0
       
   545         */
       
   546         void ActivateThemeL();
       
   547                                                
       
   548         /**
       
   549          * Parses given DOM document and appends it with a content from possible plugin DOMs.                  
       
   550          * @since S60 5.0
       
   551          * @param aAppODT is the ODT which should be modified                  
       
   552          */
       
   553         void AppendPluginConfigurationsL( 
       
   554                 ChspsODT& aAppODT );
       
   555                          
       
   556         /**
       
   557          * Resets memeber variables. 
       
   558          * Used by the autoinstaller when installation handler is created only once.
       
   559          * @since S60 5.0         
       
   560          */
       
   561         void ResetL();
       
   562         
       
   563         /**
       
   564          * Finds locale specific subdirectories and resources and appends those
       
   565          * into the resource array
       
   566          * @since S60 5.0
       
   567          * @param aPath is a directory where the locale specific subdirectories exits
       
   568          */
       
   569         void AddLocalesL(
       
   570                 const TDesC& aPath );
       
   571         
       
   572         /**
       
   573          * Adds localized resources from the provided subdirectory
       
   574          * @since S60 5.0
       
   575          * @param aLanguage is name of the subdirectory
       
   576          * @param aPath is path to the subdirectory where the locale specific resources can be found                  
       
   577          */
       
   578         void AddLocalizedResourcesL(
       
   579                 const TDesC& aPath,
       
   580                 const TLanguage aLanguage );
       
   581         
       
   582         /**
       
   583          * Returns a path if V2 directory structure is in use 
       
   584          * and if an interface uid is known.
       
   585          * @return path to a Xuikon etc folder or an empty string
       
   586          */
       
   587         TFileName GetInterfacePath();
       
   588                 
       
   589         /**
       
   590          * Add DTD files from the HSPS folder.
       
   591          */
       
   592         void AddHspsLocalesV2L(
       
   593                 const TDesC& aPath );
       
   594         
       
   595         void AddLocalizedResourcesDTDV2L(
       
   596                 const TDesC& aPath,
       
   597                 const TLanguage aLanguage );
       
   598         
       
   599         void AddInterfaceResourcesV2L(
       
   600                 const TDesC& aPath );
       
   601 
       
   602         void AddLocalizedResourcesV2L(
       
   603                 const TDesC& aPath,
       
   604                 const TLanguage aLanguage );
       
   605         
       
   606         /**
       
   607          * Validates manifest contents and installs files into the Plug-in Repository.
       
   608          * @since S60 5.0
       
   609          */
       
   610         void ValidateL();
       
   611         
       
   612         /**
       
   613          * Validates provided UID value.
       
   614          * @param aUid Value to be checked
       
   615          */
       
   616         void ApplyUidRangeTestsL( const TUint aUid );
       
   617         
       
   618         /**
       
   619          * Indicated whether installed plugin was instansiated 
       
   620          * in one or more application configurations.
       
   621          * @since S60 5.0
       
   622          * @return ETrue if the plugin was in use
       
   623          */
       
   624         TBool IsPluginUsedInAppConfsL();
       
   625         
       
   626         /**
       
   627          * Parser for the filelogo and filepreview elements in manifest files.                  
       
   628          * If an icon was provided, it is added to an resource array for copying 
       
   629          * to client's private folder. Allocates heap for the result.
       
   630          * Supported values:        
       
   631          * - skin(<major id> <minor id>):mif(<path> <bitmapid> <maskid>)
       
   632          * - mif(<path> <bitmapid> <maskid>)
       
   633          * - uid(<application uid>)
       
   634          * - <file name>.<png/svg>         
       
   635          * @param aValue8 Value of the element         
       
   636          * @param aTag A tag for the file resource
       
   637          * @param aResultString Fixed declaration with a valid path reference 
       
   638          */
       
   639         void ParseIconDeclarationL( 
       
   640                 HBufC8& aValue8, 
       
   641                 const TDesC8& aTag,
       
   642                 HBufC*& aResultString );
       
   643         
       
   644     public: 
       
   645         
       
   646         ChspsResult* iResult;
       
   647     
       
   648     private:// Data
       
   649                                 
       
   650         // Stores the current message being processed during asynchronous conversion
       
   651         RMessagePtr2 iMessagePtr;
       
   652         
       
   653         // Result data
       
   654         TBuf8<KMaxResultDataLength8> iResultData;
       
   655                 
       
   656         // Maintains the phases in which the installation currently is 
       
   657         ThspsInstallationPhase iInstallationPhase;
       
   658         
       
   659         // Maintains the request status in asynchronous object installation mode
       
   660         TRequestStatus* iRequestStatus;
       
   661         
       
   662         // Flag that indicates that the installation service is used as asynchronous object,
       
   663         TInstallationMode iInstallationMode;   
       
   664         
       
   665         // Pointer to definition engine
       
   666         ChspsDefinitionEngineInterface* iDefEngine;
       
   667                         
       
   668         // Pointer to xml parser
       
   669         Xml::CParser* iXmlParser;
       
   670         
       
   671         // Pointer to ODT of the theme currently being installed
       
   672         ChspsODT* iOdt;
       
   673         
       
   674         // Contains the ODT's header information in marshalled form
       
   675         HBufC8* iHeaderData;
       
   676                 
       
   677         // Contains all the resources of an ODT instance when installing has finished
       
   678         CArrayPtrSeg<ChspsResource>* iResourceList;
       
   679         
       
   680         // Contains names of the resource files under the locale specific subdirectories
       
   681         CArrayPtrSeg<ChspsResource>* iTempLocalizedResourceList;
       
   682         
       
   683         HBufC8* iMediaType;                              
       
   684         
       
   685         // Tag value from a resource file
       
   686         HBufC8* iResourceTag;
       
   687         
       
   688         // True if parsing localized resources (assumes that elements are always in predefined order) 
       
   689         TBool iLocalized;
       
   690         
       
   691         // Holds the default language (applied if there is no DTD for the device language)
       
   692         TLanguage iDefaultSpecification;       
       
   693         TBool iDefaultSpecificationSet;
       
   694                        
       
   695         // Path to installation files
       
   696         TPtrC iThemeFilePath;
       
   697         
       
   698         // Application or interface UID of the installed theme
       
   699         TUint iRootUid;
       
   700         
       
   701         // Provider UID of the installed theme
       
   702         TUint iProviderUid;
       
   703         
       
   704         // Theme UID of the installed theme
       
   705         TUint iThemeUid;
       
   706         
       
   707         // Full name of the installed theme
       
   708         HBufC* iThemeFullName;
       
   709         
       
   710         // Short name of the installed theme
       
   711         HBufC8* iThemeShortName;
       
   712         
       
   713         // Version of the installed theme
       
   714         HBufC8* iThemeVersion;
       
   715         
       
   716         // Description of the widget
       
   717         HBufC8* iThemeDesc;
       
   718         
       
   719         // Version of the requested parser
       
   720         HBufC* iPackageVersion;
       
   721         
       
   722         // Family mask for different resolutions and interfaces (vga, vga_tch, qhd_tch, etc)
       
   723         TUint32 iFamilyMask;
       
   724         
       
   725         // Type of the installed application (for example "Hitchcock")
       
   726         HBufC8* iApplicationType;
       
   727         
       
   728         // XML file name of the installed theme
       
   729         HBufC* iXmlFile;
       
   730         
       
   731         // Name of the DTD file (same for each locale)
       
   732         HBufC* iDtdFile;
       
   733                         
       
   734         // Stores the content during parsing of the manifest file 
       
   735         HBufC8* iContent;
       
   736 
       
   737         // Handle to the file server session
       
   738         RFs iFsSession;
       
   739                 
       
   740         // Stores the resource during asynchronous conversion
       
   741         ChspsResource* iResource;
       
   742         
       
   743         // Stores the configuration type
       
   744         ThspsConfigurationType iConfigurationType;
       
   745         
       
   746         // Stores the theme status during installation
       
   747         TUint32 iThemeStatus;
       
   748         
       
   749         // Flag that indicates a missing file during installation -> installation fails
       
   750         TBool iFileNotFound;
       
   751                
       
   752         // Reference to Theme Server
       
   753         ChspsThemeServer& iThemeServer;
       
   754         
       
   755         // Reference to definition repository
       
   756         ChspsDefinitionRepository& iDefinitionRepository;
       
   757         
       
   758         // Reference to security enforcer
       
   759         ChspsSecurityEnforcer& iSecurityEnforcer;
       
   760                 
       
   761         // Reference to central repository
       
   762         CRepository& iCentralRepository;
       
   763         
       
   764         // header list cache
       
   765         CArrayPtrSeg<ChspsODT>& iHeaderListCache;   
       
   766         
       
   767         // Set if the package being installed is supported by the server
       
   768         TBool iPackageVerSupported;
       
   769         
       
   770         // Set if "EhspsODTAdded" -notifications should be blocked (e.g. ROM installations)
       
   771         TBool iDisableNotifications;
       
   772 
       
   773         // Set if installation files are located in ROM
       
   774         TBool iRomInstallation;
       
   775         
       
   776         // Set if widget mutliinstance flag
       
   777         TInt32 iMultiInstance;
       
   778 
       
   779         // Set if the multiinstance element is present in the manifest.dat file
       
   780         TBool iMultiInstanceFound;
       
   781 
       
   782 #ifdef HSPS_LOG_ACTIVE        
       
   783         /**
       
   784          * Log bus.
       
   785          */        
       
   786         ChspsLogBus* iLogBus;
       
   787 #endif        
       
   788         
       
   789         /**
       
   790          * Installation type.
       
   791          */
       
   792         enum TInstallationType
       
   793             {
       
   794             EInstallationTypeNew = 0, // New installation.
       
   795             EInstallationTypeUpdate   // Update.
       
   796             };
       
   797         
       
   798         // Installation type for currently active installation.
       
   799         TInstallationType iInstallationType;        
       
   800     };
       
   801 
       
   802     #include "hspsinstallationhandler.inl"
       
   803 
       
   804 #endif //__hspsINSTALLATIONHANDLER_H__