2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule;
23 import org.openecomp.core.utilities.file.FileContentHandler;
24 import org.openecomp.sdc.datatypes.error.ErrorMessage;
25 import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
26 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
27 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
28 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
29 import org.openecomp.sdc.vendorsoftwareproduct.types.CandidateDataEntityTo;
30 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.AnalyzedZipHeatFiles;
31 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
32 import org.openecomp.sdc.versioning.dao.types.Version;
34 import java.io.ByteArrayInputStream;
35 import java.io.IOException;
36 import java.io.InputStream;
37 import java.nio.ByteBuffer;
38 import java.util.List;
40 import java.util.Optional;
42 public interface CandidateService {
43 Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream heatFileToUpload);
45 Optional<ErrorMessage> validateRawZipData(byte[] uploadedFileData);
47 OrchestrationTemplateCandidateData createCandidateDataEntity(
48 CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest, AnalyzedZipHeatFiles analyzedZipHeatFiles) throws Exception;
50 void updateCandidateUploadData(OrchestrationTemplateCandidateData uploadData, String
53 Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(String vspId,
54 Version activeVersion);
56 void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version activeVersion,
57 FilesDataStructure fileDataStructure);
59 OrchestrationTemplateCandidateData getOrchestrationTemplateCandidate(String vspId,
60 Version activeVersion);
62 Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
63 OrchestrationTemplateCandidateData candidateDataEntity,
64 String manifest, Map<String, List<ErrorMessage>> uploadErrors);
66 byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId)
69 Optional<ManifestContent> createManifest(VspDetails vspDetails,
70 FileContentHandler fileContentHandler, AnalyzedZipHeatFiles analyzedZipHeatFiles);
72 String createManifest(VspDetails vspDetails, FilesDataStructure structure);
74 Optional<List<ErrorMessage>> validateFileDataStructure(FilesDataStructure filesDataStructure);