Package org.eclipse.hawkbit.artifact
Interface ArtifactStorage
- All Known Implementing Classes:
AbstractArtifactStorage
public interface ArtifactStorage
Artifact Store service interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteBySha1(@NotEmpty String tenant, @NotEmpty String sha1Hash) Deletes an artifact by its SHA1 hash.voiddeleteByTenant(@NotEmpty String tenant) Deletes all artifacts of given tenant.booleanexistsBySha1(@NotEmpty String tenant, @NotEmpty String sha1Hash) Checks if an artifact exists for a given tenant by its sha1 hashRetrieves aStoredArtifactInfofrom the store by its SHA1 hash.store(@NotEmpty String tenant, @NotNull InputStream content, @NotEmpty String filename, String contentType, ArtifactHashes hash) Stores an artifact into the repository.
-
Method Details
-
store
StoredArtifactInfo store(@NotEmpty @NotEmpty String tenant, @NotNull @NotNull InputStream content, @NotEmpty @NotEmpty String filename, String contentType, ArtifactHashes hash) Stores an artifact into the repository.- Parameters:
tenant- the tenant to store the artifactcontent- the content to storefilename- the filename of the artifactcontentType- the content type of the artifacthash- the hashes of the artifact to do hash-checks after storing the artifact, might benull- Returns:
- the stored artifact
- Throws:
UnsupportedOperationException- if implementation does not support the operationArtifactStoreException- in case storing of the artifact was not successfulHashNotMatchException- in casehashis provided and not matching to the calculated hashes during storing
-
getBySha1
Retrieves aStoredArtifactInfofrom the store by its SHA1 hash. ThrowsArtifactBinaryNotFoundExceptionif not found. The caller is responsible to close the InputStream.- Parameters:
tenant- the tenant to store the artifactsha1Hash- the sha1-hash of the file to lookup.- Returns:
- The artifact file object or
nullif no file exists. - Throws:
UnsupportedOperationException- if implementation does not support the operation
-
existsBySha1
Checks if an artifact exists for a given tenant by its sha1 hash- Parameters:
tenant- the tenantsha1Hash- the sha1-hash of the file to lookup.- Returns:
- the boolean whether the artifact exists or not
-
deleteBySha1
Deletes an artifact by its SHA1 hash.- Parameters:
tenant- the tenant to store the artifactsha1Hash- the sha1-hash of the artifact to delete- Throws:
UnsupportedOperationException- if implementation does not support the operation
-
deleteByTenant
Deletes all artifacts of given tenant.- Parameters:
tenant- to erase
-