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