Class S3ReportStorage

  • All Implemented Interfaces:
    ConfigurationObject, ReportStorage

    public class S3ReportStorage
    extends java.lang.Object
    implements ReportStorage
    Configuration for storing the reports in a S3 compatible storage.

    By default, authentication is done using the DefaultAWSCredentialsProviderChain which uses Environment Variables, Java System Properties, Credential profiles file, ...

    • Constructor Summary

      Constructors 
      Constructor Description
      S3ReportStorage()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAccessKey()  
      java.lang.String getBucket()  
      java.lang.String getEndpointUrl()  
      protected java.lang.String getKey​(java.lang.String ref, java.lang.String filename, java.lang.String extension)
      Compute the key to use.
      java.lang.String getPrefix()  
      java.lang.String getRegion()  
      int getRetentionDays()  
      java.lang.String getSecretKey()  
      java.net.URL save​(java.lang.String ref, java.lang.String filename, java.lang.String extension, java.lang.String mimeType, java.io.File file)
      Save the report in the storage.
      void setAccessKey​(java.lang.String accessKey)
      To set the access key.
      void setBucket​(java.lang.String bucket)
      The S3 bucket to use.
      void setEndpointUrl​(java.lang.String endpointUrl)
      To override the endpoint URL (for non-Amazon, S3 compatible servers).
      void setPrefix​(java.lang.String prefix)
      The key prefix to use.
      void setRegion​(java.lang.String region)
      To set the region to use.
      void setRetentionDays​(int retentionDays)
      The number of day the reports must be kept.
      void setSecretKey​(java.lang.String secretKey)
      To set the secret key.
      void validate​(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
      validate that the configuration was correct.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • S3ReportStorage

        public S3ReportStorage()
    • Method Detail

      • save

        public java.net.URL save​(java.lang.String ref,
                                 java.lang.String filename,
                                 java.lang.String extension,
                                 java.lang.String mimeType,
                                 java.io.File file)
        Description copied from interface: ReportStorage
        Save the report in the storage.
        Specified by:
        save in interface ReportStorage
        Parameters:
        ref - The reference number.
        filename - The filename.
        extension - The file extension.
        mimeType - The mime type.
        file - The file containing the report.
        Returns:
        The URL that can be used to fetch the result.
      • getKey

        protected java.lang.String getKey​(java.lang.String ref,
                                          java.lang.String filename,
                                          java.lang.String extension)
        Compute the key to use.
        Parameters:
        ref - The reference number.
        filename - The filename.
        extension - The file extension.
      • validate

        public void validate​(java.util.List<java.lang.Throwable> validationErrors,
                             Configuration configuration)
        Description copied from interface: ConfigurationObject
        validate that the configuration was correct.
        Specified by:
        validate in interface ConfigurationObject
        Parameters:
        validationErrors - a list to add any detected errors to.
        configuration - the containing configuration
      • getAccessKey

        public java.lang.String getAccessKey()
      • setAccessKey

        public void setAccessKey​(java.lang.String accessKey)
        To set the access key.
        Parameters:
        accessKey - the value.
      • getSecretKey

        public java.lang.String getSecretKey()
      • setSecretKey

        public void setSecretKey​(java.lang.String secretKey)
        To set the secret key.
        Parameters:
        secretKey - the value.
      • getRegion

        public java.lang.String getRegion()
      • setRegion

        public void setRegion​(java.lang.String region)
        To set the region to use.
        Parameters:
        region - the value.
      • getEndpointUrl

        public java.lang.String getEndpointUrl()
      • setEndpointUrl

        public void setEndpointUrl​(java.lang.String endpointUrl)
        To override the endpoint URL (for non-Amazon, S3 compatible servers).
        Parameters:
        endpointUrl - the value.
      • getBucket

        public java.lang.String getBucket()
      • setBucket

        public void setBucket​(java.lang.String bucket)
        The S3 bucket to use.
        Parameters:
        bucket - the value.
      • getPrefix

        public java.lang.String getPrefix()
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        The key prefix to use.
        Parameters:
        prefix - the value.
      • getRetentionDays

        public int getRetentionDays()
      • setRetentionDays

        public void setRetentionDays​(int retentionDays)
        The number of day the reports must be kept.

        Passed this delay, they will be deleted and the links included in the corresponding emails will become invalid. Defaults to 7 days.

        Parameters:
        retentionDays - the value.