Package org.bremersee.data.minio
Class MinioRepositoryImpl
- java.lang.Object
-
- org.bremersee.data.minio.MinioRepositoryImpl
-
- All Implemented Interfaces:
MinioRepository
public class MinioRepositoryImpl extends Object implements MinioRepository
The minio repository implementation.- Author:
- Christian Bremer
-
-
Constructor Summary
Constructors Constructor Description MinioRepositoryImpl(io.minio.MinioClient minioClient, String region, String bucket, boolean enableVersioning, boolean create, Duration presignedObjectUrlDuration)
Instantiates a new minio repository.MinioRepositoryImpl(MinioOperations minioOperations, String region, String bucket, boolean enableVersioning, boolean create, Duration presignedObjectUrlDuration)
Instantiates a new minio repository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(MinioObjectId id)
Delete.List<io.minio.messages.DeleteError>
deleteAll(Collection<MinioObjectId> ids)
Delete all objects.boolean
exists(MinioObjectId id)
Checks whether an object with the specified name exists or not.List<MinioMultipartFile>
findAll(String prefix)
Find all objects.Optional<MinioMultipartFile>
findOne(MinioObjectId id)
Find one.MinioOperations
getMinioOperations()
Gets minio operations.String
getPresignedObjectUrl(MinioObjectId id, io.minio.http.Method method, Duration duration)
Gets presigned object url.boolean
isVersioningEnabled()
Is versioning enabled boolean.Optional<io.minio.ObjectWriteResponse>
save(MinioObjectId id, org.springframework.web.multipart.MultipartFile multipartFile, DeleteMode deleteMode)
Save multipart file.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bremersee.data.minio.MinioRepository
findAll, getBucket, getPresignedObjectUrl, getRegion
-
-
-
-
Constructor Detail
-
MinioRepositoryImpl
public MinioRepositoryImpl(MinioOperations minioOperations, String region, String bucket, boolean enableVersioning, boolean create, Duration presignedObjectUrlDuration)
Instantiates a new minio repository.- Parameters:
minioOperations
- the minio operationsregion
- the regionbucket
- the bucketenableVersioning
- the enable versioningcreate
- the createpresignedObjectUrlDuration
- the presigned object url duration
-
MinioRepositoryImpl
public MinioRepositoryImpl(io.minio.MinioClient minioClient, String region, String bucket, boolean enableVersioning, boolean create, Duration presignedObjectUrlDuration)
Instantiates a new minio repository.- Parameters:
minioClient
- the minio clientregion
- the regionbucket
- the bucketenableVersioning
- the enable versioningcreate
- the createpresignedObjectUrlDuration
- the presigned object url duration
-
-
Method Detail
-
getMinioOperations
public MinioOperations getMinioOperations()
Description copied from interface:MinioRepository
Gets minio operations.- Specified by:
getMinioOperations
in interfaceMinioRepository
- Returns:
- the minio operations
-
isVersioningEnabled
public boolean isVersioningEnabled()
Description copied from interface:MinioRepository
Is versioning enabled boolean.- Specified by:
isVersioningEnabled
in interfaceMinioRepository
- Returns:
- the boolean
-
save
public Optional<io.minio.ObjectWriteResponse> save(MinioObjectId id, org.springframework.web.multipart.MultipartFile multipartFile, DeleteMode deleteMode)
Description copied from interface:MinioRepository
Save multipart file.- Specified by:
save
in interfaceMinioRepository
- Parameters:
id
- the idmultipartFile
- the multipart filedeleteMode
- the delete mode- Returns:
- the write response; will be empty, if the multipart file is
null
or empty
-
exists
public boolean exists(MinioObjectId id)
Description copied from interface:MinioRepository
Checks whether an object with the specified name exists or not.- Specified by:
exists
in interfaceMinioRepository
- Parameters:
id
- the id- Returns:
true
if the object exists, otherwisefalse
-
findOne
public Optional<MinioMultipartFile> findOne(MinioObjectId id)
Description copied from interface:MinioRepository
Find one.- Specified by:
findOne
in interfaceMinioRepository
- Parameters:
id
- the id- Returns:
- the multipart file
-
findAll
public List<MinioMultipartFile> findAll(String prefix)
Description copied from interface:MinioRepository
Find all objects.- Specified by:
findAll
in interfaceMinioRepository
- Parameters:
prefix
- the prefix- Returns:
- the list
-
delete
public void delete(MinioObjectId id)
Description copied from interface:MinioRepository
Delete.- Specified by:
delete
in interfaceMinioRepository
- Parameters:
id
- the id
-
deleteAll
public List<io.minio.messages.DeleteError> deleteAll(Collection<MinioObjectId> ids)
Description copied from interface:MinioRepository
Delete all objects.- Specified by:
deleteAll
in interfaceMinioRepository
- Parameters:
ids
- the IDs- Returns:
- the list
-
getPresignedObjectUrl
public String getPresignedObjectUrl(MinioObjectId id, io.minio.http.Method method, Duration duration)
Description copied from interface:MinioRepository
Gets presigned object url.- Specified by:
getPresignedObjectUrl
in interfaceMinioRepository
- Parameters:
id
- the idmethod
- the methodduration
- the duration- Returns:
- the presigned object url
-
-