ArtifactRepository tenant aware. (#539)
* ArtifactRepository tenant aware. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * No need to have this protected. Updated event to boot > 1.3 Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove conditional. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove Debug log. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Cleanup Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Missing validation and readability. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix test after change. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix computation is DosFilter Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix session state on RESTful APIs. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Performance improvement controllermanagement Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Added cross tenant test. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Typos. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -28,6 +28,14 @@
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
|
||||
@@ -10,8 +10,11 @@ package org.eclipse.hawkbit.artifact.repository;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* ArtifactRepository service interface.
|
||||
@@ -39,11 +42,14 @@ public interface ArtifactRepository {
|
||||
* @throws ArtifactStoreException
|
||||
* in case storing of the artifact was not successful
|
||||
*/
|
||||
DbArtifact store(final InputStream content, final String filename, final String contentType);
|
||||
DbArtifact store(@NotEmpty String tenant, @NotNull InputStream content, @NotEmpty String filename,
|
||||
String contentType);
|
||||
|
||||
/**
|
||||
* Stores an artifact into the repository.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant to store the artifact
|
||||
* @param content
|
||||
* the content to store
|
||||
* @param filename
|
||||
@@ -63,23 +69,27 @@ public interface ArtifactRepository {
|
||||
* in case {@code hash} is provided and not matching to the
|
||||
* calculated hashes during storing
|
||||
*/
|
||||
DbArtifact store(final InputStream content, final String filename, final String contentType, DbArtifactHash hash);
|
||||
DbArtifact store(@NotEmpty String tenant, @NotNull InputStream content, @NotEmpty String filename,
|
||||
String contentType, DbArtifactHash hash);
|
||||
|
||||
/**
|
||||
* Deletes an artifact by its SHA1 hash.
|
||||
*
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant to store the artifact
|
||||
* @param sha1Hash
|
||||
* the sha1-hash of the artifact to delete
|
||||
*
|
||||
* @throws MethodNotSupportedException
|
||||
* if implementation does not support the operation
|
||||
*/
|
||||
void deleteBySha1(final String sha1Hash);
|
||||
void deleteBySha1(@NotEmpty String tenant, @NotEmpty String sha1Hash);
|
||||
|
||||
/**
|
||||
* Retrieves a {@link DbArtifact} from the store by it's SHA1 hash.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant to store the artifact
|
||||
* @param sha1Hash
|
||||
* the sha1-hash of the file to lookup.
|
||||
* @return The artifact file object or {@code null} if no file exists.
|
||||
@@ -87,5 +97,13 @@ public interface ArtifactRepository {
|
||||
* @throws MethodNotSupportedException
|
||||
* if implementation does not support the operation
|
||||
*/
|
||||
DbArtifact getArtifactBySha1(String sha1Hash);
|
||||
DbArtifact getArtifactBySha1(@NotEmpty String tenant, @NotEmpty String sha1Hash);
|
||||
|
||||
/**
|
||||
* Deletes all artifacts of given tenant.
|
||||
*
|
||||
* @param tenant
|
||||
* to erase
|
||||
*/
|
||||
void deleteByTenant(@NotEmpty String tenant);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user