smf/smfcredentialmgr/smfcredmgrserver/inc/smfcredmgrdb.h
changeset 18 013a02bf2bb0
parent 14 a469c0e6e7fb
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
     5  * under the terms of the "Eclipse Public License v1.0"
     5  * under the terms of the "Eclipse Public License v1.0"
     6  * which accompanies  this distribution, and is available
     6  * which accompanies  this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
     8  *
     8  *
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Pritam Roy Biswas, Sasken Communication Technologies Ltd - Initial contribution
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  * 
       
    12  * Contributors:
       
    13  * Pritam Roy Biswas, Nalina Hariharan, Sasken Communication Technologies Ltd
    11  *
    14  *
    12  * Description:
    15  * Description:
    13  * This header defines the database-table and the creation of database that will be 
    16  * This header defines the database-table and the creation of database that will be 
    14  *  used by the Credential Manager Server to store all 
    17  * used by the Credential Manager Server to store all the credentials related 
    15  *  the credentials related to an Authentication Application
    18  * to an Authentication Application
    16  */
    19  */
       
    20 
    17 #ifndef SMFCREDMGRDB_H_
    21 #ifndef SMFCREDMGRDB_H_
    18 #define SMFCREDMGRDB_H_
    22 #define SMFCREDMGRDB_H_
       
    23 
    19 #include <sqldb.h>
    24 #include <sqldb.h>
    20 #include <e32base.h>
    25 #include <e32base.h>
    21 #include <f32file.h>
    26 #include <f32file.h>
    22 
    27 
    23 //the private folder of the app
    28 //the private folder of the app
    24 _LIT(KSmfCredMgrDbPrivateDir, "C:\\private\\EF0FFBD7\\");
    29 _LIT(KSmfCredMgrDbPrivateDir, "C:\\private\\EF0FFBD7\\");
    25 _LIT(KSmfCredMgrDbFileName, "[EF0FFBD7]CREDMGRDB.db");
    30 _LIT(KSmfCredMgrDbFileName, "[EF0FFBD7]CREDMGRDB.db");
    26 
    31 
    27 //Create Table
    32 //Create Database Table Queries
    28 _LIT8(KCreatePluginIDTable,"CREATE TABLE PluginIDTable(PluginId TEXT PRIMARY KEY, AuthAppId TEXT UNIQUE, IsEnabled INT)");
    33 _LIT8(KCreatePluginIDTable,"CREATE TABLE PluginIDTable(PluginId TEXT, AuthAppId TEXT, IsEnabled INT, PRIMARY KEY(PluginId, AuthAppId))");
    29 _LIT8(KCreateURLTable,"CREATE TABLE URLTable(AuthAppId TEXT UNIQUE, URL TEXT,PRIMARY KEY(AuthAppId,URL))");
    34 _LIT8(KCreateURLTable,"CREATE TABLE URLTable(AuthAppId TEXT, URL TEXT, PRIMARY KEY(AuthAppId, URL))");
    30 _LIT8(KCreateRegTokenValidityTable,"CREATE TABLE RegTokenValidityTable(RegistrationToken TEXT PRIMARY KEY, AuthAppId TEXT UNIQUE, Validity BIGINT)");
    35 _LIT8(KCreateRegTokenValidityTable,"CREATE TABLE RegTokenValidityTable(RegistrationToken TEXT PRIMARY KEY, AuthAppId TEXT UNIQUE, Validity BIGINT)");
    31 _LIT8(KCreateAuthParamsTable,"CREATE TABLE AuthParamsTable(AuthAppId TEXT UNIQUE, AuthKey TEXT, AuthSecret TEXT, PRIMARY KEY(AuthAppId,AuthKey))");
    36 _LIT8(KCreateAuthParamsTable,"CREATE TABLE AuthParamsTable(AuthAppId TEXT, AuthKey TEXT, AuthSecret TEXT, PRIMARY KEY(AuthAppId, AuthKey))");
       
    37 
    32 
    38 
    33 /**
    39 /**
    34  * The creator class of the server database.
    40  * The creator class of the server database.
    35  *  Derives from CBase
    41  * Derives from CBase
    36  */
    42  */
    37 class CSmfCredMgrDb : public CBase
    43 class CSmfCredMgrDb : public CBase
    38 	{
    44 	{
    39 public:
    45 public:
    40 	/**
    46 	/**
    41 	 * New Methods
    47 	 * NewL Method
       
    48 	 * @return The constructed CSmfCredMgrDb instance
    42 	 */
    49 	 */
    43 	static CSmfCredMgrDb* NewL();
    50 	static CSmfCredMgrDb* NewL();
       
    51 	
    44 	/**
    52 	/**
    45 	 * New Methods
    53 	 * NewLC Method
       
    54 	 * @return The constructed CSmfCredMgrDb instance
    46 	 */
    55 	 */
    47 	static CSmfCredMgrDb* NewLC();
    56 	static CSmfCredMgrDb* NewLC();
    48 
    57 
    49 	/**
    58 	/**
    50 	 * destructor
    59 	 * Destructor
    51 	 */
    60 	 */
    52 	~CSmfCredMgrDb();
    61 	~CSmfCredMgrDb();
    53 
    62 
    54 private:
    63 private:
    55 	/**
    64 	/**
    56 	 * constructor
    65 	 * Constructor
    57 	 */
    66 	 */
    58 	CSmfCredMgrDb();
    67 	CSmfCredMgrDb();
    59 
    68 
    60 	/**
    69 	/**
    61 	 * two phase constructor
    70 	 * Two phase constructor
    62 	 */
    71 	 */
    63 	void ConstructL();
    72 	void ConstructL();
    64 
    73 
    65 	/**
    74 	/**
    66 	 * Method to create the Db file
    75 	 * Method to create the Db file
    67 	 * @param aFileName The file name
    76 	 * @param aFileName The file name
       
    77 	 * @return Returns KErrNone if success. Refer ESqlDbError and system-wide 
       
    78 	 * error codes for detailed error description.
    68 	 */
    79 	 */
    69 	TInt CreateDbFile(const TFileName &aFileName);
    80 	TInt CreateDbFile(const TFileName &aFileName);
    70 
    81 
    71 	/**
    82 	/**
    72 	 * Method to crete the Db tables
    83 	 * Method to create the Db tables
    73 	 * @param aFileName The Db file name
    84 	 * @param aFileName The Db file name
    74 	 */
    85 	 */
    75 	void CompleteDBCreationL(const TFileName &aFileName);
    86 	void CompleteDBCreationL(const TFileName &aFileName);
    76 
    87 
    77 	/**
    88 	/**
    78 	 * Creates the Plugin Id table 
    89 	 * Creates the Plugin Id table
       
    90 	 * @return Returns KErrNone if success. Refer ESqlDbError and system-wide 
       
    91 	 * error codes for detailed error description. 
    79 	 */
    92 	 */
    80 	TInt PluginIDTableCreate();
    93 	TInt PluginIDTableCreate();
    81 
    94 
    82 	/**
    95 	/**
    83 	 * Creates the URL table 
    96 	 * Creates the URL table
       
    97 	 * @return Returns KErrNone if success. Refer ESqlDbError and system-wide 
       
    98 	 * error codes for detailed error description.
    84 	 */
    99 	 */
    85 	TInt URLTableCreate();
   100 	TInt URLTableCreate();
    86 
   101 
    87 	/**
   102 	/**
    88 	 * Creates the RegistrationToken-Validity Table  
   103 	 * Creates the RegistrationToken-Validity Table
       
   104 	 * @return Returns KErrNone if success. Refer ESqlDbError and system-wide 
       
   105 	 * error codes for detailed error description.
    89 	 */
   106 	 */
    90 	TInt RegTokenValidityTableCreate();
   107 	TInt RegTokenValidityTableCreate();
    91 
   108 
    92 	/**
   109 	/**
    93 	 * Creates the Authentication Parameters Table  
   110 	 * Creates the Authentication Parameters Table
       
   111 	 * @return Returns KErrNone if success. Refer ESqlDbError and system-wide 
       
   112 	 * error codes for detailed error description.
    94 	 */
   113 	 */
    95 	TInt AuthParamsTableCreate();
   114 	TInt AuthParamsTableCreate();
    96 
   115 
    97 	/**
   116 	/**
    98 	 * Deletes the Db 
   117 	 * Deletes the Db 
    99 	 * @param aFileName The Db file name
   118 	 * @param aFileName The Db file name
       
   119 	 * @return Returns KErrNone if success. Refer ESqlDbError and system-wide 
       
   120 	 * error codes for detailed error description.
   100 	 */
   121 	 */
   101 	TInt DeleteDbFile(const TFileName &aFileName);
   122 	TInt DeleteDbFile(const TFileName &aFileName);
   102 
   123 
   103 private:
   124 private:
   104 	RFs iFileSession;
   125 	RFs iFileSession;