306 // CIndexingManager::LoadPluginsL() |
306 // CIndexingManager::LoadPluginsL() |
307 // ----------------------------------------------------------------------------- |
307 // ----------------------------------------------------------------------------- |
308 // |
308 // |
309 void CIndexingManager::LoadPluginsL() |
309 void CIndexingManager::LoadPluginsL() |
310 { |
310 { |
|
311 OstTraceFunctionEntry0( CINDEXINGMANAGER_LOADPLUGINSL_ENTRY ); |
311 RImplInfoPtrArray infoArray; |
312 RImplInfoPtrArray infoArray; |
312 TCleanupItem cleanupItem( CPixSearchECom::CleanupEComArray, &infoArray ); |
313 TCleanupItem cleanupItem( CPixSearchECom::CleanupEComArray, &infoArray ); |
313 CleanupStack::PushL( cleanupItem ); |
314 CleanupStack::PushL( cleanupItem ); |
314 |
315 |
315 CIndexingPlugin::ListImplementationsL( infoArray ); |
316 CIndexingPlugin::ListImplementationsL( infoArray ); |
316 TInt count( 0 ); |
317 TInt count( 0 ); |
317 count = infoArray.Count(); |
318 count = infoArray.Count(); |
318 |
|
319 //FFLOGSTRING2( "CFastFindHarvesterPluginControl:: PLUGINS COUNT %d", count ); |
|
320 CIndexingPlugin* plugin = NULL; |
|
321 |
319 |
322 TInt contentcount(iContentInfoMgr->GetContentCountL() ); |
320 TInt contentcount(iContentInfoMgr->GetContentCountL() ); |
323 // If the content count in the content info DB is not equal to the plugin count, reset the content info DB |
321 // If the content count in the content info DB is not equal to the plugin count, reset the content info DB |
324 if ( contentcount != count) |
322 if ( contentcount != count) |
325 iContentInfoMgr->ResetL(); |
323 iContentInfoMgr->ResetL(); |
326 |
324 |
|
325 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
326 |
327 for ( TInt i = 0; i < count; i++ ) |
327 for ( TInt i = 0; i < count; i++ ) |
328 { |
328 { |
329 TUid uid = infoArray[i]->ImplementationUid(); // Create the plug-ins |
329 TUid uid = infoArray[i]->ImplementationUid(); // Create the plug-ins |
330 TInt version = infoArray[i]->Version(); |
330 TInt version = infoArray[i]->Version(); |
331 //FFLOGSTRING2( "CFastFindHarvesterPluginControl:: PLUGINS UID %x", uid ); |
331 //Update the details of the plugin in Contentinfo DB |
332 plugin = NULL; |
332 UpdateContentInfoDbL( infoArray[i]->DisplayName(), contentinfo ); |
|
333 //Get the load status of the plugin. |
|
334 TBool pluginloadstatus = GetPluginLoadStatusL ( uid, version, infoArray[i]->DisplayName() ); |
333 |
335 |
334 UpdateContentInfoDbL( infoArray[i]->DisplayName() ); |
336 if ( pluginloadstatus ) |
335 TBool loadplugin = ETrue; |
|
336 //status of plugin in blacklist table |
|
337 TBool pluginblacklisted = iBlacklistMgr->FindL( uid, version); |
|
338 //status of plugin in unload table |
|
339 TBool loadstatus = iBlacklistMgr->FindfromUnloadListL( uid ); |
|
340 //Check the Uid in both the tables of the blacklist db |
|
341 if ( loadstatus || pluginblacklisted ) |
|
342 loadplugin = EFalse; |
|
343 |
|
344 if ( loadstatus ) |
|
345 { |
337 { |
346 //Found in unload list.Update the indexing and blacklist status in contentinfo DB |
338 LoadHarvesterpluginL (uid, version, infoArray[i]->DisplayName() );//Load the harvester plugin |
347 iContentInfoMgr->UpdatePluginIndexStatusL( infoArray[i]->DisplayName() , KDisable ); |
|
348 iContentInfoMgr->UpdateBlacklistStatusL( infoArray[i]->DisplayName() , KDisable ); |
|
349 } |
339 } |
350 if ( pluginblacklisted ) |
340 } |
351 //Update the blacklist status in content info db |
341 delete contentinfo; |
352 iContentInfoMgr->UpdateBlacklistStatusL( infoArray[i]->DisplayName() , KEnable ); |
342 CleanupStack::PopAndDestroy( &infoArray ); // infoArray, results in a call to CleanupEComArray |
353 |
343 OstTraceFunctionExit0( CINDEXINGMANAGER_LOADPLUGINSL_EXIT ); |
354 if ( loadplugin ) |
|
355 { |
|
356 // Plugin is not black listed. Add it to database and try to load the plugin |
|
357 iBlacklistMgr->AddL( uid , version ); |
|
358 OstTrace1( TRACE_NORMAL, CINDEXINGMANAGER_LOADPLUGINSL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is added to DB", uid.iUid ); |
|
359 CPIXLOGSTRING2("CIndexingManager::LoadPluginsL(): Plugin with uid = %x is added to database", uid.iUid); |
|
360 TRAPD( err, plugin = CIndexingPlugin::NewL( uid ) ); |
|
361 //FFLOGSTRING2( "CFastFindHarvesterPluginControl:: ERROR %d", err ); |
|
362 if ( err == KErrNone ) |
|
363 { |
|
364 // Plugin loaded succesfully. Remove it from the database |
|
365 iBlacklistMgr->Remove(uid); |
|
366 OstTrace1( TRACE_NORMAL, DUP1_CINDEXINGMANAGER_LOADPLUGINSL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is removed from DB", uid.iUid ); |
|
367 CPIXLOGSTRING2("CIndexingManager::LoadPluginsL(): Plugin with uid = %x is removed from database", uid.iUid); |
|
368 iContentInfoMgr->UpdateBlacklistStatusL( infoArray[i]->DisplayName() , KDisable ); |
|
369 CleanupStack::PushL( plugin ); |
|
370 plugin->SetObserver( *this ); |
|
371 plugin->SetSearchSession( iSearchSession ); |
|
372 iPluginArray.AppendL( plugin ); // and add them to array |
|
373 CleanupStack::Pop( plugin ); |
|
374 OstTrace1( TRACE_NORMAL, DUP2_CINDEXINGMANAGER_LOADPLUGINSL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is loaded successfully", uid.iUid ); |
|
375 CPIXLOGSTRING2("CIndexingManager::LoadPluginsL(): Plugin with uid = %x is loaded succesfully", uid.iUid); |
|
376 } |
|
377 } |
|
378 } |
|
379 CleanupStack::PopAndDestroy( &infoArray ); // infoArray, results in a call to CleanupEComArray |
|
380 //FFLOGSTRING( "CFastFindHarvesterPluginControl::LoadPluginsL() plugin!" ); |
|
381 |
|
382 } |
344 } |
383 |
345 |
384 // ----------------------------------------------------------------------------- |
346 // ----------------------------------------------------------------------------- |
385 // CIndexingManager::StartPlugins() |
347 // CIndexingManager::StartPlugins() |
386 // ----------------------------------------------------------------------------- |
348 // ----------------------------------------------------------------------------- |
624 |
586 |
625 // ----------------------------------------------------------------------------- |
587 // ----------------------------------------------------------------------------- |
626 // CIndexingManager::UpdateContentInfoDbL() |
588 // CIndexingManager::UpdateContentInfoDbL() |
627 // ----------------------------------------------------------------------------- |
589 // ----------------------------------------------------------------------------- |
628 // |
590 // |
629 void CIndexingManager::UpdateContentInfoDbL( const TDesC& aPluginName) |
591 void CIndexingManager::UpdateContentInfoDbL( const TDesC& aPluginName, CContentInfo* aContentinfo) |
630 { |
592 { |
631 OstTraceFunctionEntry0( CINDEXINGMANAGER_UPDATECONTENTINFODBL_ENTRY ); |
593 OstTraceFunctionEntry0( CINDEXINGMANAGER_UPDATECONTENTINFODBL_ENTRY ); |
632 TBool iscontentfound = iContentInfoMgr->FindL( aPluginName ); |
594 TBool iscontentfound = iContentInfoMgr->FindL( aPluginName ); |
633 |
595 |
634 if( !iscontentfound ) |
596 if( !iscontentfound ) |
635 { |
597 { |
636 //Add the content details to database |
598 //Add the content details to database |
637 CContentInfo* contentinfo = CContentInfo::NewL(); |
599 aContentinfo->SetNameL( aPluginName ); |
638 contentinfo->SetNameL( aPluginName ); |
600 aContentinfo->SetBlacklistStatus( KEnable ); |
639 contentinfo->SetBlacklistStatus( KEnable ); |
601 aContentinfo->SetIndexStatus( KEnable ); |
640 contentinfo->SetIndexStatus( KEnable ); |
602 iContentInfoMgr->AddL( aContentinfo ); |
641 iContentInfoMgr->AddL( contentinfo ); |
603 |
642 delete contentinfo; |
|
643 } |
604 } |
644 else |
605 else |
645 { |
606 { |
646 iContentInfoMgr->UpdateBlacklistStatusL( aPluginName , KEnable ); |
607 iContentInfoMgr->UpdateBlacklistStatusL( aPluginName , KEnable ); |
647 } |
608 } |
648 OstTraceFunctionExit0( CINDEXINGMANAGER_UPDATECONTENTINFODBL_EXIT ); |
609 OstTraceFunctionExit0( CINDEXINGMANAGER_UPDATECONTENTINFODBL_EXIT ); |
649 } |
610 } |
650 |
611 |
651 // ----------------------------------------------------------------------------- |
612 // ----------------------------------------------------------------------------- |
652 // CIndexingManager::UpdateUnloadList() |
613 // CIndexingManager::UpdateDontloadListL() |
653 // ----------------------------------------------------------------------------- |
614 // ----------------------------------------------------------------------------- |
654 // |
615 // |
655 void CIndexingManager::UpdateUnloadListL() |
616 void CIndexingManager::UpdateDontloadListL() |
656 { |
617 { |
657 OstTraceFunctionEntry0( CINDEXINGMANAGER_UPDATEUNLOADLISTL_ENTRY ); |
618 OstTraceFunctionEntry0( CINDEXINGMANAGER_UPDATEDONTLOADLISTL_ENTRY ); |
658 CPIXLOGSTRING("CIndexingManager::UpdateUnloadList : Start"); |
619 CPIXLOGSTRING("CIndexingManager::UpdateDontloadList : Start"); |
659 //Read the list of Uid's from the cenrep and update blacklist database |
620 //Read the list of Uid's from the cenrep and update blacklist database |
660 //Open the unload list common repository |
621 //Open the unload list common repository |
661 CRepository* unloadrepo = NULL; |
622 CRepository* unloadrepo = NULL; |
662 TRAPD( cerror , unloadrepo = CRepository::NewL( KCPIXHSrepoUidMenu )); |
623 TRAPD( cerror , unloadrepo = CRepository::NewL( KCPIXHSrepoUidMenu )); |
663 if ( cerror != KErrNone) |
624 if ( cerror != KErrNone) |
664 return; |
625 return; |
665 RArray<TUint32> uidlist; |
626 RArray<TUint32> uidlist; |
666 //Read all the key list |
627 //Read all the key list |
|
628 //Matches occur whenever (key & mask) == (partialKey & mask). |
|
629 //The partial key is guaranteed to be masked before use |
|
630 // To fetch all the keys we have done masking with '0' |
667 TInt error = unloadrepo->FindL( 0, 0, uidlist); |
631 TInt error = unloadrepo->FindL( 0, 0, uidlist); |
668 if ( error == KErrNone ) |
632 if ( error == KErrNone ) |
669 { |
633 { |
670 TBuf<KuidStringLength> temp; |
634 TBuf<KCenrepUidLength> temp; |
671 //get the Uid of each and every plugin and add it to blacklist database |
635 //get the Uid of each and every plugin and add it to blacklist database |
672 TInt count = uidlist.Count(); |
636 TInt count = uidlist.Count(); |
673 for (int i = 0; i < count; i++ ) |
637 for (int i = 0; i < count; i++ ) |
674 { |
638 { |
675 TUid uid; |
639 TUid uid; |
676 TInt64 value; |
640 TInt64 value; |
677 unloadrepo->Get( uidlist[i], temp ); |
641 unloadrepo->Get( uidlist[i], temp ); |
678 TLex uidvalue(temp); |
642 TLex uidvalue(temp); |
679 TInt xerr = uidvalue.Val( value,EHex ); |
643 TInt xerr = uidvalue.Val( value,EHex ); |
680 uid.iUid = value; |
644 uid.iUid = value; |
681 (void)iBlacklistMgr->AddtoUnloadListL( uid ); |
645 (void)iBlacklistMgr->AddtoDontloadListL( uid ); |
682 } |
646 } |
683 } |
647 } |
684 CPIXLOGSTRING("CIndexingManager::UpdateUnloadList : End"); |
648 CPIXLOGSTRING("CIndexingManager::UpdateDontloadList : End"); |
685 OstTraceFunctionExit0( CINDEXINGMANAGER_UPDATEUNLOADLISTL_EXIT ); |
649 OstTraceFunctionExit0( CINDEXINGMANAGER_UPDATEDONTLOADLISTL_EXIT ); |
686 } |
650 } |
|
651 |
|
652 // ----------------------------------------------------------------------------- |
|
653 // CIndexingManager::GetPluginLoadStatus() |
|
654 // ----------------------------------------------------------------------------- |
|
655 // |
|
656 TBool CIndexingManager::GetPluginLoadStatusL (TUid aPluginUid, TInt aVersion, const TDesC& aPluginName) |
|
657 { |
|
658 OstTraceFunctionEntry0( DUP1_CINDEXINGMANAGER_GETPLUGINLOADSTATUSL_ENTRY ); |
|
659 //status of plugin in blacklist table |
|
660 TBool pluginblacklisted = iBlacklistMgr->FindL( aPluginUid, aVersion); |
|
661 //status of plugin in unload table |
|
662 TBool loadstatus = iBlacklistMgr->FindInDontloadListL( aPluginUid ); |
|
663 //Check the Uid in both the tables of the blacklist db |
|
664 // if ( loadstatus || pluginblacklisted ) |
|
665 // loadplugin = EFalse; |
|
666 |
|
667 if ( loadstatus ) |
|
668 { |
|
669 //Found in unload list.Update the indexing and blacklist status in contentinfo DB |
|
670 iContentInfoMgr->UpdatePluginIndexStatusL( aPluginName , KDisable ); |
|
671 iContentInfoMgr->UpdateBlacklistStatusL( aPluginName , KDisable ); |
|
672 } |
|
673 if ( pluginblacklisted ) |
|
674 //Update the blacklist status in content info db |
|
675 iContentInfoMgr->UpdateBlacklistStatusL( aPluginName , KEnable ); |
|
676 |
|
677 return (! (loadstatus | pluginblacklisted)); |
|
678 } |
|
679 |
|
680 // ----------------------------------------------------------------------------- |
|
681 // CIndexingManager::GetPluginLoadStatus() |
|
682 // ----------------------------------------------------------------------------- |
|
683 // |
|
684 void CIndexingManager::LoadHarvesterpluginL (TUid aPluginUid, TInt aVersion, const TDesC& aPluginName) |
|
685 { |
|
686 OstTraceFunctionEntry0( CINDEXINGMANAGER_LOADHARVESTERPLUGINL_ENTRY ); |
|
687 CIndexingPlugin* plugin = NULL; |
|
688 // Plugin is not black listed. Add it to blacklist database |
|
689 iBlacklistMgr->AddL( aPluginUid , aVersion ); |
|
690 OstTrace1( TRACE_NORMAL, DUP1_CINDEXINGMANAGER_LOADHARVESTERPLUGINL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is added to DB", aPluginUid.iUid ); |
|
691 CPIXLOGSTRING2("CIndexingManager::LoadHarvesterpluginL(): Plugin with uid = %x is added to database", aPluginUid.iUid); |
|
692 //try to load the plugin |
|
693 TRAPD( err, plugin = CIndexingPlugin::NewL( aPluginUid ) ); |
|
694 if ( err == KErrNone ) |
|
695 { |
|
696 // Plugin loaded succesfully. Remove it from the blacklist database |
|
697 iBlacklistMgr->Remove(aPluginUid); |
|
698 OstTrace1( TRACE_NORMAL, CINDEXINGMANAGER_LOADHARVESTERPLUGINL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is removed from DB", aPluginUid.iUid ); |
|
699 CPIXLOGSTRING2("CIndexingManager::LoadHarvesterpluginL(): Plugin with uid = %x is removed from database", aPluginUid.iUid); |
|
700 iContentInfoMgr->UpdateBlacklistStatusL( aPluginName , KDisable ); |
|
701 CleanupStack::PushL( plugin ); |
|
702 plugin->SetObserver( *this ); |
|
703 plugin->SetSearchSession( iSearchSession ); |
|
704 iPluginArray.AppendL( plugin ); // and add them to array |
|
705 CleanupStack::Pop( plugin ); |
|
706 OstTrace1( TRACE_NORMAL, DUP2_CINDEXINGMANAGER_LOADHARVESTERPLUGINL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is loaded successfully", aPluginUid.iUid ); |
|
707 CPIXLOGSTRING2("CIndexingManager::LoadHarvesterpluginL(): Plugin with uid = %x is loaded succesfully", aPluginUid.iUid); |
|
708 } |
|
709 OstTraceFunctionExit0( CINDEXINGMANAGER_LOADHARVESTERPLUGINL_EXIT ); |
|
710 } |