• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package ohos;
17 
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 
22 /**
23  * collection of HapVerifyInfo members,
24  * those members will be verified in hapVerify.
25  */
26 class HapVerifyInfo {
27     /**
28      * Indicates the bundleName of module.
29      */
30     private String bundleName = "";
31 
32     private String bundleType = "app";
33 
34     /**
35      * Indicates the vendor of module.
36      */
37     private String vendor = "";
38 
39     /**
40      * Indicates the version of module.
41      */
42     private Version version = new Version();
43 
44     /**
45      * Indicates the apiVersion of module.
46      */
47     private ModuleApiVersion apiVersion = new ModuleApiVersion();
48 
49     /**
50      * Indicates the moduleName of module.
51      */
52     private String moduleName = "";
53 
54     /**
55      * Indicates the package name of module.
56      */
57     private String packageName = "";
58 
59     /**
60      * Indicates the ability names of module.
61      */
62     private List<String> abilityNames = new ArrayList<>();
63 
64     /**
65      * Indicates the distrofilter of module.
66      */
67     private DistroFilter distroFilter = new DistroFilter();
68 
69     /**
70      * Indicates the deviceType of module.
71      */
72     private List<String> deviceType = new ArrayList<>();
73 
74     /**
75      * Indicates is stage of module.
76      */
77     private boolean isStageModule = true;
78 
79     /**
80      * Indicates is type of module.
81      */
82     private String moduleType = "";
83 
84     /**
85      * Indicates atomic service type, contain main, normal.
86      */
87     private String atomicServiceType = "";
88 
89     /**
90      * Indicates is installationFree of module.
91      */
92     private boolean isInstallationFree = false;
93 
94     /**
95      * Indicates dependency of module.
96      */
97     private List<String> dependencies = new ArrayList<>();
98 
99     /**
100      * Indicates dependency of module.
101      */
102     private List<DependencyItem> dependencyItemList = new ArrayList<>();
103 
104     /**
105      * Indicates is config.json string or module.json string of module.
106      */
107     private String profileStr = "";
108 
109     /**
110      * Indicates is file in profile of module.
111      */
112     private HashMap<String, String> resourceMap = new HashMap<>();
113 
114     private List<PreloadItem> preloadItems = new ArrayList<>();
115 
116     private long fileLength = 0L;
117     private int entrySizeLimit = 2;
118 
119     private int notEntrySizeLimit = 2;
120 
121     private int sumSizeLimit = 10;
122 
123     /**
124      * get bundle name form HapVerifyInfo.
125      */
getBundleName()126     public String getBundleName() {
127         return bundleName;
128     }
129 
130     /**
131      * set bundle name for HapVerifyInfo.
132      */
setBundleName(String bundleName)133     public void setBundleName(String bundleName) {
134         this.bundleName = bundleName;
135     }
136 
137     /**
138      * get vendor form HapVerifyInfo.
139      */
getVendor()140     public String getVendor() {
141         return vendor;
142     }
143 
144     /**
145      * set vendor for HapVerifyInfo.
146      */
setVendor(String vendor)147     public void setVendor(String vendor) {
148         this.vendor = vendor;
149     }
150 
151     /**
152      * get version from HapVerifyInfo.
153      */
getVersion()154     public Version getVersion() {
155         return version;
156     }
157 
158     /**
159      * set version for HapVerifyInfo.
160      */
setVersion(Version version)161     public void setVersion(Version version) {
162         this.version = version;
163     }
164 
165     /**
166      * get apiVersion from HapVerifyInfo.
167      */
getApiVersion()168     public ModuleApiVersion getApiVersion() {
169         return apiVersion;
170     }
171 
172     /**
173      * set apiVersion for HapVerifyInfo.
174      */
setApiVersion(ModuleApiVersion apiVersion)175     public void setApiVersion(ModuleApiVersion apiVersion) {
176         this.apiVersion = apiVersion;
177     }
178 
179     /**
180      * get module name from HapVerifyInfo.
181      */
getModuleName()182     public String getModuleName() {
183         return moduleName;
184     }
185 
186     /**
187      * set module name for HapVerifyInfo.
188      */
setModuleName(String moduleName)189     public void setModuleName(String moduleName) {
190         this.moduleName = moduleName;
191     }
192 
193     /**
194      * get package name from HapVerifyInfo.
195      */
getPackageName()196     public String getPackageName() {
197         return packageName;
198     }
199 
200     /**
201      * set package name for HapVerifyInfo.
202      */
setPackageName(String packageName)203     public void setPackageName(String packageName) {
204         this.packageName = packageName;
205     }
206 
207     /**
208      * get ability names from HapVerifyInfo.
209      */
getAbilityNames()210     public List<String> getAbilityNames() {
211         return abilityNames;
212     }
213 
214     /**
215      * set abilityNames for HapVerifyInfo.
216      */
setAbilityNames(List<String> abilityNames)217     public void setAbilityNames(List<String> abilityNames) {
218         this.abilityNames = abilityNames;
219     }
220 
221     /**
222      * add abilityNames for HapVerifyInfo.
223      */
addAbilityNames(List<String> nameList)224     public void addAbilityNames(List<String> nameList) {
225         this.abilityNames.addAll(nameList);
226     }
227 
228     /**
229      * get distroFilter from HapVerifyInfo.
230      */
getDistroFilter()231     public DistroFilter getDistroFilter() {
232         return distroFilter;
233     }
234 
235     /**
236      * set distroFilter for HapVerifyInfo.
237      */
setDistroFilter(DistroFilter distroFilter)238     public void setDistroFilter(DistroFilter distroFilter) {
239         this.distroFilter = distroFilter;
240     }
241 
242     /**
243      * get deviceType from HapVerifyInfo.
244      */
getDeviceType()245     public List<String> getDeviceType() {
246         return deviceType;
247     }
248 
249     /**
250      * set deviceType for HapVerifyInfo.
251      */
setDeviceType(List<String> deviceType)252     public void setDeviceType(List<String> deviceType) {
253         this.deviceType = deviceType;
254     }
255 
256     /**
257      * get isStageModule from HapVerifyInfo.
258      */
isStageModule()259     public boolean isStageModule() {
260         return isStageModule;
261     }
262 
263     /**
264      * set isStageModule for HapVerifyInfo.
265      */
setStageModule(boolean isStageModule)266     public void setStageModule(boolean isStageModule) {
267         this.isStageModule = isStageModule;
268     }
269 
270     /**
271      * get moduleType from HapVerifyInfo.
272      */
getModuleType()273     public String getModuleType() {
274         return moduleType;
275     }
276 
277     /**
278      * set is module for HapVerifyInfo.
279      */
setModuleType(String moduleType)280     public void setModuleType(String moduleType) {
281         this.moduleType = moduleType;
282     }
283 
284     /**
285      * get isInstallationFree form HapVerifyInfo.
286      */
isInstallationFree()287     public boolean isInstallationFree() {
288         return isInstallationFree;
289     }
290 
291     /**
292      * set isInstallationFree for HapVerifyInfo.
293      */
setInstallationFree(boolean isInstallationFree)294     public void setInstallationFree(boolean isInstallationFree) {
295         this.isInstallationFree = isInstallationFree;
296     }
297 
298     /**
299      * get dependency form HapVerifyInfo.
300      */
getDependencies()301     public List<String> getDependencies() {
302         return dependencies;
303     }
304 
305     /**
306      * set dependency for HapVerifyInfo.
307      */
setDependencies(List<String> dependencies)308     public void setDependencies(List<String> dependencies) {
309         this.dependencies = dependencies;
310     }
311 
312     /**
313      * get dependency item list for HapVerifyInfo.
314      */
getDependencyItemList()315     public List<DependencyItem> getDependencyItemList() {
316         return dependencyItemList;
317     }
318 
319     /**
320      * set dependency item list for HapVerifyInfo.
321      */
setDependencyItemList(List<DependencyItem> dependencyItemList)322     public void setDependencyItemList(List<DependencyItem> dependencyItemList) {
323         this.dependencyItemList = dependencyItemList;
324         convertToDependency();
325     }
326 
327     /**
328      * get json file string form HapVerifyInfo.
329      */
getProfileStr()330     public String getProfileStr() {
331         return profileStr;
332     }
333 
334     /**
335      * set json file string for HapVerifyInfo.
336      */
setProfileStr(String profileStr)337     public void setProfileStr(String profileStr) {
338         this.profileStr = profileStr;
339     }
340 
341     /**
342      * get resource map form HapVerifyInfo.
343      */
getResourceMap()344     public HashMap<String, String> getResourceMap() {
345         return resourceMap;
346     }
347 
348     /**
349      * set resource map for HapVerifyInfo.
350      */
setResourceMap(HashMap<String, String> resourceMap)351     public void setResourceMap(HashMap<String, String> resourceMap) {
352         this.resourceMap = resourceMap;
353     }
354 
convertToDependency()355     private void convertToDependency() {
356         for (DependencyItem item : dependencyItemList) {
357             if (item.getBundleName() != null && item.getBundleName().equals(bundleName)) {
358                 dependencies.add(item.getModuleName());
359             }
360         }
361     }
362 
getBundleType()363     public String getBundleType() {
364         return bundleType;
365     }
366 
setBundleType(String bundleType)367     public void setBundleType(String bundleType) {
368         this.bundleType = bundleType;
369     }
370 
getAtomicServiceType()371     public String getAtomicServiceType() {
372         return atomicServiceType;
373     }
374 
setAtomicServiceType(String atomicServiceType)375     public void setAtomicServiceType(String atomicServiceType) {
376         this.atomicServiceType = atomicServiceType;
377     }
378 
getPreloadItems()379     public List<PreloadItem> getPreloadItems() {
380         return preloadItems;
381     }
382 
setPreloadItems(List<PreloadItem> preloadItems)383     public void setPreloadItems(List<PreloadItem> preloadItems) {
384         this.preloadItems = preloadItems;
385     }
386 
getFileLength()387     public long getFileLength() {
388         return fileLength;
389     }
390 
setFileLength(long fileLength)391     public void setFileLength(long fileLength) {
392         this.fileLength = fileLength;
393     }
394 
setEntrySizeLimit(int limit)395     public void setEntrySizeLimit(int limit) {
396         this.entrySizeLimit = limit;
397     }
398 
getEntrySizeLimit()399     public int getEntrySizeLimit() {
400         return entrySizeLimit;
401     }
402 
setNotEntrySizeLimit(int notEntrySizeLimit)403     public void setNotEntrySizeLimit(int notEntrySizeLimit) {
404         this.notEntrySizeLimit = notEntrySizeLimit;
405     }
406 
getNotEntrySizeLimit()407     public int getNotEntrySizeLimit() {
408         return notEntrySizeLimit;
409     }
410 
setSumSizeLimit(int sumSizeLimit)411     public void setSumSizeLimit(int sumSizeLimit) {
412         this.sumSizeLimit = sumSizeLimit;
413     }
414 
getSumSizeLimit()415     public int getSumSizeLimit() {
416         return sumSizeLimit;
417     }
418 }
419