predictivesearch/PcsAlgorithm/Algorithm2/inc/CPsDataPluginInterface.h
branchRCL_3
changeset 63 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2007 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 CPS_DATA_PLUGIN_ALGORITHM_2_INTERFACE_H
       
    19 #define CPS_DATA_PLUGIN_ALGORITHM_2_INTERFACE_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <coemain.h>
       
    23 
       
    24 #include "CPcsDefs.h"
       
    25 #include "CPsData.h"
       
    26 #include "mdatastoreobserver.h"
       
    27 #include "mstorelistobserver.h"
       
    28 
       
    29 // FORWARD DECLARATION	
       
    30 class CPsDataPlugin;
       
    31 
       
    32 /**
       
    33  * Class is used to instantiate the required plugins when the search has been
       
    34  * asked. Acts as interface to all Plugins.
       
    35  */
       
    36 
       
    37 class CPsDataPluginInterface : public CBase
       
    38     {
       
    39 public:
       
    40 
       
    41     /** 
       
    42      * Symbian OS 2 phased constructor.
       
    43      * @param aObserverForDataStore  An observer instance for data store
       
    44      * @param aStoreListObserver     A store list observer instance
       
    45      * @return	A pointer to the created instance of CPsDataPluginInterface.
       
    46      */
       
    47     static CPsDataPluginInterface* NewL(MDataStoreObserver* aObserverForDataStore,
       
    48                                         MStoreListObserver* aStoreListObserver);
       
    49 
       
    50     /** 
       
    51      * Symbian OS 2 phased constructor.
       
    52      * @param aObserverForDataStore  An observer instance for data store
       
    53      * @param aStoreListObserver     A store list observer instance
       
    54      * @return	A pointer to the created instance of CPsDataPluginInterface.
       
    55      */
       
    56     static CPsDataPluginInterface* NewLC(MDataStoreObserver* aObserverForDataStore,
       
    57                                          MStoreListObserver* aStoreListObserver);
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      */
       
    62     virtual ~CPsDataPluginInterface();
       
    63 
       
    64     /**
       
    65      * Instantiates the required data store plug-ins known by the ecom framework.	
       
    66      */
       
    67     void InstantiateAllPlugInsL();
       
    68 
       
    69     /**
       
    70      * Unloads all plugins
       
    71      * This should internally call  REComSession::DestroyedImplementation( iDtor_ID_Key )
       
    72      * and then REComSession::FinalClose()
       
    73      */
       
    74     void UnloadPlugIns();
       
    75 
       
    76     /**
       
    77      * Lists all implementations which satisfy this ecom interface
       
    78      *
       
    79      * @param aImplInfoArray On return, contains the list of available implementations
       
    80      * 
       
    81      */
       
    82     inline void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray)
       
    83         {
       
    84         REComSession::ListImplementationsL(KPsDataStoreInterfaceUid, aImplInfoArray);
       
    85         }
       
    86 
       
    87     /**
       
    88      * Requests the DataStore for data 
       
    89      */
       
    90     void RequestForDataL(TDesC& aDataStore);
       
    91 
       
    92     /**
       
    93      * Retrieve all the supported URIs from data adapters
       
    94      */
       
    95     void GetAllSupportedDataStoresL(RPointerArray<TDesC>& aDataStores);
       
    96 
       
    97     /**
       
    98      * Retrieve the supported data fields from adapters
       
    99      */
       
   100     void GetSupportedDataFieldsL(TDesC& aUri, RArray<TInt>& aDataFields);
       
   101 
       
   102 private:
       
   103 
       
   104     /** 
       
   105      * Performs the first phase of two phase construction.
       
   106      */
       
   107     CPsDataPluginInterface();
       
   108 
       
   109     /** 
       
   110      * Symbian OS 2 phased constructor.
       
   111      */
       
   112     void ConstructL(MDataStoreObserver* aObserverForDataStore,
       
   113             MStoreListObserver* aStoreListObserver);
       
   114 
       
   115     /**
       
   116      * Instantiates a data store plug-in, knowing the implementation uid.
       
   117      * @param aImpUid imp uID
       
   118      */
       
   119     CPsDataPlugin* InstantiatePlugInFromImpUidL(const TUid& aImpUid,
       
   120             MDataStoreObserver* aObserverForDataStore,
       
   121             MStoreListObserver* aStoreListObserver);
       
   122 
       
   123 private:
       
   124 
       
   125     TUid iDtor_ID_Key;
       
   126 
       
   127     // List of plugins that this interface will interact with
       
   128     RPointerArray<CPsDataPlugin> iPsDataPluginInstances;
       
   129 
       
   130     /**
       
   131      *  An observer instance used to
       
   132      *  send the data from adapters to data cache
       
   133      */
       
   134     MDataStoreObserver* iObserverForDataStore;
       
   135 
       
   136     /**
       
   137      * An observer instance used to send the datastore to the adapter
       
   138      */
       
   139     MStoreListObserver* iStoreListObserver;
       
   140     };
       
   141 
       
   142 #endif // CPS_DATA_PLUGIN_ALGORITHM_2_INTERFACE_H
       
   143 
       
   144 //End of File