public class BlogCacheManager extends AbstractLogEnabled implements Component, Serviceable, Initializable
| Modifier and Type | Class and Description |
|---|---|
protected class |
BlogCacheManager.AllPostCache
Cache of all the posts.
|
protected class |
BlogCacheManager.FuturePostCache
Cache of identifier of the future posts.
|
class |
BlogCacheManager.Post
Class representing a Post in the cache.
|
protected class |
BlogCacheManager.PostDateCache
Post cache by date.
|
protected class |
BlogCacheManager.PostSiteLang
A Post with site name and language.
|
protected class |
BlogCacheManager.PostTagCache
Post cache by tag.
|
class |
BlogCacheManager.ReverseDatePostComparator
Reverse date post comparator.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Map<String,Map<String,BlogCacheManager.AllPostCache>>> |
_allPosts
Map of PostDateCache by workspace, site and sitemap/language.
|
protected AmetysObjectResolver |
_ametysResolver
The ametys object resolver.
|
protected BlogPageHandler |
_blogRootHandler
The blog root page handler.
|
protected Map<String,Map<String,Map<String,BlogCacheManager.FuturePostCache>>> |
_futurePostsCache
Map of FuturePostCache by workspace, site and sitemap/language.
|
protected Map<String,Map<String,Map<String,Boolean>>> |
_initialized
Caches are initialized by workspace, site and sitemap/language.
|
protected Map<String,Map<String,Map<String,Date>>> |
_lastUpdateFuturePosts
Future caches are updated by workspace, site and sitemap/language.
|
protected ObservationManager |
_observationManager
The observation manager
|
protected Map<String,Map<String,Map<String,BlogCacheManager.PostDateCache>>> |
_postsByDate
Map of PostDateCache by workspace, site and sitemap/language.
|
protected Map<String,Map<String,Map<String,BlogCacheManager.PostTagCache>>> |
_postsByTag
Map of PostTagCache by workspace, site and sitemap/language.
|
protected AmetysObjectResolver |
_resolver
The Ametys resolver
|
protected SiteConfigurationExtensionPoint |
_siteConf
The site configuration extension point
|
protected SiteManager |
_siteManager
The Site manager.
|
protected TagProviderExtensionPoint |
_tagProviderEP
Th tag provider
|
protected WorkspaceSelector |
_workspaceSelector
The workspace selector.
|
static String |
POST_DATE_ATTRIBUTE
The name of the date attribute of post
|
static String |
POST_TAGS_ATTRIBUTE
The name of the tags attribute of post
|
static String |
ROLE
The avalon role.
|
| Constructor and Description |
|---|
BlogCacheManager() |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
_getDisplayFuturePost(String siteName) |
private Date |
_getOrCreateLastUpdateFuturePosts(String workspaceName,
String siteName,
String language) |
private boolean |
_isFuturePost(Content post) |
private boolean |
_needUpdateFuturePosts(String workspaceName,
String siteName,
String language,
Date roundedNow) |
private void |
_updateFuturePosts(String workspaceName,
String siteName,
String language) |
void |
addPost(String siteName,
String language,
Content postContent)
Add a post content to the cache.
|
void |
clearCaches()
Clear the caches.
|
void |
clearCaches(String siteName,
String language)
Clear the caches for a given siteName and language.
|
protected void |
dispatchPost(BlogCacheManager.AllPostCache cache,
BlogCacheManager.Post post)
Dispatch a post in the post cache.
|
protected void |
dispatchPost(BlogCacheManager.AllPostCache cache,
Content content)
Dispatch a post content in the post cache.
|
protected void |
dispatchPost(BlogCacheManager.FuturePostCache cache,
Content content)
Dispatch a post content in the future post cache.
|
protected void |
dispatchPost(BlogCacheManager.PostDateCache dateCache,
BlogCacheManager.Post post)
Add a post in the post date cache.
|
protected void |
dispatchPost(BlogCacheManager.PostDateCache dateCache,
Content content)
Dispatch a post content in the post date cache.
|
protected void |
dispatchPost(BlogCacheManager.PostTagCache tagCache,
BlogCacheManager.Post post)
Dispatch a post in the post tag cache.
|
protected void |
dispatchPost(BlogCacheManager.PostTagCache tagCache,
Content content)
Dispatch a post content in the post tag cache.
|
protected BlogCacheManager.AllPostCache |
getAllPostCache(String siteName,
String language)
Get the exhaustive post cache.
|
protected BlogCacheManager.PostSiteLang |
getFuturePost(String siteName,
String postId)
Get a future post by its site name and id.
|
protected BlogCacheManager.FuturePostCache |
getFuturePostCache(String siteName,
String language)
Get the future post cache.
|
Set<Integer> |
getMonths(String siteName,
String language,
int year)
Get the months with posts for a specified year.
|
protected BlogCacheManager.AllPostCache |
getOrCreateAllPostCache(String workspaceName,
String siteName,
String language)
Get the exhaustive post cache.
|
protected BlogCacheManager.FuturePostCache |
getOrCreateFuturePostCache(String workspaceName,
String siteName,
String language)
Get the future post cache.
|
protected BlogCacheManager.PostDateCache |
getOrCreatePostDateCache(String workspaceName,
String siteName,
String language)
Get the post date cache.
|
protected BlogCacheManager.PostTagCache |
getOrCreatePostTagCache(String workspaceName,
String siteName,
String language)
Get the post tag cache.
|
protected BlogCacheManager.PostSiteLang |
getPost(String siteName,
String postId)
Get a post by its site name and id.
|
BlogCacheManager.Post |
getPost(String siteName,
String language,
String id)
Test if a post exists, provided its ID.
|
BlogCacheManager.Post |
getPost(String siteName,
String language,
String tagName,
String id)
Get the posts for a year-month couple.
|
BlogCacheManager.Post |
getPostByName(String siteName,
String language,
int year,
int month,
String name)
Get the posts for a year-month couple.
|
BlogCacheManager.Post |
getPostByName(String siteName,
String language,
String name)
Test if a post exists, provided its content name.
|
BlogCacheManager.Post |
getPostByName(String siteName,
String language,
String tagName,
String name)
Get the posts for a year-month couple.
|
protected BlogCacheManager.PostDateCache |
getPostDateCache(String siteName,
String language)
Get the post date cache.
|
Set<String> |
getPostIds(String siteName,
String language)
Get a list of all the posts' IDs.
|
Map<String,BlogCacheManager.Post> |
getPosts(String siteName,
String language)
Get the exhaustive list of Posts.
|
Map<String,BlogCacheManager.Post> |
getPostsByMonth(String siteName,
String language,
int year,
int month)
Get the posts for a year-month couple.
|
Map<String,BlogCacheManager.Post> |
getPostsByTag(String siteName,
String language,
String tagName)
Get the posts for a given tag.
|
Map<String,BlogCacheManager.Post> |
getPostsByYear(String siteName,
String language,
int year)
Get the posts for a year.
|
protected BlogCacheManager.PostTagCache |
getPostTagCache(String siteName,
String language)
Get the post tag cache.
|
Collection<BlogCacheManager.Post> |
getSortedPosts(String siteName,
String language)
Get the exhaustive list of Posts.
|
Collection<BlogCacheManager.Post> |
getSortedPostsByMonth(String siteName,
String language,
int year,
int month)
Get the posts for a year-month couple.
|
Collection<BlogCacheManager.Post> |
getSortedPostsByTag(String siteName,
String language,
String tagName)
Get the posts for a given tag.
|
Collection<BlogCacheManager.Post> |
getSortedPostsByTag(String siteName,
String language,
String tagName,
boolean deepSearch)
Get the posts for a given tag.
|
Collection<BlogCacheManager.Post> |
getSortedPostsByYear(String siteName,
String language,
int year)
Get the posts for a year.
|
Set<String> |
getTags(String siteName,
String language)
Get the tags for a site and language.
|
Set<Integer> |
getYears(String siteName,
String language)
Get the years with posts.
|
boolean |
hasMonth(String siteName,
String language,
int year,
int month)
Get the years with posts.
|
boolean |
hasPost(String siteName,
String language,
int year,
int month,
String id)
Get the posts for a year-month couple.
|
boolean |
hasPost(String siteName,
String language,
String id)
Test if a post exists, provided its ID.
|
boolean |
hasPost(String siteName,
String language,
String tagName,
String id)
Get the posts for a year-month couple.
|
boolean |
hasPostByName(String siteName,
String language,
int year,
int month,
String name)
Get the posts for a year-month couple.
|
boolean |
hasPostByName(String siteName,
String language,
String name)
Test if a post exists, provided its content name.
|
boolean |
hasPostByName(String siteName,
String language,
String tagName,
String name)
Get the posts for a year-month couple.
|
boolean |
hasPostByTag(String siteName,
String language,
String tagName,
String postId)
Test if a given post has a tag, by its ID.
|
boolean |
hasTag(String siteName,
String language,
String tagName)
Test if a tag exists in the given site and language.
|
boolean |
hasYear(String siteName,
String language,
int year)
Get the years with posts.
|
void |
initialize() |
protected void |
initializeCaches(String workspaceName,
String siteName,
String language)
Initialize all the caches.
|
protected boolean |
isInitialized(String workspaceName,
String siteName,
String language)
Get the exhaustive post cache.
|
protected void |
modifyPost(BlogCacheManager.AllPostCache cache,
BlogCacheManager.Post post,
Content postContent)
Modify a post content.
|
protected void |
modifyPost(BlogCacheManager.FuturePostCache cache,
BlogCacheManager.Post post,
Content postContent)
Modify a future post content.
|
protected void |
modifyPost(BlogCacheManager.PostDateCache dateCache,
BlogCacheManager.Post post,
Content postContent)
Remove a post content.
|
protected void |
modifyPost(BlogCacheManager.PostTagCache cache,
BlogCacheManager.Post post,
Content postContent)
Remove a post content.
|
void |
modifyPost(String siteName,
String language,
Content postContent)
Modify a post content in the cache.
|
protected void |
removePost(BlogCacheManager.AllPostCache cache,
BlogCacheManager.Post post)
Remove a post content.
|
protected void |
removePost(BlogCacheManager.AllPostCache cache,
Content content)
Remove a post content.
|
protected void |
removePost(BlogCacheManager.FuturePostCache cache,
BlogCacheManager.Post post)
Remove a future post content.
|
protected void |
removePost(BlogCacheManager.FuturePostCache cache,
Content content)
Remove a future post content.
|
protected void |
removePost(BlogCacheManager.PostDateCache dateCache,
BlogCacheManager.Post post)
Remove a post content.
|
protected void |
removePost(BlogCacheManager.PostDateCache dateCache,
Content content)
Remove a post content.
|
protected void |
removePost(BlogCacheManager.PostTagCache cache,
BlogCacheManager.Post post)
Remove a post content.
|
protected void |
removePost(BlogCacheManager.PostTagCache cache,
Content content)
Remove a post content.
|
void |
removePost(String siteName,
String language,
Content postContent)
Remove a post content from the cache.
|
void |
removePostById(String siteName,
String postId)
Remove a post content from the cache.
|
void |
service(ServiceManager serviceManager) |
protected void |
setInitialized(String siteName,
String language)
Set the initialized map
|
protected void |
setInitialized(String siteName,
String language,
Boolean initialized)
Set the initialized map
|
protected void |
setInitialized(String workspaceName,
String siteName,
String language,
Boolean initialized)
Set the initialized map
|
void |
validatePost(String siteName,
String language,
Content postContent)
Validate a post content.
|
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerpublic static final String POST_DATE_ATTRIBUTE
public static final String POST_TAGS_ATTRIBUTE
protected AmetysObjectResolver _ametysResolver
protected TagProviderExtensionPoint _tagProviderEP
protected SiteManager _siteManager
protected SiteConfigurationExtensionPoint _siteConf
protected BlogPageHandler _blogRootHandler
protected WorkspaceSelector _workspaceSelector
protected AmetysObjectResolver _resolver
protected ObservationManager _observationManager
protected Map<String,Map<String,Map<String,BlogCacheManager.PostDateCache>>> _postsByDate
protected Map<String,Map<String,Map<String,BlogCacheManager.PostTagCache>>> _postsByTag
protected Map<String,Map<String,Map<String,BlogCacheManager.AllPostCache>>> _allPosts
protected Map<String,Map<String,Map<String,BlogCacheManager.FuturePostCache>>> _futurePostsCache
protected Map<String,Map<String,Map<String,Boolean>>> _initialized
public BlogCacheManager()
public void service(ServiceManager serviceManager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void initialize() throws Exception
initialize in interface InitializableExceptionpublic boolean hasYear(String siteName, String language, int year)
siteName - the site name.language - the language.year - the yearpublic Set<Integer> getYears(String siteName, String language)
siteName - the site name.language - the language.public boolean hasMonth(String siteName, String language, int year, int month)
siteName - the site name.language - the language.year - the yearmonth - the monthpublic Set<Integer> getMonths(String siteName, String language, int year)
siteName - the site name.language - the language.year - the year.public Map<String,BlogCacheManager.Post> getPostsByMonth(String siteName, String language, int year, int month)
siteName - the site name.language - the language.year - the year.month - the month.public Collection<BlogCacheManager.Post> getSortedPostsByMonth(String siteName, String language, int year, int month)
siteName - the site name.language - the language.year - the year.month - the month.public Map<String,BlogCacheManager.Post> getPostsByYear(String siteName, String language, int year)
siteName - the site name.language - the language.year - the year.public Collection<BlogCacheManager.Post> getSortedPostsByYear(String siteName, String language, int year)
siteName - the site name.language - the language.year - the year.public BlogCacheManager.Post getPostByName(String siteName, String language, int year, int month, String name)
siteName - the site name.language - the language.year - the year.month - the month.name - the namepublic boolean hasPost(String siteName, String language, int year, int month, String id)
siteName - the site name.language - the language.year - the year.month - the month.id - the id of postpublic boolean hasPostByName(String siteName, String language, int year, int month, String name)
siteName - the site name.language - the language.year - the year.month - the month.name - the name of postpublic Set<String> getTags(String siteName, String language)
siteName - The site namelanguage - The languagepublic boolean hasTag(String siteName, String language, String tagName)
siteName - The site namelanguage - The languagetagName - The tag namepublic Map<String,BlogCacheManager.Post> getPostsByTag(String siteName, String language, String tagName)
siteName - The site namelanguage - The languagetagName - The tag namepublic Collection<BlogCacheManager.Post> getSortedPostsByTag(String siteName, String language, String tagName)
siteName - The site namelanguage - The languagetagName - The tag namepublic Collection<BlogCacheManager.Post> getSortedPostsByTag(String siteName, String language, String tagName, boolean deepSearch)
siteName - The site namelanguage - the languagetagName - the tag namedeepSearch - true to perform deep searchpublic boolean hasPostByTag(String siteName, String language, String tagName, String postId)
siteName - The site namelanguage - The languagetagName - The tag namepostId - The id of postpublic BlogCacheManager.Post getPost(String siteName, String language, String tagName, String id)
siteName - The site namelanguage - The languagetagName - The tag nameid - The id of postpublic BlogCacheManager.Post getPostByName(String siteName, String language, String tagName, String name)
siteName - The site namelanguage - The languagetagName - The tag namename - the name of postpublic boolean hasPost(String siteName, String language, String tagName, String id)
siteName - The site namelanguage - The languagetagName - The tag nameid - The id of postpublic boolean hasPostByName(String siteName, String language, String tagName, String name)
siteName - The site namelanguage - The languagetagName - The tag namename - the name of postpublic Set<String> getPostIds(String siteName, String language)
siteName - the site name.language - the language.public Map<String,BlogCacheManager.Post> getPosts(String siteName, String language)
siteName - the site name.language - the language.public Collection<BlogCacheManager.Post> getSortedPosts(String siteName, String language)
siteName - the site name.language - the language.public BlogCacheManager.Post getPost(String siteName, String language, String id)
id - the post content ID.siteName - the site name.language - the language.public BlogCacheManager.Post getPostByName(String siteName, String language, String name)
name - the post content name.siteName - the site name.language - the language.public boolean hasPost(String siteName, String language, String id)
id - the post content ID.siteName - the site name.language - the language.public boolean hasPostByName(String siteName, String language, String name)
name - the post content name.siteName - the site name.language - the language.public void addPost(String siteName, String language, Content postContent)
siteName - The site namelanguage - The languagepostContent - The contentpublic void modifyPost(String siteName, String language, Content postContent)
siteName - The site namelanguage - The languagepostContent - The contentpublic void validatePost(String siteName, String language, Content postContent)
siteName - The site namelanguage - The languagepostContent - The contentpublic void removePost(String siteName, String language, Content postContent)
siteName - The site namelanguage - The languagepostContent - The contentpublic void removePostById(String siteName, String postId)
siteName - the site name.postId - the post ID.public void clearCaches()
public void clearCaches(String siteName, String language)
siteName - The site namelanguage - The languageprotected BlogCacheManager.PostDateCache getPostDateCache(String siteName, String language)
siteName - The site namelanguage - The languageprotected BlogCacheManager.PostDateCache getOrCreatePostDateCache(String workspaceName, String siteName, String language)
workspaceName - The workspacesiteName - The site namelanguage - The languageprotected BlogCacheManager.PostTagCache getPostTagCache(String siteName, String language)
siteName - The site namelanguage - The languageprotected BlogCacheManager.PostTagCache getOrCreatePostTagCache(String workspaceName, String siteName, String language)
workspaceName - The workspacesiteName - The site namelanguage - The languageprotected BlogCacheManager.AllPostCache getAllPostCache(String siteName, String language)
siteName - The site namelanguage - The languageprotected BlogCacheManager.AllPostCache getOrCreateAllPostCache(String workspaceName, String siteName, String language)
workspaceName - The workspace namesiteName - The site namelanguage - The languageprotected BlogCacheManager.FuturePostCache getFuturePostCache(String siteName, String language)
siteName - the name of the sitelanguage - the languageprotected BlogCacheManager.FuturePostCache getOrCreateFuturePostCache(String workspaceName, String siteName, String language)
workspaceName - the name of the workspacesiteName - the name of the sitelanguage - the languageprotected boolean isInitialized(String workspaceName, String siteName, String language)
workspaceName - The workspace namesiteName - The site namelanguage - The languageprotected void setInitialized(String siteName, String language)
siteName - The site namelanguage - The languageprotected void setInitialized(String siteName, String language, Boolean initialized)
siteName - The site namelanguage - The languageinitialized - true to set initializedprotected void setInitialized(String workspaceName, String siteName, String language, Boolean initialized)
workspaceName - The workspace namesiteName - The site namelanguage - The languageinitialized - true if to set initializedprotected void initializeCaches(String workspaceName, String siteName, String language)
workspaceName - The workspace namesiteName - The site namelanguage - The languageprivate boolean _getDisplayFuturePost(String siteName)
private void _updateFuturePosts(String workspaceName, String siteName, String language)
private boolean _needUpdateFuturePosts(String workspaceName, String siteName, String language, Date roundedNow)
private Date _getOrCreateLastUpdateFuturePosts(String workspaceName, String siteName, String language)
private boolean _isFuturePost(Content post)
protected BlogCacheManager.PostSiteLang getPost(String siteName, String postId)
siteName - the site name.postId - the post ID.protected BlogCacheManager.PostSiteLang getFuturePost(String siteName, String postId)
siteName - the site name.postId - the post ID.protected void dispatchPost(BlogCacheManager.PostDateCache dateCache, Content content)
dateCache - the post date cache.content - the Post content.protected void dispatchPost(BlogCacheManager.PostDateCache dateCache, BlogCacheManager.Post post)
dateCache - the post date cache.post - the Post to add.protected void dispatchPost(BlogCacheManager.PostTagCache tagCache, Content content)
tagCache - the post tag cache.content - the Post content.protected void dispatchPost(BlogCacheManager.PostTagCache tagCache, BlogCacheManager.Post post)
tagCache - the post tag cache.post - the Post to add.protected void dispatchPost(BlogCacheManager.AllPostCache cache, Content content)
cache - the post cache.content - the Post content.protected void dispatchPost(BlogCacheManager.AllPostCache cache, BlogCacheManager.Post post)
cache - the post cache.post - the Post content.protected void dispatchPost(BlogCacheManager.FuturePostCache cache, Content content)
cache - the future post cache.content - the Post content.protected void removePost(BlogCacheManager.PostDateCache dateCache, Content content)
dateCache - the post date cache.content - the Post content.protected void removePost(BlogCacheManager.PostDateCache dateCache, BlogCacheManager.Post post)
dateCache - the post date cache.post - the Post object to remove.protected void removePost(BlogCacheManager.PostTagCache cache, Content content)
cache - the post tag cache.content - the Post content.protected void removePost(BlogCacheManager.PostTagCache cache, BlogCacheManager.Post post)
cache - the post tag cache.post - the Post to remove.protected void removePost(BlogCacheManager.AllPostCache cache, Content content)
cache - the post cache.content - the Post content.protected void removePost(BlogCacheManager.AllPostCache cache, BlogCacheManager.Post post)
cache - the post cache.post - the Post to remove.protected void removePost(BlogCacheManager.FuturePostCache cache, Content content)
cache - the future post cache.content - the Post content to remove.protected void removePost(BlogCacheManager.FuturePostCache cache, BlogCacheManager.Post post)
cache - the future post cache.post - the Post to remove.protected void modifyPost(BlogCacheManager.PostDateCache dateCache, BlogCacheManager.Post post, Content postContent)
dateCache - the post date cache.post - the post contentpostContent - the post Content.protected void modifyPost(BlogCacheManager.PostTagCache cache, BlogCacheManager.Post post, Content postContent)
cache - the post tag cache.post - the post contentpostContent - the post Content.protected void modifyPost(BlogCacheManager.AllPostCache cache, BlogCacheManager.Post post, Content postContent)
cache - the post cache.post - the post contentpostContent - the post Content.protected void modifyPost(BlogCacheManager.FuturePostCache cache, BlogCacheManager.Post post, Content postContent)
cache - the post cache.post - the postpostContent - the post Content.