public abstract class AbstractCachedContentStoreService extends Object implements ContentStoreService
ContentStoreService that provides caching to actual implementations. Subclasses just have to
implement the do* 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.| Modifier and Type | Field and Description |
|---|---|
protected CacheTemplate |
cacheTemplate
Helper that uses an array of key elements (as the compound key) an a callback (when no cache object is found)
for caching.
|
static String |
CONST_KEY_ELEM_CHILDREN
A constant added to all
getChildren() cache keys. |
static String |
CONST_KEY_ELEM_ITEM
A constant added to all
getItem() cache keys. |
static String |
CONST_KEY_ELEM_TREE
A constant added to all
getTree() cache keys. |
protected CachingOptions |
defaultCachingOptions
The default caching options to use when none are specified in the method.
|
UNLIMITED_TREE_DEPTH| Constructor and Description |
|---|
AbstractCachedContentStoreService() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract List<Item> |
doFindChildren(Context context,
CachingOptions cachingOptions,
String url,
ItemFilter filter,
ItemProcessor processor) |
protected abstract Item |
doFindItem(Context context,
CachingOptions cachingOptions,
String url,
ItemProcessor processor) |
protected abstract Tree |
doFindTree(Context context,
CachingOptions cachingOptions,
String url,
int depth,
ItemFilter filter,
ItemProcessor processor) |
List<Item> |
findChildren(Context context,
CachingOptions cachingOptions,
String url,
ItemFilter filter,
ItemProcessor processor)
Returns the children of the folder at the given url, returning null if the folder can't be found.
|
List<Item> |
findChildren(Context context,
String url)
Returns the children of the folder at the given url, returning null if the folder can't be found.
|
Item |
findItem(Context context,
CachingOptions cachingOptions,
String url,
ItemProcessor processor)
Returns the content store item for the given url, returning null if not found.
|
Item |
findItem(Context context,
String url)
Returns the content store item for the given url, returning null if not found.
|
Tree |
findTree(Context context,
CachingOptions cachingOptions,
String url,
int depth,
ItemFilter filter,
ItemProcessor processor)
Returns the folder at the given url as a tree, or null if the folder wasn't found.
|
Tree |
findTree(Context context,
String url)
Returns the folder at the given url as a tree, or null if the folder wasn't found.
|
Tree |
findTree(Context context,
String url,
int depth)
Returns the folder at the given url as a tree, or null if the folder wasn't found.
|
List<Item> |
getChildren(Context context,
CachingOptions cachingOptions,
String url,
ItemFilter filter,
ItemProcessor processor)
Returns the children of the folder at the given url.
|
List<Item> |
getChildren(Context context,
String url)
Returns the children of the folder at the given url.
|
Item |
getItem(Context context,
CachingOptions cachingOptions,
String url,
ItemProcessor processor)
Returns the content store item for the given url.
|
Item |
getItem(Context context,
String url)
Returns the content store item for the given url.
|
Tree |
getTree(Context context,
CachingOptions cachingOptions,
String url,
int depth,
ItemFilter filter,
ItemProcessor processor)
Returns the folder at the given url as a tree.
|
Tree |
getTree(Context context,
String url)
Returns the folder at the given url as a tree.
|
Tree |
getTree(Context context,
String url,
int depth)
Returns the folder at the given url as a tree.
|
void |
setCacheTemplate(CacheTemplate cacheTemplate)
Sets the
CacheTemplate, which is used as a helper for caching. |
void |
setDefaultCachingOptions(CachingOptions defaultCachingOptions)
Sets the default caching options to use when none are specified in the method.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateContext, destroyContext, exists, findContent, findContent, getContent, getContent, getContext, validatepublic static final String CONST_KEY_ELEM_ITEM
getItem() cache keys.public static final String CONST_KEY_ELEM_CHILDREN
getChildren() cache keys.public static final String CONST_KEY_ELEM_TREE
getTree() cache keys.protected CacheTemplate cacheTemplate
protected CachingOptions defaultCachingOptions
public void setCacheTemplate(CacheTemplate cacheTemplate)
CacheTemplate, which is used as a helper for caching.public void setDefaultCachingOptions(CachingOptions defaultCachingOptions)
public Item findItem(Context context, String url) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItem for the
types of files an item can be.findItem in interface ContentStoreServicecontext - the context with the store configuration (required)url - the url of the item (required)InvalidContextException - if the context is invalidXmlFileParseException - if there was an error while parsing the item's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing the itemStoreException - if an error occurred while accessing the content storepublic Item findItem(Context context, CachingOptions cachingOptions, String url, ItemProcessor processor) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItem for the types of
files an item can be.findItem in interface ContentStoreServicecontext - the context to the content store (required)cachingOptions - the caching options for any caching operation done inside this service call (optional)url - the url of the item (optional, can be null)processor - additional ItemProcessor (optional, can be null)InvalidContextException - if the context is invalidXmlFileParseException - if there was an error while parsing the item's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing the itemStoreException - if an error occurred while accessing the content storepublic Item getItem(Context context, String url) throws InvalidContextException, PathNotFoundException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItem for the types of files an item can be.getItem in interface ContentStoreServicecontext - the context with the store configuration (required)url - the url of the item (required)InvalidContextException - if the context is invalidPathNotFoundException - if the file the url points to can't be foundXmlFileParseException - if there was an error while parsing the item's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing the itemStoreException - if an error occurred while accessing the content storepublic Item getItem(Context context, CachingOptions cachingOptions, String url, ItemProcessor processor) throws InvalidContextException, PathNotFoundException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItem for the types of files an item can be.getItem in interface ContentStoreServicecontext - the context to the content store (required)cachingOptions - the caching options for any caching operation done inside this service call (optional)url - the url of the item (optional, can be null)processor - additional ItemProcessor (optional, can be null)InvalidContextException - if the context is invalidPathNotFoundException - if the file the url points to can't be foundXmlFileParseException - if there was an error while parsing the item's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing the itemStoreException - if an error occurred while accessing the content storepublic List<Item> findChildren(Context context, String url) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServicefindChildren in interface ContentStoreServicecontext - the context to the content store (required)url - the url of the folder (required)InvalidContextException - if the context is invalidXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic List<Item> findChildren(Context context, CachingOptions cachingOptions, String url, ItemFilter filter, ItemProcessor processor) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServicefindChildren in interface ContentStoreServicecontext - the context to the content store (required)cachingOptions - the caching options for any caching operation done inside this service call (optional)url - the url of the folder (required)filter - an ItemFilter to filter out undesired children (optional, can be null)processor - additional ItemProcessor for the children (optional, can be null)InvalidContextException - if the context is invalidXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic List<Item> getChildren(Context context, String url) throws InvalidContextException, PathNotFoundException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServicegetChildren in interface ContentStoreServicecontext - the context to the content store (required)url - the url of the folder (required)InvalidContextException - if the context is invalidPathNotFoundException - if the folder the url points to can't be foundXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic List<Item> getChildren(Context context, CachingOptions cachingOptions, String url, ItemFilter filter, ItemProcessor processor) throws InvalidContextException, PathNotFoundException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServicegetChildren in interface ContentStoreServicecontext - the context to the content store (required)cachingOptions - the caching options for any caching operation done inside this service call (optional)url - the url of the folder (required)filter - an ItemFilter to filter out undesired children (optional, can be null)processor - additional ItemProcessor for the children (optional, can be null)InvalidContextException - if the context is invalidPathNotFoundException - if the folder the url points to can't be foundXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic Tree findTree(Context context, String url) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItems when they're files and as Trees when they're folders. The tree depth is
ContentStoreService.UNLIMITED_TREE_DEPTH.findTree in interface ContentStoreServicecontext - the context to the content store (required)url - the url of the folder (required)InvalidContextException - if the context is invalidXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic Tree findTree(Context context, String url, int depth) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItems when they're files and as Trees when they're folders.findTree in interface ContentStoreServicecontext - the context to the content store (required)url - the url of the folder (required)depth - the number of levels the tree should have. Use #UNLIMITED_TREE_DEPTH when you want the tree to
include all files/folder until the bottom of the folder hierarchy (required)InvalidContextException - if the context is invalidXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic Tree findTree(Context context, CachingOptions cachingOptions, String url, int depth, ItemFilter filter, ItemProcessor processor) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItems when they're files and as Trees when they're folders.findTree in interface ContentStoreServicecontext - the context to the content store (required)cachingOptions - the caching options for any caching operation done inside this service call (optional)url - the url of the folder (required)depth - the number of levels the tree should have. Use #UNLIMITED_TREE_DEPTH when you want the
tree to include all files/folder until the bottom of the folder hierarchy (required)filter - an ItemFilter to filter out undesired items in the tree (optional, can be null)processor - additional ItemProcessor for the tree's items (optional, can be null)InvalidContextException - if the context is invalidXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic Tree getTree(Context context, String url) throws InvalidContextException, PathNotFoundException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItems when they're
files and as Trees when they're folders. The tree depth is ContentStoreService.UNLIMITED_TREE_DEPTH.getTree in interface ContentStoreServicecontext - the context to the content store (required)url - the url of the folder (required)InvalidContextException - if the context is invalidPathNotFoundException - if the folder the url points to can't be foundXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic Tree getTree(Context context, String url, int depth) throws InvalidContextException, PathNotFoundException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItems when they're
files and as Trees when they're folders.getTree in interface ContentStoreServicecontext - the context to the content store (required)url - the url of the folder (required)depth - the number of levels the tree should have. Use #UNLIMITED_TREE_DEPTH when you want the tree to
include all files/folder until the bottom of the folder hierarchy (required)InvalidContextException - if the context is invalidPathNotFoundException - if the folder the url points to can't be foundXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storepublic Tree getTree(Context context, CachingOptions cachingOptions, String url, int depth, ItemFilter filter, ItemProcessor processor) throws InvalidContextException, PathNotFoundException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
ContentStoreServiceItems when they're
files and as Trees when they're folders.getTree in interface ContentStoreServicecontext - the context to the content store (required)cachingOptions - the caching options for any caching operation done inside this service call (optional)url - the url of the folder (required)depth - the number of levels the tree should have. Use #UNLIMITED_TREE_DEPTH when you want the
tree to include all files/folder until the bottom of the folder hierarchy (required)filter - an ItemFilter to filter out undesired items in the tree (optional, can be null)processor - additional ItemProcessor for the tree's items (optional, can be null)InvalidContextException - if the context is invalidPathNotFoundException - if the folder the url points to can't be foundXmlFileParseException - if there was an error while parsing a children's XML descriptorXmlMergeException - if there was an error while attempting to do a merge of XML descriptorsItemProcessingException - if there was an error while processing an itemStoreException - if an error occurred while accessing the content storeprotected abstract Item doFindItem(Context context, CachingOptions cachingOptions, String url, ItemProcessor processor) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
protected abstract List<Item> doFindChildren(Context context, CachingOptions cachingOptions, String url, ItemFilter filter, ItemProcessor processor) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
protected abstract Tree doFindTree(Context context, CachingOptions cachingOptions, String url, int depth, ItemFilter filter, ItemProcessor processor) throws InvalidContextException, XmlFileParseException, XmlMergeException, ItemProcessingException, StoreException
Copyright © 2018 CrafterCMS. All rights reserved.