• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 import java.util.Map;
22 
23 /**
24  * collection of HapVerifyInfo members,
25  * those members will be verified in hapVerify.
26  */
27 class HapVerifyInfo {
28     /**
29      * Indicates the bundleName of module.
30      */
31     private String bundleName = "";
32 
33     /**
34      * Indicates the vendor of module.
35      */
36     private String vendor = "";
37 
38     /**
39      * Indicates the version of module.
40      */
41     private Version version = new Version();
42 
43     /**
44      * Indicates the apiVersion of module.
45      */
46     private ModuleApiVersion apiVersion = new ModuleApiVersion();
47 
48     /**
49      * Indicates the moduleName of module.
50      */
51     private String moduleName = "";
52 
53     /**
54      * Indicates the package name of module.
55      */
56     private String packageName = "";
57 
58     /**
59      * Indicates the ability names of module.
60      */
61     private List<String> abilityNames = new ArrayList<>();
62 
63     /**
64      * Indicates the distrofilter of module.
65      */
66     private DistroFilter distroFilter = new DistroFilter();
67 
68     /**
69      * Indicates the deviceType of module.
70      */
71     private List<String> deviceType = new ArrayList<>();
72 
73     /**
74      * Indicates is stage of module.
75      */
76     private boolean isStageModule = true;
77 
78     /**
79      * Indicates is type of module.
80      */
81     private String moduleType = "";
82 
83     /**
84      * Indicates atomic service type, contain main, normal.
85      */
86     private String atomicServiceType = "";
87 
88     /**
89      * Indicates is installationFree of module.
90      */
91     private boolean isInstallationFree = false;
92 
93     /**
94      * Indicates dependency of module.
95      */
96     private List<String> dependencies = new ArrayList<>();
97 
98     /**
99      * Indicates dependency of module.
100      */
101     private List<DependencyItem> dependencyItemList = new ArrayList<>();
102 
103     /**
104      * Indicates is config.json string or module.json string of module.
105      */
106     private String profileStr = "";
107 
108     /**
109      * Indicates is file in profile of module.
110      */
111     private HashMap<String, String> resourceMap = new HashMap<>();
112 
113     private String bundleType = "app";
114 
115     private String targetBundleName = "";
116 
117     private int targetPriority = 0;
118 
119     private String targetModuleName = "";
120 
121     private int targetModulePriority = 0;
122 
123     private List<PreloadItem> preloadItems = new ArrayList<>();
124 
125     private long fileLength = 0L;
126     private int entrySizeLimit = 2;
127 
128     private int notEntrySizeLimit = 2;
129 
130     private int sumSizeLimit = 10;
131 
132     private boolean debug = false;
133 
134     private String compileSdkVersion = "";
135 
136     private String compileSdkType = "";
137 
138     private List<String> proxyDataUris = new ArrayList<>();
139 
140     private Map<String, List<String>> continueTypeMap = new HashMap<>();
141 
142     private MultiAppMode multiAppMode = new MultiAppMode();
143 
144     /**
145      * get bundle name form HapVerifyInfo.
146      */
getBundleName()147     public String getBundleName() {
148         return bundleName;
149     }
150 
151     /**
152      * set bundle name for HapVerifyInfo.
153      */
setBundleName(String bundleName)154     public void setBundleName(String bundleName) {
155         this.bundleName = bundleName;
156     }
157 
158     /**
159      * get vendor form HapVerifyInfo.
160      */
getVendor()161     public String getVendor() {
162         return vendor;
163     }
164 
165     /**
166      * set vendor for HapVerifyInfo.
167      */
setVendor(String vendor)168     public void setVendor(String vendor) {
169         this.vendor = vendor;
170     }
171 
172     /**
173      * get version from HapVerifyInfo.
174      */
getVersion()175     public Version getVersion() {
176         return version;
177     }
178 
179     /**
180      * set version for HapVerifyInfo.
181      */
setVersion(Version version)182     public void setVersion(Version version) {
183         this.version = version;
184     }
185 
186     /**
187      * get apiVersion from HapVerifyInfo.
188      */
getApiVersion()189     public ModuleApiVersion getApiVersion() {
190         return apiVersion;
191     }
192 
193     /**
194      * set apiVersion for HapVerifyInfo.
195      */
setApiVersion(ModuleApiVersion apiVersion)196     public void setApiVersion(ModuleApiVersion apiVersion) {
197         this.apiVersion = apiVersion;
198     }
199 
200     /**
201      * get module name from HapVerifyInfo.
202      */
getModuleName()203     public String getModuleName() {
204         return moduleName;
205     }
206 
207     /**
208      * set module name for HapVerifyInfo.
209      */
setModuleName(String moduleName)210     public void setModuleName(String moduleName) {
211         this.moduleName = moduleName;
212     }
213 
214     /**
215      * get package name from HapVerifyInfo.
216      */
getPackageName()217     public String getPackageName() {
218         return packageName;
219     }
220 
221     /**
222      * set package name for HapVerifyInfo.
223      */
setPackageName(String packageName)224     public void setPackageName(String packageName) {
225         this.packageName = packageName;
226     }
227 
228     /**
229      * get ability names from HapVerifyInfo.
230      */
getAbilityNames()231     public List<String> getAbilityNames() {
232         return abilityNames;
233     }
234 
235     /**
236      * set abilityNames for HapVerifyInfo.
237      */
setAbilityNames(List<String> abilityNames)238     public void setAbilityNames(List<String> abilityNames) {
239         this.abilityNames = abilityNames;
240     }
241 
242     /**
243      * add abilityNames for HapVerifyInfo.
244      */
addAbilityNames(List<String> nameList)245     public void addAbilityNames(List<String> nameList) {
246         this.abilityNames.addAll(nameList);
247     }
248 
249     /**
250      * get distroFilter from HapVerifyInfo.
251      */
getDistroFilter()252     public DistroFilter getDistroFilter() {
253         return distroFilter;
254     }
255 
256     /**
257      * set distroFilter for HapVerifyInfo.
258      */
setDistroFilter(DistroFilter distroFilter)259     public void setDistroFilter(DistroFilter distroFilter) {
260         this.distroFilter = distroFilter;
261     }
262 
263     /**
264      * get deviceType from HapVerifyInfo.
265      */
getDeviceType()266     public List<String> getDeviceType() {
267         return deviceType;
268     }
269 
270     /**
271      * set deviceType for HapVerifyInfo.
272      */
setDeviceType(List<String> deviceType)273     public void setDeviceType(List<String> deviceType) {
274         this.deviceType = deviceType;
275     }
276 
277     /**
278      * get isStageModule from HapVerifyInfo.
279      */
isStageModule()280     public boolean isStageModule() {
281         return isStageModule;
282     }
283 
284     /**
285      * set isStageModule for HapVerifyInfo.
286      */
setStageModule(boolean isStageModule)287     public void setStageModule(boolean isStageModule) {
288         this.isStageModule = isStageModule;
289     }
290 
291     /**
292      * get moduleType from HapVerifyInfo.
293      */
getModuleType()294     public String getModuleType() {
295         return moduleType;
296     }
297 
298     /**
299      * set is module for HapVerifyInfo.
300      */
setModuleType(String moduleType)301     public void setModuleType(String moduleType) {
302         this.moduleType = moduleType;
303     }
304 
305     /**
306      * get isInstallationFree form HapVerifyInfo.
307      */
isInstallationFree()308     public boolean isInstallationFree() {
309         return isInstallationFree;
310     }
311 
312     /**
313      * set isInstallationFree for HapVerifyInfo.
314      */
setInstallationFree(boolean isInstallationFree)315     public void setInstallationFree(boolean isInstallationFree) {
316         this.isInstallationFree = isInstallationFree;
317     }
318 
319     /**
320      * get dependency form HapVerifyInfo.
321      */
getDependencies()322     public List<String> getDependencies() {
323         return dependencies;
324     }
325 
326     /**
327      * set dependency for HapVerifyInfo.
328      */
setDependencies(List<String> dependencies)329     public void setDependencies(List<String> dependencies) {
330         this.dependencies = dependencies;
331     }
332 
333     /**
334      * get dependency item list for HapVerifyInfo.
335      */
getDependencyItemList()336     public List<DependencyItem> getDependencyItemList() {
337         return dependencyItemList;
338     }
339 
340     /**
341      * set dependency item list for HapVerifyInfo.
342      */
setDependencyItemList(List<DependencyItem> dependencyItemList)343     public void setDependencyItemList(List<DependencyItem> dependencyItemList) {
344         this.dependencyItemList = dependencyItemList;
345         convertToDependency();
346     }
347 
348     /**
349      * get json file string form HapVerifyInfo.
350      */
getProfileStr()351     public String getProfileStr() {
352         return profileStr;
353     }
354 
355     /**
356      * set json file string for HapVerifyInfo.
357      */
setProfileStr(String profileStr)358     public void setProfileStr(String profileStr) {
359         this.profileStr = profileStr;
360     }
361 
362     /**
363      * get resource map form HapVerifyInfo.
364      */
getResourceMap()365     public HashMap<String, String> getResourceMap() {
366         return resourceMap;
367     }
368 
369     /**
370      * set resource map for HapVerifyInfo.
371      */
setResourceMap(HashMap<String, String> resourceMap)372     public void setResourceMap(HashMap<String, String> resourceMap) {
373         this.resourceMap = resourceMap;
374     }
375 
convertToDependency()376     private void convertToDependency() {
377         for (DependencyItem item : dependencyItemList) {
378             if (item.getBundleName() != null && item.getBundleName().equals(bundleName)) {
379                 dependencies.add(item.getModuleName());
380             }
381         }
382     }
383 
getBundleType()384     public String getBundleType() {
385         return bundleType;
386     }
387 
setBundleType(String bundleType)388     public void setBundleType(String bundleType) {
389         this.bundleType = bundleType;
390     }
391 
getAtomicServiceType()392     public String getAtomicServiceType() {
393         return atomicServiceType;
394     }
395 
setAtomicServiceType(String atomicServiceType)396     public void setAtomicServiceType(String atomicServiceType) {
397         this.atomicServiceType = atomicServiceType;
398     }
399 
getPreloadItems()400     public List<PreloadItem> getPreloadItems() {
401         return preloadItems;
402     }
403 
setPreloadItems(List<PreloadItem> preloadItems)404     public void setPreloadItems(List<PreloadItem> preloadItems) {
405         this.preloadItems = preloadItems;
406     }
407 
getTargetBundleName()408     public String getTargetBundleName() {
409         return targetBundleName;
410     }
411 
setTargetBundleName(String targetBundleName)412     public void setTargetBundleName(String targetBundleName) {
413         this.targetBundleName = targetBundleName;
414     }
415 
getTargetPriority()416     public int getTargetPriority() {
417         return targetPriority;
418     }
419 
setTargetPriority(int priority)420     public void setTargetPriority(int priority) {
421         this.targetPriority = priority;
422     }
423 
getTargetModuleName()424     public String getTargetModuleName() {
425         return targetModuleName;
426     }
427 
setTargetModuleName(String targetModuleName)428     public void setTargetModuleName(String targetModuleName) {
429         this.targetModuleName = targetModuleName;
430     }
431 
getTargetModulePriority()432     public int getTargetModulePriority() {
433         return targetModulePriority;
434     }
435 
setTargetModulePriority(int priority)436     public void setTargetModulePriority(int priority) {
437         this.targetModulePriority = priority;
438     }
439 
getFileLength()440     public long getFileLength() {
441         return fileLength;
442     }
443 
setFileLength(long fileLength)444     public void setFileLength(long fileLength) {
445         this.fileLength = fileLength;
446     }
447 
setEntrySizeLimit(int limit)448     public void setEntrySizeLimit(int limit) {
449         this.entrySizeLimit = limit;
450     }
451 
getEntrySizeLimit()452     public int getEntrySizeLimit() {
453         return entrySizeLimit;
454     }
455 
setNotEntrySizeLimit(int notEntrySizeLimit)456     public void setNotEntrySizeLimit(int notEntrySizeLimit) {
457         this.notEntrySizeLimit = notEntrySizeLimit;
458     }
459 
getNotEntrySizeLimit()460     public int getNotEntrySizeLimit() {
461         return notEntrySizeLimit;
462     }
463 
setSumSizeLimit(int sumSizeLimit)464     public void setSumSizeLimit(int sumSizeLimit) {
465         this.sumSizeLimit = sumSizeLimit;
466     }
467 
getSumSizeLimit()468     public int getSumSizeLimit() {
469         return sumSizeLimit;
470     }
471 
isDebug()472     public boolean isDebug() {
473         return debug;
474     }
475 
setDebug(boolean debug)476     public void setDebug(boolean debug) {
477         this.debug = debug;
478     }
479 
getCompileSdkVersion()480     public String getCompileSdkVersion() {
481         return compileSdkVersion;
482     }
483 
setCompileSdkVersion(String compileSdkVersion)484     public void setCompileSdkVersion(String compileSdkVersion) {
485         this.compileSdkVersion = compileSdkVersion;
486     }
487 
getCompileSdkType()488     public String getCompileSdkType() {
489         return compileSdkType;
490     }
491 
setCompileSdkType(String compileSdkType)492     public void setCompileSdkType(String compileSdkType) {
493         this.compileSdkType = compileSdkType;
494     }
495 
getProxyDataUris()496     public List<String> getProxyDataUris() {
497         return proxyDataUris;
498     }
499 
setProxyDataUris(List<String> proxyDataUris)500     public void setProxyDataUris(List<String> proxyDataUris) {
501         this.proxyDataUris = proxyDataUris;
502     }
503 
504     /**
505      * get continueType map for HapVerifyInfo.
506      */
getContinueTypeMap()507     public Map<String, List<String>> getContinueTypeMap() {
508         return continueTypeMap;
509     }
510 
511     /**
512      * set continueType map for HapVerifyInfo.
513      */
setContinueTypeMap(Map<String, List<String>> continueTypeMap)514     public void setContinueTypeMap(Map<String, List<String>> continueTypeMap) {
515         this.continueTypeMap = continueTypeMap;
516     }
517 
getMultiAppMode()518     public MultiAppMode getMultiAppMode() {
519         return multiAppMode;
520     }
521 
setMultiAppMode(MultiAppMode multiAppMode)522     public void setMultiAppMode(MultiAppMode multiAppMode) {
523         this.multiAppMode = multiAppMode;
524     }
525 }
526