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 ofBlobStore- Since:
- 3.1.6
- Author:
- joseross
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractBlobStore.MappingInternal class used when loading the configuration
-
Field Summary
Fields Modifier and Type Field Description protected StringidThe id of the storeprotected Map<String,AbstractBlobStore.Mapping>mappingsThe mappings for the different environmentsprotected StringpatternThe regex to check for compatible pathsprotected TprofileThe profile to connect to the remote storeprotected ConfigurationMapper<T>profileMapperThe mapper to load the profile configurationprotected PublishingTargetResolverpublishingTargetResolverThe publishing target resolver-
Fields 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 Constructor Description AbstractBlobStore()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract org.springframework.core.io.ResourcedoGetContent(AbstractBlobStore.Mapping mapping, String path)protected abstract voiddoInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config)StringgetId()Returns the unique id of the storeprotected AbstractBlobStore.MappinggetMapping(String publishingTarget)org.springframework.core.io.ResourcegetResource(String path, Blob blob)Resolves the given blob to a readable resourcevoidinit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config)Performs all setup needed with the given configurationbooleanisCompatible(String path)Indicates if the given path is compatible with the storevoidsetId(String id)voidsetPattern(String pattern)voidsetProfileMapper(ConfigurationMapper<T> profileMapper)voidsetPublishingTargetResolver(PublishingTargetResolver publishingTargetResolver)
-
-
-
Field Detail
-
id
protected String id
The id of the store
-
pattern
protected String pattern
The regex to check for compatible paths
-
mappings
protected Map<String,AbstractBlobStore.Mapping> mappings
The mappings for the different environments
-
profile
protected T extends ConfigurationProfile profile
The profile to connect to the remote store
-
profileMapper
protected ConfigurationMapper<T extends ConfigurationProfile> profileMapper
The mapper to load the profile configuration
-
publishingTargetResolver
protected PublishingTargetResolver publishingTargetResolver
The publishing target resolver
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:BlobStoreReturns the unique id of the store
-
setId
public void setId(String id)
-
setPattern
public void setPattern(String pattern)
-
setProfileMapper
public void setProfileMapper(ConfigurationMapper<T> profileMapper)
-
setPublishingTargetResolver
public void setPublishingTargetResolver(PublishingTargetResolver publishingTargetResolver)
-
isCompatible
public boolean isCompatible(String path)
Description copied from interface:BlobStoreIndicates if the given path is compatible with the store- Specified by:
isCompatiblein 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 ConfigurationExceptionDescription copied from interface:BlobStorePerforms all setup needed with the given configuration- Specified by:
initin 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
public org.springframework.core.io.Resource getResource(String path, Blob blob)
Description copied from interface:BlobStoreResolves the given blob to a readable resource- Specified by:
getResourcein 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
protected AbstractBlobStore.Mapping getMapping(String publishingTarget)
-
-