|
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_INTERFACE_H |
|
19 #define CPS_DATA_PLUGIN_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 /** |
|
94 * Retrieve all the supported URIs from data adapters |
|
95 */ |
|
96 void GetAllSupportedDataStoresL(RPointerArray<TDesC>& aDataStores); |
|
97 |
|
98 |
|
99 /** |
|
100 * Retrieve the supported data fields from adapters |
|
101 */ |
|
102 void GetSupportedDataFieldsL(TDesC& aUri, RArray<TInt>& aDataFields); |
|
103 |
|
104 |
|
105 private: |
|
106 |
|
107 /** |
|
108 * Performs the first phase of two phase construction. |
|
109 */ |
|
110 CPsDataPluginInterface(); |
|
111 |
|
112 /** |
|
113 * Symbian OS 2 phased constructor. |
|
114 */ |
|
115 void ConstructL(MDataStoreObserver* aObserverForDataStore, |
|
116 MStoreListObserver* aStoreListObserver); |
|
117 |
|
118 /** |
|
119 * Instantiates a data store plug-in, knowing the implementation uid. |
|
120 * @param aImpUid imp uID |
|
121 */ |
|
122 CPsDataPlugin* InstantiatePlugInFromImpUidL( const TUid& aImpUid, |
|
123 MDataStoreObserver* aObserverForDataStore, |
|
124 MStoreListObserver* aStoreListObserver ); |
|
125 |
|
126 |
|
127 private: |
|
128 |
|
129 TUid iDtor_ID_Key; |
|
130 |
|
131 // List of plugins that this interface will interact with |
|
132 RPointerArray<CPsDataPlugin> iPsDataPluginInstances; |
|
133 |
|
134 /** |
|
135 * An observer instance used to |
|
136 * send the data from adapters to data cache |
|
137 */ |
|
138 MDataStoreObserver* iObserverForDataStore; |
|
139 |
|
140 /** |
|
141 * An observer instance used to send the datastore to the adapter |
|
142 */ |
|
143 MStoreListObserver* iStoreListObserver; |
|
144 }; |
|
145 |
|
146 #endif // CPS_DATA_PLUGIN_INTERFACE_H |
|
147 |
|
148 //End of File |