2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule;
19 import org.openecomp.core.utilities.file.FileContentHandler;
20 import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
21 import org.openecomp.sdc.datatypes.error.ErrorMessage;
22 import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
23 import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
24 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
25 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
26 import org.openecomp.sdc.vendorsoftwareproduct.types.CandidateDataEntityTo;
27 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.AnalyzedZipHeatFiles;
28 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
29 import org.openecomp.sdc.versioning.dao.types.Version;
31 import java.io.ByteArrayInputStream;
32 import java.io.IOException;
33 import java.io.InputStream;
34 import java.nio.ByteBuffer;
35 import java.util.List;
37 import java.util.Optional;
39 public interface CandidateService {
40 Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream heatFileToUpload,
43 Optional<ErrorMessage> validateRawZipData(String fileSuffix, byte[] uploadedFileData);
45 OrchestrationTemplateCandidateData createCandidateDataEntity(
46 CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest,
47 AnalyzedZipHeatFiles analyzedZipHeatFiles);
49 void updateCandidateUploadData(String vspId, Version version,
50 OrchestrationTemplateCandidateData uploadData);
52 Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(String vspId,
55 void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version version,
56 FilesDataStructure fileDataStructure);
58 Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidate(String vspId,
61 Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidateInfo(String vspId,
64 byte[] getZipData(ByteBuffer contentData) throws IOException;
66 void deleteOrchestrationTemplateCandidate(String vspId, Version version);
68 Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
69 OrchestrationTemplateCandidateData candidateDataEntity,
71 OnboardingTypesEnum type,
72 Map<String, List<ErrorMessage>> uploadErrors);
74 byte[] replaceManifestInZip(ByteBuffer contentData, String manifest,
75 OnboardingTypesEnum type) throws IOException;
77 Optional<ManifestContent> createManifest(VspDetails vspDetails,
78 FileContentHandler fileContentHandler,
79 AnalyzedZipHeatFiles analyzedZipHeatFiles);
81 String createManifest(VspDetails vspDetails, FilesDataStructure structure);
83 Optional<List<ErrorMessage>> validateFileDataStructure(FilesDataStructure filesDataStructure);
85 void updateValidationData(String vspId, Version version, ValidationStructureList validationData);