Package org.craftercms.core.store.impl
Class AbstractCachedContentStoreAdapter
- java.lang.Object
-
- org.craftercms.core.store.impl.AbstractCachedContentStoreAdapter
-
- All Implemented Interfaces:
ContentStoreAdapter
- Direct Known Subclasses:
AbstractFileBasedContentStoreAdapter
public abstract class AbstractCachedContentStoreAdapter extends Object implements ContentStoreAdapter
AbstractContentStoreAdapterthat provides caching to actual implementations. Subclasses just have to implement thedo*methods to provide the cacheable objects. Caching works the following way: when an interface method is called, and there's no cached object associated to the parameter-based compound key, the do* method of the same name is called to execute the actual method code. The returned object is then cached with the compound key.- Author:
- Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description protected CacheTemplatecacheTemplatestatic StringCONST_KEY_ELEM_CONTENTstatic StringCONST_KEY_ELEM_EXISTSstatic StringCONST_KEY_ELEM_ITEMstatic StringCONST_KEY_ELEM_ITEMSprotected CachingOptionsdefaultCachingOptions
-
Constructor Summary
Constructors Constructor Description AbstractCachedContentStoreAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleandoExists(Context context, CachingOptions cachingOptions, String path)protected abstract ContentdoFindContent(Context context, CachingOptions cachingOptions, String path)protected abstract ItemdoFindItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor)protected abstract List<Item>doFindItems(Context context, CachingOptions cachingOptions, String path)booleanexists(Context context, CachingOptions cachingOptions, String path)ContentfindContent(Context context, CachingOptions cachingOptions, String path)ItemfindItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor)List<Item>findItems(Context context, CachingOptions cachingOptions, String path)voidsetCacheTemplate(CacheTemplate cacheTemplate)voidsetDefaultCachingOptions(CachingOptions defaultCachingOptions)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.craftercms.core.store.ContentStoreAdapter
createContext, destroyContext, validate
-
-
-
-
Field Detail
-
CONST_KEY_ELEM_CONTENT
public static final String CONST_KEY_ELEM_CONTENT
- See Also:
- Constant Field Values
-
CONST_KEY_ELEM_ITEM
public static final String CONST_KEY_ELEM_ITEM
- See Also:
- Constant Field Values
-
CONST_KEY_ELEM_ITEMS
public static final String CONST_KEY_ELEM_ITEMS
- See Also:
- Constant Field Values
-
CONST_KEY_ELEM_EXISTS
public static final String CONST_KEY_ELEM_EXISTS
- See Also:
- Constant Field Values
-
cacheTemplate
protected CacheTemplate cacheTemplate
-
defaultCachingOptions
protected CachingOptions defaultCachingOptions
-
-
Method Detail
-
setCacheTemplate
public void setCacheTemplate(CacheTemplate cacheTemplate)
-
setDefaultCachingOptions
public void setDefaultCachingOptions(CachingOptions defaultCachingOptions)
-
exists
public boolean exists(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException
- Specified by:
existsin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionStoreException
-
findContent
public Content findContent(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException
- Specified by:
findContentin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionStoreException
-
findItem
public Item findItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) throws InvalidContextException, XmlFileParseException, StoreException
- Specified by:
findItemin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionXmlFileParseExceptionStoreException
-
findItems
public List<Item> findItems(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, XmlFileParseException, StoreException
- Specified by:
findItemsin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionXmlFileParseExceptionStoreException
-
doExists
protected abstract boolean doExists(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException
-
doFindContent
protected abstract Content doFindContent(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException
-
doFindItem
protected abstract Item doFindItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) throws InvalidContextException, XmlFileParseException, StoreException
-
doFindItems
protected abstract List<Item> doFindItems(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, XmlFileParseException, StoreException
-
-