Class S3CloudFileRepository

java.lang.Object
formflow.library.file.S3CloudFileRepository
All Implemented Interfaces:
CloudFileRepository

@Service @Profile("!test") public class S3CloudFileRepository extends Object implements CloudFileRepository
This is an implementation of the CloudFileRepository that uses Amazon S3
  • Constructor Details

    • S3CloudFileRepository

      public S3CloudFileRepository(@Value("${form-flow.aws.access_key}") String accessKey, @Value("${form-flow.aws.secret_key}") String secretKey, @Value("${form-flow.aws.s3_bucket_name}") String s3BucketName, @Value("${form-flow.aws.region}") String region)
  • Method Details

    • upload

      public void upload(String filePath, org.springframework.web.multipart.MultipartFile file)
      Takes a filepath and Multipart file to upload the multipart file to AWS S3 where the filepath acts as the path to the file in S3. File paths that include "/" will create a folder structure where each string prior to the "/" will represent a folder.
      Specified by:
      upload in interface CloudFileRepository
      Parameters:
      filePath - File path representing a folder structure and path to the file in S3.
      file - The multipart file to be uploaded to S3.
    • get

      public CloudFile get(String filepath)
      Specified by:
      get in interface CloudFileRepository
    • delete

      public void delete(String filepath) throws com.amazonaws.SdkClientException
      Specified by:
      delete in interface CloudFileRepository
      Throws:
      com.amazonaws.SdkClientException