upnpmediaserver/contentdirectoryservice/inc/upnpcddbfactory.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /** @file
       
     2 * Copyright (c) 2005-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 "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:  Database for MediaServer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CUPNPCDDBFACTORY_H
       
    21 #define C_CUPNPCDDBFACTORY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <d32dbms.h>
       
    26 #include <s32file.h>
       
    27 #include <upnperrors.h>
       
    28 
       
    29 // CLASS DECLARATION
       
    30 class CUpnpMetadataStorage;
       
    31 
       
    32 
       
    33 
       
    34 /**
       
    35 *  Database factory.
       
    36 *
       
    37 *
       
    38 *  @lib ContentDirectoryDb.lib
       
    39 *  @since Series 60 3.0
       
    40 */
       
    41 class CUpnpCdDbFactory : public CBase
       
    42 {
       
    43  public:  // Constructors and destructor
       
    44  
       
    45     /**
       
    46     * Two-phased constructor.
       
    47     */
       
    48     static CUpnpCdDbFactory* NewLC();
       
    49     
       
    50     /**
       
    51     * Two-phased constructor.
       
    52     */
       
    53     static CUpnpCdDbFactory* NewL();
       
    54 
       
    55     /**
       
    56     * Destructor
       
    57     */
       
    58     ~CUpnpCdDbFactory();
       
    59     
       
    60  public: // New functions
       
    61  
       
    62     /**
       
    63     * @since Series60 3.1
       
    64     * @param aDatabaseFileName Databse filename
       
    65     * @return 
       
    66     */
       
    67     CUpnpMetadataStorage* CreateMetadataStorageL(const TDesC& aDatabaseFileName);
       
    68 
       
    69     /**
       
    70     * Creates database file
       
    71     * @since Series S60 3.1
       
    72     * @param aDbFileName Database filename
       
    73     */
       
    74     void CreateDatabaseFileL(const TDesC& aDbFileName);
       
    75 
       
    76     /**
       
    77     * @since Series60 3.2
       
    78     * @return Column set for table Object.
       
    79     */
       
    80     CDbColSet* CreateObjectTableColumnSequenceLC();
       
    81 
       
    82     /**
       
    83     * @since Series60 3.2
       
    84     * @return Column set for table Element.
       
    85     */
       
    86     CDbColSet* CreateElementTableColumnSequenceLC();
       
    87 
       
    88     /**
       
    89     * @since Series60 3.2
       
    90     * @return Column set for table Attribute.
       
    91     */
       
    92     CDbColSet* CreateAttributeTableColumnSequenceLC();
       
    93 
       
    94     /**
       
    95     * @since Series60 3.2
       
    96     * @return Column set for table Resource.
       
    97     */
       
    98     CDbColSet* CreateResourceTableColumnSequenceLC();
       
    99 
       
   100     /**
       
   101     * @since Series60 3.2
       
   102     * @return Column set for table Sequence.
       
   103     */
       
   104     CDbColSet* CreateSequenceTableColumnSequenceLC();
       
   105 
       
   106 
       
   107  private:
       
   108     /**
       
   109     * C++ default constructor.
       
   110     */
       
   111     CUpnpCdDbFactory();
       
   112 
       
   113     /**
       
   114     * By default Symbian 2nd phase constructor is private.
       
   115     */
       
   116     void ConstructL();
       
   117     
       
   118     /**
       
   119     * Creates database file. Invoke by CreateDatabaseFileL
       
   120     * @since Series S60 3.1
       
   121     * @param aDbFileName Database filename
       
   122     */
       
   123     void DoCreateDatabaseFileL(const TDesC& aDbFileName);
       
   124 
       
   125     /**
       
   126     * Creates empty database
       
   127     * @since Series S60 3.1
       
   128     * @param aDbFileName Database filename
       
   129     */
       
   130     void CreateEmptyDbL(const TDesC& aDbFileName);
       
   131     
       
   132     /**
       
   133     * Create objects table
       
   134     * @since Series S60 3.1
       
   135     */
       
   136     void CreateObjectTableL();
       
   137     
       
   138     /**
       
   139     * Create elements table
       
   140     * @since Series S60 3.1
       
   141     */
       
   142     void CreateElementTableL();
       
   143     
       
   144     /**
       
   145     * Create attributes table
       
   146     * @since Series S60 3.1
       
   147     */
       
   148     void CreateAttributeTableL();
       
   149     
       
   150     /**
       
   151     * Create resources table
       
   152     * @since Series S60 3.1
       
   153     */
       
   154     void CreateResourceTableL();
       
   155     
       
   156     /**
       
   157     * Create sequences table
       
   158     * @since Series S60 3.1
       
   159     */
       
   160     void CreateSequenceTableL();
       
   161     
       
   162     /**
       
   163     * Constructs database
       
   164     * @since Series S60 3.1
       
   165     * @param aDatabaseFileName
       
   166     */
       
   167     void ConstructDbL(const TFileName& aDatabaseFileName);  
       
   168         
       
   169     /**
       
   170     * Opens database
       
   171     * @since Series S60 3.1
       
   172     * @param aDatabaseFileName  Database filename
       
   173     */
       
   174     void OpenDbL( const TFileName& aDatabaseFileName );
       
   175         
       
   176     /**
       
   177     * 
       
   178     * @since Series S60 3.1
       
   179     * @param aWeight
       
   180     */
       
   181     void DbChangedL(TInt aWeight);    
       
   182         
       
   183     /**
       
   184     * Insterts initial data
       
   185     * @since Series S60 3.1
       
   186     */
       
   187     void InsertInitialDataL();
       
   188 
       
   189  private:    // Data
       
   190  
       
   191     // file server session
       
   192     RFs         iFs;
       
   193 
       
   194     RDbStoreDatabase    iStoreDb;
       
   195     
       
   196     CFileStore*     iFileStore;  
       
   197  
       
   198 };
       
   199 
       
   200 #endif // C_CUPNPCDDBFACTORY_H
       
   201 
       
   202 // End Of File