Class AbstractBlobStore<T extends ConfigurationProfile>
java.lang.Object
org.craftercms.commons.file.blob.impl.AbstractBlobStore<T>
- All Implemented Interfaces:
BlobStore
- Direct Known Subclasses:
AwsS3BlobStore
public abstract class AbstractBlobStore<T extends ConfigurationProfile>
extends Object
implements BlobStore
Base class for all implementations of
BlobStore
- Since:
- 3.1.6
- Author:
- joseross
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Internal class used when loading the configuration -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
The id of the storeprotected Map<String,
AbstractBlobStore.Mapping> The mappings for the different environmentsprotected String
The regex to check for compatible pathsprotected T
The profile to connect to the remote storeprotected ConfigurationMapper<T>
The mapper to load the profile configurationprotected PublishingTargetResolver
The publishing target resolverFields inherited from interface org.craftercms.commons.file.blob.BlobStore
CONFIG_KEY_CONFIGURATION, CONFIG_KEY_ID, CONFIG_KEY_MAPPING, CONFIG_KEY_MAPPING_PREFIX, CONFIG_KEY_MAPPING_PUBLISHING_TARGET, CONFIG_KEY_MAPPING_STORE_TARGET, CONFIG_KEY_PATTERN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.springframework.core.io.Resource
doGetContent
(AbstractBlobStore.Mapping mapping, String path) protected abstract void
doInit
(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) getId()
Returns the unique id of the storeprotected AbstractBlobStore.Mapping
getMapping
(String publishingTarget) org.springframework.core.io.Resource
getResource
(String path, Blob blob) Resolves the given blob to a readable resourcevoid
init
(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) Performs all setup needed with the given configurationboolean
isCompatible
(String path) Indicates if the given path is compatible with the storevoid
void
setPattern
(String pattern) void
setProfileMapper
(ConfigurationMapper<T> profileMapper) void
setPublishingTargetResolver
(PublishingTargetResolver publishingTargetResolver)
-
Field Details
-
id
The id of the store -
pattern
The regex to check for compatible paths -
mappings
The mappings for the different environments -
profile
The profile to connect to the remote store -
profileMapper
The mapper to load the profile configuration -
publishingTargetResolver
The publishing target resolver
-
-
Constructor Details
-
AbstractBlobStore
public AbstractBlobStore()
-
-
Method Details
-
getId
Description copied from interface:BlobStore
Returns the unique id of the store -
setId
-
setPattern
-
setProfileMapper
-
setPublishingTargetResolver
-
isCompatible
Description copied from interface:BlobStore
Indicates if the given path is compatible with the store- Specified by:
isCompatible
in interfaceBlobStore
- Parameters:
path
- path to check- Returns:
- true if the path is compatible
-
init
public void init(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) throws ConfigurationException Description copied from interface:BlobStore
Performs all setup needed with the given configuration- Specified by:
init
in interfaceBlobStore
- Parameters:
config
- the configuration object- Throws:
ConfigurationException
- is any error occurs
-
doInit
protected abstract void doInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) throws ConfigurationException - Throws:
ConfigurationException
-
getResource
Description copied from interface:BlobStore
Resolves the given blob to a readable resource- Specified by:
getResource
in interfaceBlobStore
- Parameters:
path
- the path of the resourceblob
- the blob file- Returns:
- the resource object
-
doGetContent
protected abstract org.springframework.core.io.Resource doGetContent(AbstractBlobStore.Mapping mapping, String path) -
getMapping
-