diff options
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java index d3ac455a56..6f5cdeeb5a 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java @@ -19,7 +19,11 @@ */ package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation; -import static org.openecomp.sdc.tosca.csar.CSARConstants.ETSI_VERSION_2_7_1; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.sdc.tosca.csar.AsdPackageHelper; +import org.openecomp.sdc.tosca.csar.ManifestUtils; +import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIService; +import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIServiceImpl; import java.io.IOException; import java.util.Comparator; @@ -27,16 +31,17 @@ import java.util.List; import java.util.ServiceLoader; import java.util.ServiceLoader.Provider; import java.util.stream.Collectors; -import org.openecomp.core.utilities.file.FileContentHandler; -import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIService; -import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIServiceImpl; + +import static org.openecomp.sdc.tosca.csar.CSARConstants.ETSI_VERSION_2_7_1; public class ValidatorFactory { private final ServiceLoader<Validator> validatorLoader; + private final AsdPackageHelper asdPackageHelper; public ValidatorFactory() { this.validatorLoader = ServiceLoader.load(Validator.class); + this.asdPackageHelper = new AsdPackageHelper(new ManifestUtils()); } /** @@ -47,9 +52,16 @@ public class ValidatorFactory { * @throws IOException when metafile is invalid */ public Validator getValidator(final FileContentHandler fileContentHandler) throws IOException { - final ETSIService etsiService = new ETSIServiceImpl(null); + final ETSIService etsiService = new ETSIServiceImpl(null, new ManifestUtils()); + if (asdPackageHelper.isAsdPackage(fileContentHandler)) { + return new AsdValidator(); + } if (!etsiService.hasEtsiSol261Metadata(fileContentHandler)) { - return etsiService.isEtsiPackage(fileContentHandler) ? new EtsiSol004Version251Validator() : new ONAPCsarValidator(); + if (etsiService.isEtsiPackage(fileContentHandler)) { + + return new EtsiSol004Version251Validator(); + } + return new ONAPCsarValidator(); } if (!etsiService.getHighestCompatibleSpecificationVersion(fileContentHandler).isLowerThan(ETSI_VERSION_2_7_1)) { if (etsiService.hasCnfEnhancements(fileContentHandler)) { |