From 96908856dea9061161b2c324aa7b0eeb5d6e4fd5 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Thu, 29 Aug 2019 16:31:53 +0000 Subject: Fix artifacts references in main TOSCA descriptor During package conversion, artifacts can have their path changed. References for those artifacts inside the main TOSCA descriptor must be updated accordingly. Change-Id: Idcffb0724c20875ff1decebfec7c47605bfe20dc Issue-ID: SDC-2540 Signed-off-by: andre.schmid --- .../services/impl/etsi/ETSIService.java | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api') diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java index a6b58167f9..0a271c9d87 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java @@ -20,10 +20,14 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi; +import java.io.IOException; +import java.nio.file.Path; +import java.util.Map; +import java.util.Optional; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.tosca.csar.Manifest; -import java.io.IOException; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; public interface ETSIService { @@ -38,11 +42,22 @@ public interface ETSIService { boolean isSol004WithToscaMetaDirectory(FileContentHandler handler) throws IOException; /** - * Update file structure. Moves non mano files to Artifacts/Deployment/non mano key location - * @param handler - * @param manifest + * Update file structure. Moves non mano files to the correct folder based on the manifest non mano type. + * + * @param handler The file handler containing the artifacts to move. + * @return A Map with pairs of from and to path of the moved artifacts. + */ + Optional> moveNonManoFileToArtifactFolder(final FileContentHandler handler) + throws IOException; + + /** + * Updates the main descriptor paths referring the artifacts that were moved. + * + * @param toscaServiceModel The tosca service model containing the main descriptor. + * @param fromToMovedArtifactMap A Map representing the from and to artifacts path changes. */ - void moveNonManoFileToArtifactFolder(FileContentHandler handler, Manifest manifest); + void updateMainDescriptorPaths(final ToscaServiceModel toscaServiceModel, + final Map fromToMovedArtifactMap); /** * Retrieves the manifest file from the CSAR @@ -64,4 +79,6 @@ public interface ETSIService { * @throws IOException when TOSCA.meta file or manifest file is invalid */ ResourceTypeEnum getResourceType(Manifest manifest) throws IOException; + + Path getOriginalManifestPath(final FileContentHandler handler) throws IOException; } -- cgit 1.2.3-korg