Class AwsS3ServiceImpl

    • Field Detail

      • clientFactory

        protected org.craftercms.commons.aws.S3ClientCachingFactory clientFactory
        The S3 client factory.
      • partSize

        protected int partSize
        The part size used for S3 uploads
      • delimiter

        protected String delimiter
        The delimiter for S3 paths
      • urlPattern

        protected String urlPattern
        The URL pattern for the generated files
    • Constructor Detail

      • AwsS3ServiceImpl

        public AwsS3ServiceImpl()
    • Method Detail

      • setClientFactory

        public void setClientFactory​(org.craftercms.commons.aws.S3ClientCachingFactory clientFactory)
      • setPartSize

        public void setPartSize​(int partSize)
      • setDelimiter

        public void setDelimiter​(String delimiter)
      • setUrlPattern

        public void setUrlPattern​(String urlPattern)
      • getS3Client

        protected com.amazonaws.services.s3.AmazonS3 getS3Client​(org.craftercms.commons.config.profiles.aws.S3Profile profile)
      • uploadItem

        public S3Item uploadItem​(String siteId,
                                 String profileId,
                                 String path,
                                 String filename,
                                 InputStream content)
                          throws AwsException
        Uploads a file to an S3 bucket.
        Specified by:
        uploadItem in interface AwsS3Service
        Parameters:
        siteId - the site id
        profileId - the profile id
        path - the path to upload the file (will be used as part of the S3 key)
        filename - the filename (will be used as part of the S3 key)
        content - a stream providing the content of the file
        Returns:
        the uploaded item
        Throws:
        AwsException - if there is any error connection to S3
      • listItems

        public List<S3Item> listItems​(String siteId,
                                      String profileId,
                                      String path,
                                      String type)
                               throws AwsException
        Lists items in an S3 bucket.
        Specified by:
        listItems in interface AwsS3Service
        Parameters:
        siteId - the site id
        profileId - the profile id
        path - the path to list
        type - the type of items to list
        Returns:
        the list of items
        Throws:
        AwsException - if there is any error connection to S3
      • normalizePrefix

        protected String normalizePrefix​(String prefix)