Package org.craftercms.core.store.impl
Class AbstractFileBasedContentStoreAdapter
java.lang.Object
org.craftercms.core.store.impl.AbstractCachedContentStoreAdapter
org.craftercms.core.store.impl.AbstractFileBasedContentStoreAdapter
- All Implemented Interfaces:
ContentStoreAdapter
- Direct Known Subclasses:
FileSystemContentStoreAdapter
public abstract class AbstractFileBasedContentStoreAdapter
extends AbstractCachedContentStoreAdapter
File-based content store adapter. Takes away common stuff from actual implementations, like handling metadata files
and loading descriptor DOMs.
- Author:
- Alfonso Vásquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringstatic final Stringprotected Stringprotected Stringprotected org.springframework.validation.ValidatorFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected org.dom4j.io.SAXReaderCreates and configures an XML SAX reader.booleandoExists(Context context, CachingOptions cachingOptions, String path) protected ContentdoFindContent(Context context, CachingOptions cachingOptions, String path) protected ItemdoFindItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) doFindItems(Context context, CachingOptions cachingOptions, String path) protected abstract FilefindFile(Context context, CachingOptions cachingOptions, String path) Returns theFileat the given path, returning null if not found.getChildren(Context context, CachingOptions cachingOptions, File dir) Returns the list of children of the given directory.protected abstract ContentgetContent(Context context, CachingOptions cachingOptions, File file) Returns theContentfor the given file.voidsetCharset(String charset) voidsetDescriptorFileExtension(String descriptorFileExtension) voidsetMetadataFileExtension(String metadataFileExtension) voidsetPathValidator(org.springframework.validation.Validator pathValidator) protected voidvalidatePath(String path) Methods inherited from class org.craftercms.core.store.impl.AbstractCachedContentStoreAdapter
exists, findContent, findItem, findItems, setCacheTemplate, setDefaultCachingOptionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.craftercms.core.store.ContentStoreAdapter
createContext, destroyContext, validate
-
Field Details
-
DEFAULT_CHARSET
- See Also:
-
pathValidator
protected org.springframework.validation.Validator pathValidator -
charset
-
descriptorFileExtension
-
metadataFileExtension
-
-
Constructor Details
-
AbstractFileBasedContentStoreAdapter
public AbstractFileBasedContentStoreAdapter()
-
-
Method Details
-
setCharset
-
setPathValidator
public void setPathValidator(org.springframework.validation.Validator pathValidator) -
setDescriptorFileExtension
-
setMetadataFileExtension
-
doExists
public boolean doExists(Context context, CachingOptions cachingOptions, String path) throws InvalidScopeException, StoreException - Specified by:
doExistsin classAbstractCachedContentStoreAdapter- Throws:
InvalidScopeExceptionStoreException
-
doFindContent
protected Content doFindContent(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException - Specified by:
doFindContentin classAbstractCachedContentStoreAdapter- Throws:
InvalidContextExceptionStoreException
-
doFindItem
protected Item doFindItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) throws InvalidContextException, PathNotFoundException, XmlFileParseException, StoreException - Specified by:
doFindItemin classAbstractCachedContentStoreAdapter- Throws:
InvalidContextExceptionPathNotFoundExceptionXmlFileParseExceptionStoreException
-
doFindItems
protected List<Item> doFindItems(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, PathNotFoundException, XmlFileParseException, StoreException - Specified by:
doFindItemsin classAbstractCachedContentStoreAdapter- Throws:
InvalidContextExceptionPathNotFoundExceptionXmlFileParseExceptionStoreException
-
createXmlReader
protected org.dom4j.io.SAXReader createXmlReader()Creates and configures an XML SAX reader. -
validatePath
- Throws:
StoreException
-
getContent
protected abstract Content getContent(Context context, CachingOptions cachingOptions, File file) throws InvalidContextException, StoreException Returns theContentfor the given file. -
findFile
protected abstract File findFile(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException Returns theFileat the given path, returning null if not found. -
getChildren
protected abstract List<File> getChildren(Context context, CachingOptions cachingOptions, File dir) throws InvalidContextException, StoreException Returns the list of children of the given directory.
-