|
1 /* |
|
2 * Copyright (c) 2005-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: javaregistrypackageentry implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <javaregistrypackageentry.h> |
|
20 #include <javaregistryapplicationentry.h> |
|
21 #include <appversion.h> |
|
22 |
|
23 #include "writeablejavaregistrypackageentry.h" |
|
24 #include "logger.h" |
|
25 |
|
26 using namespace Java; |
|
27 using namespace Java::Manager::Registry; |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS ============================== |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // CJavaRegistryPackageEntry::CJavaRegistryPackageEntry |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CJavaRegistryPackageEntry::CJavaRegistryPackageEntry |
|
36 (CWriteableJavaRegistryPackageEntry* aWritableEntry) : |
|
37 CJavaRegistryEntry(aWritableEntry) |
|
38 { |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CJavaRegistryPackageEntry::Version |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C TAppVersion CJavaRegistryPackageEntry::Version() const |
|
46 { |
|
47 JELOG2(EJavaStorage); |
|
48 return WritableEntry()->Version(); |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CJavaRegistryPackageEntry::Vendor |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 EXPORT_C const TDesC& CJavaRegistryPackageEntry::Vendor() const |
|
56 { |
|
57 JELOG2(EJavaStorage); |
|
58 return WritableEntry()->Vendor(); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CJavaRegistryPackageEntry::IsUninstallable |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C TBool CJavaRegistryPackageEntry::IsUninstallable() const |
|
66 { |
|
67 JELOG2(EJavaStorage); |
|
68 return WritableEntry()->IsUninstallable(); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CJavaRegistryPackageEntry::GetEmbeddedEntries |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 EXPORT_C void CJavaRegistryPackageEntry::GetEmbeddedEntries |
|
76 (RArray<TUid>& aUids) const |
|
77 { |
|
78 JELOG2(EJavaStorage); |
|
79 WritableEntry()->GetEmbeddedEntries(aUids); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CJavaRegistryPackageEntry::NumberOfEmbeddedEntries |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 EXPORT_C TInt CJavaRegistryPackageEntry::NumberOfEmbeddedEntries() const |
|
87 { |
|
88 JELOG2(EJavaStorage); |
|
89 return WritableEntry()->NumberOfEmbeddedEntries(); |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CJavaRegistryPackageEntry::EmbeddedEntryByUidL |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 EXPORT_C CJavaRegistryEntry* CJavaRegistryPackageEntry:: |
|
97 EmbeddedEntryByUidL(const TUid& aEntryUid) const |
|
98 { |
|
99 JELOG2(EJavaStorage); |
|
100 |
|
101 CWriteableJavaRegistryEntry* writeableEntry |
|
102 = WritableEntry()->EmbeddedEntryByUidL(aEntryUid); |
|
103 |
|
104 if (writeableEntry == NULL) |
|
105 { |
|
106 WLOG(EJavaStorage, |
|
107 "Can't find entry for the given uid, returning NULL."); |
|
108 return NULL; |
|
109 } |
|
110 CleanupStack::PushL(writeableEntry); |
|
111 |
|
112 CJavaRegistryEntry* entry = NULL; |
|
113 |
|
114 TJavaRegistryEntryType entryType= writeableEntry->Type(); |
|
115 |
|
116 if (EGeneralPackage <= entryType && |
|
117 entryType < EGeneralApplication) |
|
118 { |
|
119 entry |
|
120 = new(ELeave) CJavaRegistryPackageEntry( |
|
121 (CWriteableJavaRegistryPackageEntry*) writeableEntry); |
|
122 LOG(EJavaStorage, EInfo, "PackageEntry created"); |
|
123 } |
|
124 else if (EGeneralApplication <= entryType) |
|
125 { |
|
126 entry |
|
127 = new(ELeave) CJavaRegistryApplicationEntry |
|
128 ((CWriteableJavaRegistryApplicationEntry*) writeableEntry); |
|
129 LOG(EJavaStorage, EInfo, "ApplicationEntry created"); |
|
130 } |
|
131 else |
|
132 { |
|
133 ELOG(EJavaStorage, "Invalid type, returning NULL"); |
|
134 CleanupStack::PopAndDestroy(writeableEntry); |
|
135 return NULL; |
|
136 } |
|
137 |
|
138 CleanupStack::Pop(writeableEntry); |
|
139 return entry; |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------------------------- |
|
143 // CJavaRegistryPackageEntry::EmbeddedEntryByNumberL |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 EXPORT_C CJavaRegistryEntry* CJavaRegistryPackageEntry:: |
|
147 EmbeddedEntryByNumberL(TInt aEntryNum) const |
|
148 { |
|
149 JELOG2(EJavaStorage); |
|
150 CWriteableJavaRegistryEntry* writeableEntry |
|
151 = WritableEntry()->EmbeddedEntryByNumberL(aEntryNum); |
|
152 if (writeableEntry == NULL) |
|
153 { |
|
154 WLOG1(EJavaStorage, |
|
155 "Can't find entry for the given Entry-number: %d", |
|
156 aEntryNum); |
|
157 return NULL; |
|
158 } |
|
159 |
|
160 CleanupStack::PushL(writeableEntry); |
|
161 CJavaRegistryEntry* entry = NULL; |
|
162 TJavaRegistryEntryType entryType= writeableEntry->Type(); |
|
163 |
|
164 if (EGeneralPackage <= entryType && |
|
165 entryType < EGeneralApplication) |
|
166 { |
|
167 entry |
|
168 = new(ELeave) CJavaRegistryPackageEntry( |
|
169 (CWriteableJavaRegistryPackageEntry*) writeableEntry); |
|
170 LOG(EJavaStorage, EInfo, "PackageEntry created"); |
|
171 } |
|
172 else if (EGeneralApplication <= entryType) |
|
173 { |
|
174 entry |
|
175 = new(ELeave) CJavaRegistryApplicationEntry |
|
176 ((CWriteableJavaRegistryApplicationEntry*) writeableEntry); |
|
177 LOG(EJavaStorage, EInfo, "ApplicationEntry created"); |
|
178 } |
|
179 else |
|
180 { |
|
181 ELOG(EJavaStorage, "Invalid type, returning NULL"); |
|
182 CleanupStack::PopAndDestroy(writeableEntry); |
|
183 return NULL; |
|
184 } |
|
185 |
|
186 CleanupStack::Pop(writeableEntry); |
|
187 |
|
188 return entry; |
|
189 } |
|
190 |
|
191 // --------------------------------------------------------------------------- |
|
192 // CJavaRegistryPackageEntry::UsedUserDiskSpace |
|
193 // --------------------------------------------------------------------------- |
|
194 EXPORT_C TInt64 CJavaRegistryPackageEntry::UsedUserDiskSpace() const |
|
195 { |
|
196 return WritableEntry()->UsedUserDiskSpace(); |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // CJavaRegistryPackageEntry::UsedUserDiskSpace |
|
201 // --------------------------------------------------------------------------- |
|
202 EXPORT_C TBool CJavaRegistryPackageEntry::IsPreinstalled() const |
|
203 { |
|
204 return WritableEntry()->IsPreinstalled(); |
|
205 } |
|
206 |
|
207 // --------------------------------------------------------------------------- |
|
208 // CJavaRegistryPackageEntry::WritableEntry |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 CWriteableJavaRegistryPackageEntry* CJavaRegistryPackageEntry:: |
|
212 WritableEntry() const |
|
213 { |
|
214 return (CWriteableJavaRegistryPackageEntry*)iWritableEntry; |
|
215 } |