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 the License "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 platform 2.0 javarestoreconverter process |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef RESTORECONVERTMIDLET_H |
|
20 #define RESTORECONVERTMIDLET_H |
|
21 |
|
22 #include <f32file.h> |
|
23 #include <e32base.h> |
|
24 #include <javasymbianoslayer.h> |
|
25 |
|
26 #include "restoreserver.h" |
|
27 |
|
28 /** |
|
29 * The main active object of Java Restore Converter that is executed once |
|
30 * to when old S60 MIDlets have been restored to device and they must be |
|
31 * conversion installed to OMJ Java applications |
|
32 * |
|
33 * This active object is activated from the process main() after the |
|
34 * active scheduler has been created. |
|
35 */ |
|
36 class CRestoreConvertMIDlet : public CActive |
|
37 { |
|
38 enum TRestorationState |
|
39 { |
|
40 EFindOutDeviceDrives, |
|
41 EGetDriveToBeScanned, |
|
42 EAppsInInstalledDirectories, |
|
43 EUninstallFromOMJ, |
|
44 EExecuteRestoreServer, |
|
45 EExit |
|
46 }; |
|
47 |
|
48 public: |
|
49 static CRestoreConvertMIDlet* NewLC(RFs& aFs); |
|
50 |
|
51 void CompleteRequest(); |
|
52 ~CRestoreConvertMIDlet(); |
|
53 void Start(); |
|
54 |
|
55 protected: |
|
56 // From CActive |
|
57 void RunL(); |
|
58 void DoCancel(); |
|
59 TInt RunError(TInt aError); |
|
60 |
|
61 private: |
|
62 void Exit(); |
|
63 CRestoreConvertMIDlet(RFs& aFs); |
|
64 void ConstructL(); |
|
65 void GetInstallFilesL(RPointerArray<HBufC>& aDirs); |
|
66 void FindRemainingMIDletsToBeUninstalledL(); |
|
67 void UninstallAllFromDriveL(TDriveNumber &aDrive); |
|
68 void RunJavaInstallerL(); |
|
69 void RemoveDataFile(); |
|
70 void FullCleanup(); |
|
71 void AddJadJarToInstallFilesL( |
|
72 const TFileName &aSuitePathName, |
|
73 const CDir *aSuiteDirEntryList); |
|
74 void GetAllDeviceDrivesL(); |
|
75 |
|
76 // Parse MIDlet-Name and MIDlet-Vendor parameters from .jad file. |
|
77 TBool ParseJadL(const TDesC& aJadFileName); |
|
78 // Parse MIDlet-Name and MIDlet-Vendor parameters from Manifest. |
|
79 TBool ParseJarL(const TDesC& aJarFileName); |
|
80 // Return the uid of the suite if it has been installed, |
|
81 // wstring is empty if suite was not found |
|
82 std::wstring IsSuiteInstalled(TPtr& aSuiteName, TPtr& aVendorName); |
|
83 // Reads the whole content of the Jad file and returns it in |
|
84 // buffer in UCS-2 character set. |
|
85 HBufC *GetJadContentL(const TDesC& aJadFileName); |
|
86 // Reads the whole content of the Manifest inside the Jar file |
|
87 // and returns it in buffer in UCS-2 character set. |
|
88 HBufC *GetManifestContentL(const TDesC& aJarFileName); |
|
89 // Finds the java attribute specified by aAttributeName |
|
90 // from aBuf and returns the value of that attribute |
|
91 // in HBufC. |
|
92 HBufC *ParseAttribute(const HBufC *aBuf, const TDesC& aAttributeName); |
|
93 |
|
94 private: |
|
95 RFs& iFs; |
|
96 TDriveNumber iDrive; |
|
97 RArray<TInt> iIsJad; |
|
98 RPointerArray<HBufC> iDirs; |
|
99 RPointerArray<HBufC> iInstallFiles; |
|
100 std::vector<std::wstring> iUninstallUids; |
|
101 // Buffer used for parsing midlet name from jad / Manifest |
|
102 HBufC* iMIDletName; |
|
103 // Buffer used for parsing midlet vendor from jad / Manifest |
|
104 HBufC* iMIDletVendor; |
|
105 TInt iFileIndex; |
|
106 TRestorationState iState; |
|
107 RestoreServer* iConvertServer; |
|
108 |
|
109 // contains the drive status info for each non-remote, non-substed drive |
|
110 // on device |
|
111 TUint iDriveStatuses[KMaxDrives]; |
|
112 TInt iNumberOfAppsToInstall; |
|
113 }; |
|
114 |
|
115 #endif // RESTORECONVERTMIDLET_H |
|