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.core.utilities.orchestration.OnboardingTypesEnum;
25 import org.openecomp.sdc.datatypes.error.ErrorMessage;
26 import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
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,
46 Optional<ErrorMessage> validateRawZipData(String fileSuffix, byte[] uploadedFileData);
48 OrchestrationTemplateCandidateData createCandidateDataEntity(
49 CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest,
50 AnalyzedZipHeatFiles analyzedZipHeatFiles) throws Exception;
52 void updateCandidateUploadData(String vspId, Version version,
53 OrchestrationTemplateCandidateData uploadData);
55 Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(String vspId,
58 void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version version,
59 FilesDataStructure fileDataStructure);
61 OrchestrationTemplateCandidateData getOrchestrationTemplateCandidate(String vspId,
64 OrchestrationTemplateCandidateData getOrchestrationTemplateCandidateInfo(String vspId,
67 Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
68 OrchestrationTemplateCandidateData candidateDataEntity,
70 OnboardingTypesEnum type,
71 Map<String, List<ErrorMessage>> uploadErrors);
73 byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId,
74 OnboardingTypesEnum type) throws IOException;
76 Optional<ManifestContent> createManifest(VspDetails vspDetails,
77 FileContentHandler fileContentHandler,
78 AnalyzedZipHeatFiles analyzedZipHeatFiles);
80 String createManifest(VspDetails vspDetails, FilesDataStructure structure);
82 Optional<List<ErrorMessage>> validateFileDataStructure(FilesDataStructure filesDataStructure);