Class AbstractS3Processor

All Implemented Interfaces:
DeploymentProcessor, InitializableByConfigBean, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware
Direct Known Subclasses:
S3DeploymentEventsProcessor, S3SyncProcessor

public abstract class AbstractS3Processor extends AbstractMainDeploymentProcessor
Base implementation of AbstractMainDeploymentProcessor for processors that use AWS S3. Can be configured with the following YAML properties:
  • url: AWS S3 bucket URL to upload files
Since:
3.1.8
Author:
joseross
  • Field Details

    • CONFIG_KEY_URL

      protected static final String CONFIG_KEY_URL
      See Also:
    • MACRO_SITENAME

      protected static final String MACRO_SITENAME
      See Also:
    • DELIMITER

      protected static final String DELIMITER
      See Also:
    • logger

      protected org.slf4j.Logger logger
    • builderConfigurer

      protected AwsClientBuilderConfigurer builderConfigurer
      Helper class the configures credentials and other properties for a AmazonS3 client.
    • s3Url

      protected com.amazonaws.services.s3.AmazonS3URI s3Url
      AWS S3 bucket URL
    • threadPoolTaskExecutor

      protected org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor threadPoolTaskExecutor
      Thread pool to use for TransferManager instances
  • Constructor Details

    • AbstractS3Processor

      public AbstractS3Processor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor threadPoolTaskExecutor)
  • Method Details

    • doInit

      protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException
      Allows extending classes perform any custom initialization
      Specified by:
      doInit in class AbstractDeploymentProcessor
      Parameters:
      config - the bean's configuration
      Throws:
      org.craftercms.commons.config.ConfigurationException - if there's configuration related exception
    • getS3BaseKey

      protected String getS3BaseKey()
      Returns the base key from the S3 URL, making sure to replace the {siteName} macro instances
    • getS3Key

      protected String getS3Key(String file)
      Builds the AWS S3 key for the given file
      Parameters:
      file - relative path of the file
      Returns:
      the full S3 key
    • buildClient

      protected com.amazonaws.services.s3.AmazonS3 buildClient()
      Builds the AmazonS3 client.
    • buildTransferManager

      protected com.amazonaws.services.s3.transfer.TransferManager buildTransferManager(com.amazonaws.services.s3.AmazonS3 client)
      Builds the TransferManager using the shared ExecutorService
    • doDestroy

      protected void doDestroy() throws DeployerException
      Allows extending classes perform any custom cleanup
      Specified by:
      doDestroy in class AbstractDeploymentProcessor
      Throws:
      DeployerException - if an error occurs