Large csar handling - object store
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / be / csar / storage / ArtifactStorageManager.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2021 Nordix Foundation
4  *  ================================================================================
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.csar.storage;
22
23 import java.io.InputStream;
24
25 /**
26  * Manages the artifact storage and handles operations on the artifacts
27  */
28 public interface ArtifactStorageManager {
29
30     /**
31      * Persists the uploaded artifact in the storage.
32      *
33      * @param vspId                the VSP id
34      * @param versionId            the VSP version id
35      * @param uploadedArtifactInfo the uploaded
36      * @return the information about the persisted artifact
37      */
38     ArtifactInfo persist(String vspId, String versionId, ArtifactInfo uploadedArtifactInfo);
39
40     /**
41      * Uploads a file to the Artifact Storage. This file will be temporary until persisted by {@link #persist(String, String, ArtifactInfo)}.
42      *
43      * @param vspId        the VSP id
44      * @param versionId    the VSP version id
45      * @param fileToUpload the file input stream
46      * @return the information about the uploaded artifact
47      */
48     ArtifactInfo upload(String vspId, String versionId, InputStream fileToUpload);
49
50     /**
51      * Checks if the Artifact Storage is enabled.
52      *
53      * @return {@code true} if enable, {@code false} otherwise
54      */
55     default boolean isEnabled() {
56         return false;
57     }
58
59     /**
60      * @return Storage Configuration
61      */
62     ArtifactStorageConfig getStorageConfiguration();
63
64     InputStream get(final ArtifactInfo artifactInfo);
65
66     void delete(ArtifactInfo artifactInfo);
67 }