Package org.craftercms.engine.store.s3
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
Modifier and TypeFieldDescriptionprotected 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
ConstructorDescriptionS3ContentStoreAdapter
(S3ClientBuilder clientBuilder, int contentMaxLength, String[] cacheAllowedPaths) -
Method Summary
Modifier and TypeMethodDescriptionvoid
org.craftercms.core.service.Context
createContext
(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles) void
destroy()
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
-
Field Details
-
DELIMITER
- See Also:
-
clientBuilder
-
client
protected com.amazonaws.services.s3.AmazonS3 client -
contentMaxLength
protected final int contentMaxLength -
cacheAllowedPaths
-
-
Constructor Details
-
S3ContentStoreAdapter
@ConstructorProperties({"clientBuilder","contentMaxLength","cacheAllowedPaths"}) public S3ContentStoreAdapter(S3ClientBuilder clientBuilder, int contentMaxLength, String[] cacheAllowedPaths)
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
destroy
public void destroy()- Specified by:
destroy
in interfaceorg.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 interfaceorg.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 classorg.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 classAbstractCachedFileBasedContentStoreAdapter
- 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 classAbstractCachedFileBasedContentStoreAdapter
- 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 interfaceorg.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 interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.StoreException
org.craftercms.core.exception.AuthenticationException
-