metadataengine/server/inc/mdsmaintenanceengine.h
changeset 0 c53acadfccc6
child 3 b73a2e62868f
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:  Class for database import/export and maintenance*
       
    15 */
       
    16 
       
    17 #ifndef __MDSMAINTENANCEENGINE_H__
       
    18 #define __MDSMAINTENANCEENGINE_H__
       
    19 
       
    20 #include <e32base.h>
       
    21 
       
    22 #include "mdccommon.h"
       
    23 
       
    24 // DEFINITIONS
       
    25 _LIT( KSchemaImportFile, "C:\\Private\\200009F3\\schema.mde" );
       
    26 _LIT( KSchemaRomImportFile, "Z:\\Private\\200009F3\\schema.mde" );
       
    27 
       
    28 // forward declarations
       
    29 class CMdsSchema;
       
    30 class CMdSManipulationEngine;
       
    31 class CMdCSerializationBuffer;
       
    32 class CMdSSqlDbMaintenance;
       
    33 
       
    34 /**
       
    35 * Abstract class for validating and creating tables.
       
    36 */
       
    37 class CMdSMaintenanceEngine : public CBase
       
    38     {
       
    39     public: // Constructors and destructor
       
    40 
       
    41         /**
       
    42         * NewL.
       
    43         * Two-phased constructor.
       
    44         */
       
    45         static CMdSMaintenanceEngine* NewL();
       
    46 
       
    47         /**
       
    48         * NewL.
       
    49         * Two-phased constructor.
       
    50         */
       
    51         static CMdSMaintenanceEngine* NewLC();
       
    52 
       
    53         virtual ~CMdSMaintenanceEngine();
       
    54 
       
    55     public: // Operations
       
    56         
       
    57   	    /**
       
    58 	    * Imports external schema to database.
       
    59         * @param aSchema schema that is on phone currently
       
    60         * @param aFileName name of the import file
       
    61 	    */        
       
    62         void ImportSchemaL( CMdsSchema& aSchema, const TDesC16& aFileName, TUint32 aVendorId );
       
    63 
       
    64         CMdsSchema* ImportSchemaTestL( const TDesC16& aFileName );
       
    65 
       
    66 
       
    67   	    /**
       
    68 	    * Imports metadata to database.
       
    69         * @param aSchema schema that is on phone currently
       
    70         * @param aFileName name of the import file
       
    71 	    */        
       
    72         TInt ImportMetadataL( CMdSManipulationEngine& aManipulate, 
       
    73         					     CMdsSchema& aSchema, const TDesC16& aFileName );
       
    74 
       
    75   	    /**
       
    76 	    * Exports metadata to file.
       
    77         * @param aFileName name of the file where to export
       
    78         * @param aSchema current schema
       
    79         * @param aHierarchyArray an array of criteria what to export
       
    80 	    */        
       
    81         void ExportMetadataL( CMdsSchema& aSchema, const TDesC16& aFileName, 
       
    82                               CMdCSerializationBuffer& aItems );
       
    83         
       
    84         /**
       
    85          * Stores C-drive media id to the DB.
       
    86          */
       
    87         void StoreCDriveMediaIdL();
       
    88 
       
    89   	    /**
       
    90 	    * Creates metadata tables to database.
       
    91 	    */
       
    92 	    void InstallL( CMdSManipulationEngine& aManipulate, CMdsSchema& aSchema );
       
    93 
       
    94         /**
       
    95         * Loads schema from database
       
    96         */
       
    97         void LoadSchemaL( CMdsSchema& aSchema );
       
    98         
       
    99         /**
       
   100          * performs initialization (at server start) for default database
       
   101          */
       
   102         static void InitConnectionL();
       
   103 
       
   104         /**
       
   105          * closes default database
       
   106          */
       
   107         static void CloseDatabase();
       
   108 
       
   109         /**
       
   110          * close and delete default database
       
   111          */
       
   112 		static void DeleteDatabase();
       
   113 
       
   114 		TInt FailedImports() const
       
   115 			{
       
   116 			return iFailedImports;
       
   117 			};
       
   118 
       
   119     private: // Constructors and destructors
       
   120 
       
   121         /**
       
   122         * CMdSManipulationEngine.
       
   123         * C++ default constructor.
       
   124         * @param .
       
   125         */
       
   126         CMdSMaintenanceEngine();
       
   127 
       
   128         /**
       
   129         * ConstructL.
       
   130         * 2nd phase constructor.
       
   131         */
       
   132         void ConstructL();
       
   133 
       
   134 	private: // Member data
       
   135 
       
   136         /**
       
   137          * database validation and creation
       
   138          */
       
   139         CMdSSqlDbMaintenance* iMaintenance;
       
   140 
       
   141         TInt iFailedImports;
       
   142     };
       
   143     
       
   144 #endif // __MDSMAINTENANCEENGINE_H__