metadataengine/server/src/mdsmaintenanceengine.cpp
branchRCL_3
changeset 21 85f623e1ef41
parent 20 f23c07ec56e2
child 22 29d87345eaeb
equal deleted inserted replaced
20:f23c07ec56e2 21:85f623e1ef41
   118     __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 );
   118     __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 );
   119 	
   119 	
   120     TBool isValid(EFalse);
   120     TBool isValid(EFalse);
   121     TRAPD(err, isValid = iMaintenance->ValidateL( ));
   121     TRAPD(err, isValid = iMaintenance->ValidateL( ));
   122     
   122     
   123     if( err == KErrCorrupt )
   123     if(err == KErrCorrupt)
   124         {
   124         {
   125         DeleteDatabase();
   125         DeleteDatabase();
   126         User::Leave( err );
   126         User::Leave( err );
   127         }
   127         }
   128     
   128     
   172 				__LOG1( ELogAlways, "Schema reading error: %d", schemaError );
   172 				__LOG1( ELogAlways, "Schema reading error: %d", schemaError );
   173 				DeleteDatabase();
   173 				DeleteDatabase();
   174 				User::Leave( schemaError );
   174 				User::Leave( schemaError );
   175 				}
   175 				}
   176 			}
   176 			}
       
   177 
       
   178 		if ( FailedImports() != 0 )
       
   179   			{
       
   180 	       	User::Leave( KErrBadName );
       
   181        		}
   177 		
   182 		
   178 		// try to read default import file from C drive
   183 		// try to read default import file from C drive
   179        	TRAPD( err, ImportMetadataL( aManipulate, aSchema, KMdsDefaultImportFile ) );
   184        	TRAPD( err, ImportMetadataL( aManipulate, aSchema, KMdsDefaultImportFile ) );
   180        	if ( err == KErrNotFound || err == KErrPathNotFound )
   185        	if ( err == KErrNotFound || err == KErrPathNotFound )
   181        		{
   186        		{
   182        		// if default import file is not found, try to read from rom (Z) drive
   187        		// if default import file is not found, try to read from rom (Z) drive
   183        		// and ignore errors
   188        		// and ignore errors
   184        		TRAP_IGNORE( ImportMetadataL( aManipulate, aSchema, KMdsDefaultRomImportFile ) );
   189        		TRAP_IGNORE( ImportMetadataL( aManipulate, aSchema, KMdsDefaultRomImportFile ) );
   185        		}
   190        		}
   186 
       
   187 #ifdef _DEBUG
       
   188         if ( FailedImports() != 0 )
       
   189             {
       
   190             User::Leave( KErrBadName );
       
   191             }
       
   192 #endif
       
   193        	
   191        	
   194        	__LOG1( ELogAlways, "MDS DB tables created %d", 0 );
   192        	__LOG1( ELogAlways, "MDS DB tables created %d", 0 );
   195 
   193 
   196         // Revert back to default MDS server priority when server is up and running
   194         // Revert back to default MDS server priority when server is up and running
   197         process.SetPriority( EPriorityBackground );
   195         process.SetPriority( EPriorityBackground );
   206         if( err != KErrNone )
   204         if( err != KErrNone )
   207         	{ 
   205         	{ 
   208 			DeleteDatabase();
   206 			DeleteDatabase();
   209 			User::Leave( err );
   207 			User::Leave( err );
   210         	}
   208         	}
   211         
       
   212         if( !iMaintenance->CheckForCorruptionL() )
       
   213             {
       
   214             DeleteDatabase();
       
   215             User::Leave( KErrCorrupt );
       
   216             }
       
   217         }
   209         }
   218     __LOG1( ELogAlways, "CMdSMaintenanceEngine::InstallL complete: %d", 0 );
   210     __LOG1( ELogAlways, "CMdSMaintenanceEngine::InstallL complete: %d", 0 );
   219     }
   211     }
   220 
   212 
   221 // ------------------------------------------------
   213 // ------------------------------------------------