|
1 /* |
|
2 * Copyright (c) 2008 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: Midlet PackageInfo factory |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef APPMNGR2MIDLETPCKGINFOFACTORY_H |
|
20 #define APPMNGR2MIDLETPCKGINFOFACTORY_H |
|
21 |
|
22 #include "appmngr2midletpackageinfo.h" // CAppMngr2MidletPackageInfo |
|
23 #include "jcfjadjarmatcher.h" // CJcfJadJarMatcher |
|
24 |
|
25 class CAppMngr2Runtime; |
|
26 class CAppMngr2MidletUtils; |
|
27 class CAppMngr2RecognizedFile; |
|
28 class CAppMngr2MidletResourceHandler; |
|
29 |
|
30 /** |
|
31 * Midlet PackageInfo factory implementation |
|
32 * |
|
33 * This class matches provided JAD and JAR files to array |
|
34 * of PackageInfo objects. |
|
35 * |
|
36 * @lib appmngr2midletplugin.dll |
|
37 * @since S60 v9.1 |
|
38 */ |
|
39 class CAppMngr2MidletPckgInfoFactory : public CActive, |
|
40 public MJcfJadJarMatcherObserver |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Two phase constructor |
|
45 * |
|
46 * @since S60 9.1 |
|
47 * @param aRuntime Runtime |
|
48 * @param aFs Handle to a file server session |
|
49 * @return instance |
|
50 */ |
|
51 static CAppMngr2MidletPckgInfoFactory* NewL(CAppMngr2Runtime& aRuntime, RFs& aFs, CAppMngr2MidletResourceHandler& aResourceHandler); |
|
52 |
|
53 /** |
|
54 * Destructor |
|
55 * |
|
56 * @since S60 9.1 |
|
57 */ |
|
58 ~CAppMngr2MidletPckgInfoFactory(); |
|
59 |
|
60 /** |
|
61 * Compose array of PackageInfo object of installable |
|
62 * packages. |
|
63 * |
|
64 * @since S60 9.1 |
|
65 * @param aPackageInfo Returned array of installable packages |
|
66 * @param aFileList Array of recognized files |
|
67 * @param aStatus The request status. KErrNone on completion, |
|
68 * otherwise another of the system-wide error codes. |
|
69 * |
|
70 */ |
|
71 void GetInstallationFilesL(RPointerArray<CAppMngr2PackageInfo>& aPackageInfos, |
|
72 const RPointerArray<CAppMngr2RecognizedFile>& aFileList, |
|
73 TRequestStatus& aStatus); |
|
74 |
|
75 /** |
|
76 * Cancel pending asynchronous GetInstallationFilesL() request. |
|
77 * |
|
78 * @since S60 9.1 |
|
79 */ |
|
80 void CancelGetInstallationFiles(); |
|
81 |
|
82 public: // MJcfJadJarMatcherObserver |
|
83 /** |
|
84 * Callback from CJcfJadJarMatcher |
|
85 */ |
|
86 void Update(TInt aArg1); |
|
87 |
|
88 protected: // from CActive |
|
89 void RunL(); |
|
90 void DoCancel(); |
|
91 TInt RunError(TInt aError); |
|
92 |
|
93 private: |
|
94 /** |
|
95 * Constructor |
|
96 * |
|
97 * @since S60 9.1 |
|
98 * @param aRuntime Runtime |
|
99 * @param aFs Handle to a file server session |
|
100 */ |
|
101 CAppMngr2MidletPckgInfoFactory(CAppMngr2Runtime& aRuntime, RFs& aFs, CAppMngr2MidletResourceHandler& aResourceHandler); |
|
102 |
|
103 /** |
|
104 * Second phase constructor |
|
105 * |
|
106 * @since S60 9.1 |
|
107 */ |
|
108 void ConstructL(); |
|
109 |
|
110 /** |
|
111 * Creates PackageInfo object of installable package and |
|
112 * append it to array of inst pckgs. |
|
113 * |
|
114 * @since S60 9.1 |
|
115 * @param aFileName File name to installable package |
|
116 * @param aDataType Corresponding data type |
|
117 * @param aStatus Request statys |
|
118 */ |
|
119 void GetInstallationFileL(const TDesC& aFileName, |
|
120 const TDataType& aDataType); |
|
121 |
|
122 /** |
|
123 * Completes asynchronous request |
|
124 * |
|
125 * @since S60 9.1 |
|
126 * @param aRequestStatus Request request |
|
127 * @param aReason completation reason |
|
128 */ |
|
129 void CompleteRequest(TRequestStatus& aRequestStatus, TInt aStatus); |
|
130 |
|
131 /** |
|
132 * Match JAD and JAR file |
|
133 * |
|
134 * @since S60 9.1 |
|
135 * @param aMatchingFileName Path file name to matching JAD or JAR file. |
|
136 * @param aMatchingMimeType - MIME type of matching JAD or JAR file |
|
137 * @param aMatchedFileName - Path file name of the matched JAR or JAD file |
|
138 * @param aStatus The request status. KErrNone on completion, |
|
139 * otherwise another of the system-wide error codes. |
|
140 */ |
|
141 void MatchL(const TDesC& aMatchingFileName, |
|
142 const TDesC8& aMatchingMimeType, |
|
143 TDes& aMatchedFileName, |
|
144 TRequestStatus &aStatus); |
|
145 |
|
146 /** |
|
147 * Cancel matching JAD or JAR file |
|
148 * The Jad Jar Matcher API does not provide cancel method. |
|
149 * The cancelation is provided by deletation of matcher instance. |
|
150 * |
|
151 * @since S60 9.1 |
|
152 */ |
|
153 void CancelMatching(); |
|
154 |
|
155 private: // data |
|
156 |
|
157 /** |
|
158 * Handle to a file server session |
|
159 * Not owned |
|
160 */ |
|
161 RFs& iFs; |
|
162 |
|
163 /** |
|
164 * Path to JAD file |
|
165 */ |
|
166 TFileName iJadFile; |
|
167 |
|
168 /** |
|
169 * Path to JAR file |
|
170 */ |
|
171 TFileName iJarFile; |
|
172 |
|
173 /** |
|
174 * Parsed installation files |
|
175 */ |
|
176 TInt iCounter; |
|
177 |
|
178 /** |
|
179 * Next state |
|
180 */ |
|
181 TInt iState; |
|
182 |
|
183 /** |
|
184 * External request status |
|
185 * Not owned |
|
186 */ |
|
187 TRequestStatus* iExtStatus; |
|
188 |
|
189 /** |
|
190 * Array of installation packages |
|
191 * Not owned |
|
192 */ |
|
193 RPointerArray<CAppMngr2PackageInfo>* iPackageInfos; |
|
194 |
|
195 /** |
|
196 * Array of recognized installation packages |
|
197 * Not owned |
|
198 */ |
|
199 const RPointerArray<CAppMngr2RecognizedFile>* iFileList; // not own |
|
200 |
|
201 /** |
|
202 * Runtime |
|
203 * Not owned |
|
204 */ |
|
205 CAppMngr2Runtime& iRuntime; |
|
206 |
|
207 /** |
|
208 * JAD JAR Matcher |
|
209 * Owned |
|
210 */ |
|
211 CJcfJadJarMatcher* iMatcher; |
|
212 |
|
213 /** |
|
214 * State machine states |
|
215 */ |
|
216 enum TMatchingStates |
|
217 { |
|
218 ENextPckg = 0, |
|
219 EMatchedJar, |
|
220 EMatchedJad, |
|
221 EAppendPckg |
|
222 }; |
|
223 CAppMngr2MidletResourceHandler& iResourceHandler; |
|
224 }; |
|
225 |
|
226 #endif // APPMNGR2MIDLETPCKGINFOFACTORY_H |