Class S3ContentStoreAdapter

java.lang.Object
org.craftercms.core.store.impl.AbstractCachedContentStoreAdapter
org.craftercms.core.store.impl.AbstractFileBasedContentStoreAdapter
org.craftercms.engine.store.AbstractCachedFileBasedContentStoreAdapter
org.craftercms.engine.store.s3.S3ContentStoreAdapter
All Implemented Interfaces:
org.craftercms.core.store.ContentStoreAdapter, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class S3ContentStoreAdapter extends AbstractCachedFileBasedContentStoreAdapter implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Implementation of ContentStoreAdapter to read files from AWS S3.
Author:
joseross
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String[]
     
    protected com.amazonaws.services.s3.AmazonS3
     
    protected final S3ClientBuilder
     
    protected final int
     
    static final String
     

    Fields inherited from class org.craftercms.engine.store.AbstractCachedFileBasedContentStoreAdapter

    CONST_KEY_ELEM_CHILDREN, CONST_KEY_ELEM_FILE

    Fields inherited from class org.craftercms.core.store.impl.AbstractFileBasedContentStoreAdapter

    charset, DEFAULT_CHARSET, descriptorFileExtension, metadataFileExtension, pathValidator

    Fields inherited from class org.craftercms.core.store.impl.AbstractCachedContentStoreAdapter

    cacheTemplate, CONST_KEY_ELEM_CONTENT, CONST_KEY_ELEM_EXISTS, CONST_KEY_ELEM_ITEM, CONST_KEY_ELEM_ITEMS, defaultCachingOptions
  • Constructor Summary

    Constructors
    Constructor
    Description
    S3ContentStoreAdapter(S3ClientBuilder clientBuilder, int contentMaxLength, String[] cacheAllowedPaths)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    org.craftercms.core.service.Context
    createContext(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles)
    void
     
    void
    destroyContext(org.craftercms.core.service.Context context)
    protected org.craftercms.core.store.impl.File
    doFindFile(org.craftercms.core.service.Context context, String path)
    protected List<org.craftercms.core.store.impl.File>
    doGetChildren(org.craftercms.core.service.Context context, org.craftercms.core.store.impl.File dir)
    protected org.craftercms.core.service.Content
    getContent(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, org.craftercms.core.store.impl.File file)
     
    protected boolean
    isResultEmpty(com.amazonaws.services.s3.model.ListObjectsV2Result result)
     
    boolean
    validate(org.craftercms.core.service.Context context)

    Methods inherited from class org.craftercms.engine.store.AbstractCachedFileBasedContentStoreAdapter

    findFile, getChildren

    Methods inherited from class org.craftercms.core.store.impl.AbstractFileBasedContentStoreAdapter

    createXmlReader, doExists, doFindContent, doFindItem, doFindItems, setCharset, setDescriptorFileExtension, setMetadataFileExtension, setPathValidator, validatePath

    Methods inherited from class org.craftercms.core.store.impl.AbstractCachedContentStoreAdapter

    exists, findContent, findItem, findItems, setCacheTemplate, setDefaultCachingOptions

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DELIMITER

      public static final String DELIMITER
      See Also:
    • clientBuilder

      protected final S3ClientBuilder clientBuilder
    • client

      protected com.amazonaws.services.s3.AmazonS3 client
    • contentMaxLength

      protected final int contentMaxLength
    • cacheAllowedPaths

      protected final String[] cacheAllowedPaths
  • Constructor Details

    • S3ContentStoreAdapter

      @ConstructorProperties({"clientBuilder","contentMaxLength","cacheAllowedPaths"}) public S3ContentStoreAdapter(S3ClientBuilder clientBuilder, int contentMaxLength, String[] cacheAllowedPaths)
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • isResultEmpty

      protected boolean isResultEmpty(com.amazonaws.services.s3.model.ListObjectsV2Result result)
    • createContext

      public org.craftercms.core.service.Context createContext(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles) throws org.craftercms.core.exception.RootFolderNotFoundException, org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException
      Specified by:
      createContext in interface org.craftercms.core.store.ContentStoreAdapter
      Throws:
      org.craftercms.core.exception.RootFolderNotFoundException
      org.craftercms.core.exception.StoreException
      org.craftercms.core.exception.AuthenticationException
    • getContent

      protected org.craftercms.core.service.Content getContent(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, org.craftercms.core.store.impl.File file) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException
      Specified by:
      getContent in class org.craftercms.core.store.impl.AbstractFileBasedContentStoreAdapter
      Throws:
      org.craftercms.core.exception.InvalidContextException
      org.craftercms.core.exception.StoreException
    • doFindFile

      protected org.craftercms.core.store.impl.File doFindFile(org.craftercms.core.service.Context context, String path) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException
      Specified by:
      doFindFile in class AbstractCachedFileBasedContentStoreAdapter
      Throws:
      org.craftercms.core.exception.InvalidContextException
      org.craftercms.core.exception.StoreException
    • doGetChildren

      protected List<org.craftercms.core.store.impl.File> doGetChildren(org.craftercms.core.service.Context context, org.craftercms.core.store.impl.File dir) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException
      Specified by:
      doGetChildren in class AbstractCachedFileBasedContentStoreAdapter
      Throws:
      org.craftercms.core.exception.InvalidContextException
      org.craftercms.core.exception.StoreException
    • validate

      public boolean validate(org.craftercms.core.service.Context context) throws org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException
      Specified by:
      validate in interface org.craftercms.core.store.ContentStoreAdapter
      Throws:
      org.craftercms.core.exception.StoreException
      org.craftercms.core.exception.AuthenticationException
    • destroyContext

      public void destroyContext(org.craftercms.core.service.Context context) throws org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException
      Specified by:
      destroyContext in interface org.craftercms.core.store.ContentStoreAdapter
      Throws:
      org.craftercms.core.exception.StoreException
      org.craftercms.core.exception.AuthenticationException