Package org.saidone.repository
Class S3RepositoryImpl
java.lang.Object
org.saidone.component.BaseComponent
org.saidone.repository.S3RepositoryImpl
- All Implemented Interfaces:
S3Repository
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
EncryptedS3RepositoryImpl
@Service
@ConditionalOnExpression("${application.service.vault.encryption.enabled}.equals(false) and \'${application.service.vault.storage.impl}\'.equals(\'s3\')")
public class S3RepositoryImpl
extends BaseComponent
implements S3Repository
Default
S3Repository
implementation relying on the AWS SDK
S3Client
. The class exposes basic methods to upload and download
objects using a provided S3Client
instance.
The bean is created only when application.service.vault.encryption.enabled
is set to false
and application.service.vault.storage.impl
equals "s3"
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final software.amazon.awssdk.services.s3.S3Client
AWS S3 client used to perform the requests. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.saidone.component.BaseComponent
init, setApplicationContext, shutDown, stop
-
Field Details
-
s3Client
protected final software.amazon.awssdk.services.s3.S3Client s3ClientAWS S3 client used to perform the requests. It is injected by Spring and expected to be thread-safe.
-
-
Constructor Details
-
S3RepositoryImpl
public S3RepositoryImpl()
-
-
Method Details
-
putObject
public void putObject(String bucketName, org.alfresco.core.model.Node node, Map<String, String> metadata, InputStream inputStream) Uploads the provided stream as an object to S3. The node id is used as the object key.- Specified by:
putObject
in interfaceS3Repository
- Parameters:
bucketName
- destination bucketnode
- node whose id acts as the keymetadata
- metadata key/value pairs to associate with the objectinputStream
- stream of the content to store
-
getObject
Retrieves the object content for the given node id using the underlyingS3Client
.- Specified by:
getObject
in interfaceS3Repository
- Parameters:
bucketName
- bucket containing the objectnodeId
- the node id / object key- Returns:
- the object content stream
-