/
ArtifactUpload.java
136 lines (112 loc) · 3.75 KB
/
ArtifactUpload.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.repository.model;
import java.io.InputStream;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.eclipse.hawkbit.repository.ValidString;
/**
* Use to create a new artifact.
*
*/
public class ArtifactUpload {
@NotNull
private final InputStream inputStream;
private final long moduleId;
@NotEmpty
@ValidString
private final String filename;
private final String providedMd5Sum;
private final String providedSha1Sum;
private final String providedSha256Sum;
private final boolean overrideExisting;
private final String contentType;
private final long filesize;
/**
* Constructor
*
* @param inputStream
* to read from for artifact binary
* @param moduleId
* to assign the new artifact to
* @param filename
* of the artifact
* @param overrideExisting
* to <code>true</code> if the artifact binary can be overridden
* if it already exists
* @param filesize
* the size of the file in bytes.
*/
public ArtifactUpload(final InputStream inputStream, final long moduleId, final String filename,
final boolean overrideExisting, final long filesize) {
this(inputStream, moduleId, filename, null, null, null, overrideExisting, null, filesize);
}
/**
* Constructor
*
* @param inputStream
* to read from for artifact binary
* @param moduleId
* to assign the new artifact to
* @param filename
* of the artifact
* @param providedSha1Sum
* optional sha1 checksum to check the new file against
* @param providedMd5Sum
* optional md5 checksum to check the new file against
* @param overrideExisting
* to <code>true</code> if the artifact binary can be overridden
* if it already exists
* @param contentType
* the contentType of the file
* @param filesize
* the size of the file in bytes.
*/
public ArtifactUpload(final InputStream inputStream, final long moduleId, final String filename,
final String providedMd5Sum, final String providedSha1Sum, final String providedSha256Sum,
final boolean overrideExisting, final String contentType, final long filesize) {
this.inputStream = inputStream;
this.moduleId = moduleId;
this.filename = filename;
this.providedMd5Sum = providedMd5Sum;
this.providedSha1Sum = providedSha1Sum;
this.providedSha256Sum = providedSha256Sum;
this.overrideExisting = overrideExisting;
this.contentType = contentType;
this.filesize = filesize;
}
public InputStream getInputStream() {
return inputStream;
}
public long getModuleId() {
return moduleId;
}
public String getFilename() {
return filename;
}
public String getProvidedMd5Sum() {
return providedMd5Sum;
}
public String getProvidedSha1Sum() {
return providedSha1Sum;
}
public String getProvidedSha256Sum() {
return providedSha256Sum;
}
public boolean overrideExisting() {
return overrideExisting;
}
public String getContentType() {
return contentType;
}
public long getFilesize() {
return filesize;
}
}