searchsrv_plat/cpix_framework_api/inc/cindexingplugin.h
changeset 0 671dee74050a
child 23 d4d56f5e7c55
equal deleted inserted replaced
-1:000000000000 0:671dee74050a
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef INDEXINGPLUGIN_H
       
    19 #define INDEXINGPLUGIN_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <ecom/ImplementationInformation.h>
       
    23 #include <MIndexingPluginObserver.h>
       
    24 #include <RSearchServerSession.h>
       
    25 #include <CCPixIndexer.h>
       
    26 
       
    27 /** @addtogroup PluginAPI */
       
    28 /*\@{*/
       
    29 
       
    30 /**
       
    31  * @file
       
    32  * @ingroup PluginAPI
       
    33  * @brief Contains CIndexingPlugin and related definitions
       
    34  */
       
    35 
       
    36 // Uid for this interface
       
    37 const TUid KIndexingPluginInterfaceUid = { 0x2001F700 };
       
    38 
       
    39 
       
    40 /**
       
    41  * @ingroup PluginAPI
       
    42  * @brief Contains ECOM interface related methods
       
    43  */
       
    44 
       
    45 namespace CPixSearchECom
       
    46     {   
       
    47    /**
       
    48      * CleanupPtrArray function is used for cleanup support of locally declared arrays.
       
    49      * @param aArray  An array to cleanup
       
    50      */
       
    51     template<typename T> inline void CleanupPtrArray( TAny* aArray )
       
    52         {
       
    53         static_cast<RPointerArray<T>*>(aArray)->ResetAndDestroy();
       
    54         static_cast<RPointerArray<T>*>(aArray)->Close();
       
    55         }
       
    56         
       
    57         /**
       
    58          * CleanupEComArray function is used for cleanup support of locally declared arrays.
       
    59          * @param aArray  An array to cleanup
       
    60          */
       
    61      inline void CleanupEComArray( TAny* aArray )
       
    62             {
       
    63             CleanupPtrArray<CImplementationInformation>( aArray );
       
    64             }
       
    65     }
       
    66 
       
    67 
       
    68 /**
       
    69  * @brief Base class for CPix Search Server plugins, responsible for harvesting
       
    70  * 
       
    71  * CIndexPlugin is a base class for Search Server plugins, which are responsible
       
    72  * for maintaining index databases for various datasources up to date. The plugins are 
       
    73  * expected to maintain the databases through harvesting and monitoring activities, 
       
    74  * where all items of the datasources are first indexed and after that the datasource
       
    75  * is observed and the occured changes (insertions, updates, deletions) are applied
       
    76  * also to the index database. 
       
    77  *
       
    78  * Link against: CPixSearchPluginInterface.dll
       
    79  */
       
    80 class CIndexingPlugin : public CBase
       
    81 {
       
    82 public:
       
    83 	IMPORT_C static CIndexingPlugin* NewL(const TUid aUid);
       
    84 	IMPORT_C virtual ~CIndexingPlugin();
       
    85 	
       
    86 	IMPORT_C static void ListImplementationsL(RImplInfoPtrArray& aImplInfoArray);	
       
    87 	
       
    88 	/**
       
    89 	* Set observer
       
    90 	*
       
    91 	*/
       
    92 	IMPORT_C void SetObserver(MIndexingService& aObserver);
       
    93 	
       
    94 	/**
       
    95 	* SetSearchSession
       
    96 	* Sets the RSearchServerSession for the plugin.
       
    97 	*
       
    98 	* @param aSearchSession search server session to be assigned to
       
    99 	* harvester plugins
       
   100 	*/
       
   101 	IMPORT_C void SetSearchSession(RSearchServerSession& aSearchSession);
       
   102 
       
   103 	/**
       
   104 	* A pure virtual method which starts the monitoring/harvesting plugin
       
   105 	* Observer must be set before harvesting is started. 
       
   106 	*/
       
   107 	virtual void StartPluginL() = 0;
       
   108 	
       
   109 	/**
       
   110 	* A pure virtual method which instructs plugin to start harvesting for certain media.
       
   111 	* Observer must be set before harvesting is started. 
       
   112 	*
       
   113 	* @param aQualifiedBaseAppClass database to harvest
       
   114 	*/
       
   115 	virtual void StartHarvestingL(const TDesC& aQualifiedBaseAppClass) = 0;
       
   116 	
       
   117 	/**
       
   118 	 * Flush
       
   119 	 * Issue CPix flush. Harvester should call this method after 
       
   120 	 * harvesting is done.
       
   121 	 * 
       
   122 	 * @param aIndexer Indexer to be flushed
       
   123 	 */
       
   124 	IMPORT_C void Flush(CCPixIndexer& aIndexer);
       
   125 	
       
   126 private: // data members
       
   127 	// Identification on cleanup.
       
   128 	TUid iDtor_ID_Key;
       
   129 protected:
       
   130 	// Observer interface
       
   131 	MIndexingService* iObserver;
       
   132 
       
   133     /* Search Server session member is used by harvester plugins */
       
   134     RSearchServerSession iSearchSession;
       
   135 };
       
   136 
       
   137 /*\@}*/
       
   138 
       
   139 #endif // INDEXINGPLUGIN_H