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 Details

    • s3Client

      protected final software.amazon.awssdk.services.s3.S3Client s3Client
      AWS 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 interface S3Repository
      Parameters:
      bucketName - destination bucket
      node - node whose id acts as the key
      metadata - metadata key/value pairs to associate with the object
      inputStream - stream of the content to store
    • getObject

      public InputStream getObject(String bucketName, String nodeId)
      Retrieves the object content for the given node id using the underlying S3Client.
      Specified by:
      getObject in interface S3Repository
      Parameters:
      bucketName - bucket containing the object
      nodeId - the node id / object key
      Returns:
      the object content stream