|
1 /* |
|
2 * Copyright (c) 2006 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: Plugin handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXCOLLECTIONPLUGINHANDLER_H |
|
20 #define CMPXCOLLECTIONPLUGINHANDLER_H |
|
21 |
|
22 #include <mpxpluginhandlerbase.h> |
|
23 #include <mpxcollectionframeworkdefs.h> |
|
24 |
|
25 class CMPXCollectionPlugin; |
|
26 class MMPXCollectionPluginObserver; |
|
27 |
|
28 /** |
|
29 * Processes plug-ins |
|
30 */ |
|
31 NONSHARABLE_CLASS(CMPXCollectionPluginHandler) : public CMPXPluginHandlerBase |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Two-phased constructor. |
|
36 * |
|
37 * @param aPluginObserver plugin observer |
|
38 * @param aObserver plugin handler observer |
|
39 * @return Constructed object |
|
40 */ |
|
41 static CMPXCollectionPluginHandler* NewL(MMPXCollectionPluginObserver& aPluginObserver, |
|
42 MMPXPluginHandlerObserver& aObserver); |
|
43 |
|
44 /** |
|
45 * Destructor |
|
46 */ |
|
47 ~CMPXCollectionPluginHandler(); |
|
48 |
|
49 public: |
|
50 /** |
|
51 * Returns currently loaded plug-in, or NULL if none |
|
52 * |
|
53 * @return plugin object interface |
|
54 */ |
|
55 inline CMPXCollectionPlugin* Plugin(); |
|
56 |
|
57 /** |
|
58 * Get all currently loaded plugins |
|
59 * @return array of loaded plugins |
|
60 */ |
|
61 TArray<CMPXCollectionPlugin*> LoadedPlugins(); |
|
62 |
|
63 /** |
|
64 * Remove task for one client which is the observer of tasks |
|
65 * @aCallback the observer of the tasks to be removed |
|
66 */ |
|
67 void RemoveTask(TAny* aCallback); |
|
68 |
|
69 /** |
|
70 * Retrieve the list of non cachable attributes for a plugin |
|
71 * @param aPlugin UID of the plugin |
|
72 */ |
|
73 const TArray<TUid> NonCacheableAttributesL( const TUid& aPluginId ); |
|
74 |
|
75 /** |
|
76 * Check if a plugin is cachable in the collection cache |
|
77 * @param aPlugin |
|
78 */ |
|
79 TBool PluginCachable( const TUid& aPluginId ); |
|
80 |
|
81 /** |
|
82 * Returns the loaded plugin by implementation uid. |
|
83 * |
|
84 * @param aUid implementation uid of the plugin |
|
85 * @return plugin pointer if plugin already loaded or NULL if not loaded |
|
86 */ |
|
87 CMPXCollectionPlugin* LoadedPlugin(const TUid& aUid); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * From Base CMPXPluginHandlerBase |
|
93 * Resolves a plugin |
|
94 */ |
|
95 void ResolvePluginL(); |
|
96 |
|
97 /** |
|
98 * From Base CMPXPluginHandlerBase |
|
99 * Constructs the collection plugin info |
|
100 */ |
|
101 CMPXPluginInfo* ConstructPluginInfoLC( const CImplementationInformation& aData ); |
|
102 |
|
103 /** |
|
104 * @see CMPXPluginHandlerBase |
|
105 */ |
|
106 TBool IsPluginLoaded(const TUid& aPluginUid); |
|
107 |
|
108 /** |
|
109 * @see CMPXPluginHandlerBase |
|
110 */ |
|
111 void LoadPluginL(const TUid& aPluginUid); |
|
112 |
|
113 |
|
114 /** |
|
115 * From Base CMPXPluginHandlerBase |
|
116 * Unloads a plugin |
|
117 * @param aUid identifies the plugin |
|
118 */ |
|
119 void UnloadPlugin(const TUid& aUid); |
|
120 |
|
121 |
|
122 /** |
|
123 * Create the plugin object given UID |
|
124 * |
|
125 * @param UID of the plugin |
|
126 * @return plugin object |
|
127 */ |
|
128 CMPXCollectionPlugin* CreateCollectionPluginL(const TUid& aUid); |
|
129 |
|
130 /** |
|
131 * Returns the loaded plugin index corresponding to the UID. |
|
132 * |
|
133 * @param aUid implementation uid of the plugin |
|
134 * @return plugin index in iLoadedPlugins or KErrNotFound |
|
135 */ |
|
136 TInt LoadedPluginIndex(const TUid& aUid); |
|
137 |
|
138 /** |
|
139 * Unloads the plugin at a specified index. |
|
140 * @param aIndex index of the plugin in iLoadedPlugins |
|
141 */ |
|
142 void UnloadPlugin(TInt aIndex); |
|
143 |
|
144 private: |
|
145 |
|
146 /** |
|
147 * 2nd phase contructor |
|
148 */ |
|
149 void ConstructL(); |
|
150 |
|
151 /** |
|
152 * C++ constructor |
|
153 * |
|
154 * @param aPluginObserver plugin observer |
|
155 * @param aObserver plugin handler observer |
|
156 */ |
|
157 CMPXCollectionPluginHandler(MMPXCollectionPluginObserver& aPluginObserver, |
|
158 MMPXPluginHandlerObserver& aObserver); |
|
159 |
|
160 private: |
|
161 MMPXCollectionPluginObserver* iPluginObserver; //Not Owned |
|
162 RPointerArray<CMPXCollectionPlugin> iLoadedPlugins; |
|
163 |
|
164 // Most recently Selected plugin |
|
165 // |
|
166 CMPXCollectionPlugin* iPlugin; |
|
167 }; |
|
168 |
|
169 #include "mpxcollectionpluginhandler.inl" |
|
170 |
|
171 #endif // CMPXCOLLECTIONPLUGINHANDLER_H |