|
1 /* |
|
2 * Copyright (c) 2009 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: Java Sif plugin, ECom implementation of KUidSifPlugin. |
|
15 * Starts Java Installer to handle install, uninstall, get component info |
|
16 * requests. |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef JAVASIFPLUGIN_H |
|
22 #define JAVASIFPLUGIN_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <usif/sif/sifplugin.h> |
|
26 |
|
27 #include "f32file.h" |
|
28 #include "resultsserver.h" |
|
29 |
|
30 using namespace Usif; |
|
31 |
|
32 /** |
|
33 * The messages known by JavaSifPlugin. |
|
34 */ |
|
35 |
|
36 const int INSTALLER_CANCEL_MESSAGE_ID = 603; |
|
37 const int INSTALLER_CANCEL_RESPONSE_MESSAGE_ID = 604; |
|
38 |
|
39 namespace Java |
|
40 { |
|
41 namespace Installer |
|
42 { |
|
43 |
|
44 /** |
|
45 * This class implements the ECom KUidSifPlugin interface for midlet |
|
46 * installation for OMJ. |
|
47 */ |
|
48 NONSHARABLE_CLASS(CJavaSifPlugin) : public Usif::CSifPlugin |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 static CJavaSifPlugin* NewL(); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CJavaSifPlugin(); |
|
61 |
|
62 public: // From base classes |
|
63 |
|
64 // From base class CSifPlugin |
|
65 |
|
66 /** |
|
67 * Returns details of a component to be installed by file name. |
|
68 * |
|
69 * @param aFileName Component's file name |
|
70 * @param aSecurityContext this param allows the plug-in to verify client's identity |
|
71 * @param aComponentInfo On return, contains component's details |
|
72 * @param aStatus Asynchronous completion status |
|
73 */ |
|
74 virtual void GetComponentInfo( |
|
75 const TDesC& aFileName, |
|
76 const TSecurityContext& aSecurityContext, |
|
77 CComponentInfo& aComponentInfo, |
|
78 TRequestStatus& aStatus); |
|
79 |
|
80 /** |
|
81 * Returns details of a component to be installed by file handle. |
|
82 * |
|
83 * @param aFileHandle Component's file name |
|
84 * @param aSecurityContext this param allows the plug-in to verify client's identity |
|
85 * @param aComponentInfo On return, contains component's details |
|
86 * @param aStatus Asynchronous completion status |
|
87 */ |
|
88 virtual void GetComponentInfo( |
|
89 RFile& aFileHandle, |
|
90 const TSecurityContext& aSecurityContext, |
|
91 CComponentInfo& aComponentInfo, |
|
92 TRequestStatus& aStatus); |
|
93 |
|
94 /** |
|
95 * Installs a component by file name. |
|
96 * |
|
97 * @param aFileName Component's file name |
|
98 * @param aSecurityContext this param allows the plug-in to verify client's identity |
|
99 * @param aArguments The array of opaque params for the plug-in. An empty |
|
100 * array may be passed. The following param is defined for the "SCOMO Install |
|
101 * Inactive" operation: |
|
102 * Name: InstallInactive, Type: Int, Value: ETrue |
|
103 * If a plug-in receives this param, it must install a component normally but the SCOMO |
|
104 * State should remain EDeactivated. |
|
105 * @param aResults The array of opaque params returned from the plug-in. |
|
106 * The following return param is defined for the id of an installed component: |
|
107 * Name: ComponentId, Type: Int |
|
108 * Each plug-in must add this param to aResults after a successful installation. |
|
109 * For packages containing embedded components, the returned param contains |
|
110 * the id of the last/most embedded component. |
|
111 * @param aStatus Asynchronous completion status |
|
112 */ |
|
113 virtual void Install( |
|
114 const TDesC& aFileName, |
|
115 const TSecurityContext& aSecurityContext, |
|
116 const COpaqueNamedParams& aArguments, |
|
117 COpaqueNamedParams& aResults, |
|
118 TRequestStatus& aStatus); |
|
119 |
|
120 /** |
|
121 * Installs a component by file handle. |
|
122 * |
|
123 * @param aFileHandle Component's file handle |
|
124 * @param aSecurityContext this param allows the plug-in to verify client's identity |
|
125 * @param aArguments The array of opaque params for the plug-in. An empty |
|
126 * array may be passed. The following param is defined for the "SCOMO Install |
|
127 * Inactive" operation: |
|
128 * Name: InstallInactive, Type: Int, Value: ETrue |
|
129 * If a plug-in receives this param, it must install a component normally but the SCOMO |
|
130 * State should remain EDeactivated. |
|
131 * @param aResults The array of opaque params returned from the plug-in. |
|
132 * The following return param is defined for the id of an installed component: |
|
133 * Name: ComponentId, Type: Int |
|
134 * Each plug-in must add this param to aResults after a successful installation. |
|
135 * For packages containing embedded components, the returned param contains |
|
136 * the id of the last/most embedded component. |
|
137 * @param aStatus Asynchronous completion status |
|
138 */ |
|
139 virtual void Install( |
|
140 RFile& aFileHandle, |
|
141 const TSecurityContext& aSecurityContext, |
|
142 const COpaqueNamedParams& aArguments, |
|
143 COpaqueNamedParams& aResults, |
|
144 TRequestStatus& aStatus); |
|
145 |
|
146 /** |
|
147 * Uninstalls a component. |
|
148 * |
|
149 * @param aComponentId The id of a component to be uninstalled |
|
150 * @param aSecurityContext this param allows the plug-in to verify client's identity |
|
151 * @param aArguments The array of opaque params for the plug-in. An empty |
|
152 * array may be passed. |
|
153 * @param aResults The array of opaque results returned from the plug-in. |
|
154 * @param aStatus The request status. KErrNone, if successful, otherwise |
|
155 * one of the other system-wide or SIF error codes defined in usiferror.h. |
|
156 */ |
|
157 virtual void Uninstall( |
|
158 TComponentId aComponentId, |
|
159 const TSecurityContext& aSecurityContext, |
|
160 const COpaqueNamedParams& aArguments, |
|
161 COpaqueNamedParams& aResults, |
|
162 TRequestStatus& aStatus); |
|
163 |
|
164 /** |
|
165 * Activates a component. |
|
166 * |
|
167 * @param aComponentId The id of a component to be activated |
|
168 * @param aSecurityContext this param allows the plug-in to verify client's identity |
|
169 * @param aStatus The request status. KErrNone, if successful, otherwise |
|
170 * one of the other system-wide or SIF error codes defined in usiferror.h. |
|
171 */ |
|
172 virtual void Activate( |
|
173 TComponentId aComponentId, |
|
174 const TSecurityContext& aSecurityContext, |
|
175 TRequestStatus& aStatus); |
|
176 |
|
177 /** |
|
178 * Deactivates a component. |
|
179 * |
|
180 * @param aComponentId The id of a component to be deactivated |
|
181 * @param aSecurityContext this param allows the plug-in to verify client's identity |
|
182 * @param aStatus The request status. KErrNone, if successful, otherwise |
|
183 * one of the other system-wide or SIF error codes defined in usiferror.h. |
|
184 */ |
|
185 virtual void Deactivate( |
|
186 TComponentId aComponentId, |
|
187 const TSecurityContext& aSecurityContext, |
|
188 TRequestStatus& aStatus); |
|
189 |
|
190 /** |
|
191 * Cancels an ongoing asynchronous request. |
|
192 * |
|
193 * This is a synchronous call. When it returns the original asynchronous call is completed. |
|
194 */ |
|
195 virtual void CancelOperation(); |
|
196 |
|
197 |
|
198 private: |
|
199 |
|
200 /** |
|
201 * Constructor. |
|
202 */ |
|
203 CJavaSifPlugin(); |
|
204 |
|
205 /** |
|
206 * 2nd phase constructor. |
|
207 */ |
|
208 void ConstructL(); |
|
209 |
|
210 /** |
|
211 * Java Installer does not have AllFiles capability. |
|
212 * So if the .jad/.jar file is in the private data cage of |
|
213 * some other process, it must be copied |
|
214 * to the private data cage of Java Installer in this |
|
215 * plugin which is executed in a prorcess which hopefully has |
|
216 * AllFiles capability. |
|
217 * |
|
218 * @param[in][out] aFileName The file to installed. The file |
|
219 * will be copied to tmp directory in Java Installer data cage |
|
220 * if needed. In this case aFileName is changed also. |
|
221 */ |
|
222 void CopyFilesIfNeededL(TFileName &aFileName); |
|
223 |
|
224 |
|
225 private: // Data |
|
226 |
|
227 TRequestStatus* iStatus; |
|
228 RFs iRFs; |
|
229 RArray<RProcess> iHandlesToClose; |
|
230 ResultsServer* iResultsServer; |
|
231 |
|
232 COpaqueNamedParams* iDummyResults; |
|
233 CComponentInfo* iDummyInfo; |
|
234 }; |
|
235 |
|
236 } // Installer |
|
237 } // Java |
|
238 |
|
239 #endif // JAVASIFPLUGIN_H |