Class CmsContainerConfigurationCache
java.lang.Object
org.opencms.ade.containerpage.inherited.CmsContainerConfigurationCache
- All Implemented Interfaces:
I_CmsGlobalConfigurationCache
A cache class for storing inherited container configurations.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The standard file name for inherited container configurations.static final org.apache.commons.logging.Log
The logger instance for this class.protected boolean
A flag which indicates whether this cache is initialized.static final CmsUUID
UUID used to signal a cache clear.static final long
Interval used to check for changes. -
Constructor Summary
ConstructorDescriptionCmsContainerConfigurationCache
(CmsObject cms, String name) Creates a new cache instance for inherited containers. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the cache.void
Processes all enqueued inheritance container updates.protected String
getBasePath
(String rootPath) Returns the base path for a given configuration file.protected String
getCacheKey
(String basePath) Gets the cache key for a given base path.getState()
Gets the current cache contents.void
Initializes the cache.protected boolean
isContainerConfiguration
(String rootPath, int type) Checks whether a given combination of path and resource type belongs to an inherited container configuration file.protected Map<CmsUUID,
CmsContainerConfigurationGroup> load
(Collection<CmsResource> resources) Loads the inheritance groups from a list of resources.protected Map<CmsUUID,
CmsContainerConfigurationGroup> loadFromIds
(Collection<CmsUUID> structureIds) Loads the inheritance groups from the resources with structure ids from the given list.void
remove
(CmsPublishedResource resource) Removes a published resource from the cache.void
remove
(CmsResource resource) Removes a resource from the cache.protected void
Removes a resource from the cache.void
update
(CmsPublishedResource resource) Updates the cache entry for the given published resource.void
update
(CmsResource resource) Updates the cache entry for the given resource.protected void
update
(CmsUUID structureId, String rootPath, int type, CmsResourceState state) Updates a resource in the cache.
-
Field Details
-
UPDATE_INTERVAL_MILLIS
Interval used to check for changes.- See Also:
-
INHERITANCE_CONFIG_FILE_NAME
The standard file name for inherited container configurations.- See Also:
-
UPDATE_ALL
UUID used to signal a cache clear. -
LOG
The logger instance for this class. -
m_initialized
A flag which indicates whether this cache is initialized.
-
-
Constructor Details
-
CmsContainerConfigurationCache
Creates a new cache instance for inherited containers.- Parameters:
cms
- the CMS context to use for VFS operations.name
- the name of the cache, for debugging/testing purposes- Throws:
CmsException
- if something goes wrong
-
-
Method Details
-
clear
Description copied from interface:I_CmsGlobalConfigurationCache
Clears the cache.- Specified by:
clear
in interfaceI_CmsGlobalConfigurationCache
- See Also:
-
flushUpdates
Processes all enqueued inheritance container updates. -
getState
Gets the current cache contents.- Returns:
- the cache contents
-
initialize
Initializes the cache. -
remove
Description copied from interface:I_CmsGlobalConfigurationCache
Removes a published resource from the cache.- Specified by:
remove
in interfaceI_CmsGlobalConfigurationCache
- Parameters:
resource
- the published resource- See Also:
-
remove
Description copied from interface:I_CmsGlobalConfigurationCache
Removes a resource from the cache.- Specified by:
remove
in interfaceI_CmsGlobalConfigurationCache
- Parameters:
resource
- the resource to remove- See Also:
-
update
Description copied from interface:I_CmsGlobalConfigurationCache
Updates the cache entry for the given published resource.NOTE: Cache implementations should not directly read the updated resource in this method because it might interfere with other caches. Instead, the resource should be marked as updated and read the next time the cache is queried.
- Specified by:
update
in interfaceI_CmsGlobalConfigurationCache
- Parameters:
resource
- a published resource- See Also:
-
update
Description copied from interface:I_CmsGlobalConfigurationCache
Updates the cache entry for the given resource.NOTE: Cache implementations should not directly read the updated resource in this method because it might interfere with other caches. Instead, the resource should be marked as updated and read the next time the cache is queried.
- Specified by:
update
in interfaceI_CmsGlobalConfigurationCache
- Parameters:
resource
- the resource for which the cache entry should be updated- See Also:
-
getBasePath
Returns the base path for a given configuration file. E.g. the result for the input '/sites/default/.container-config' will be '/sites/default'.- Parameters:
rootPath
- the root path of the configuration file- Returns:
- the base path for the configuration file
-
getCacheKey
Gets the cache key for a given base path.- Parameters:
basePath
- the base path- Returns:
- the cache key for the base path
-
isContainerConfiguration
Checks whether a given combination of path and resource type belongs to an inherited container configuration file.- Parameters:
rootPath
- the root path of the resourcetype
- the type id of the resource- Returns:
- true if the given root path / type combination matches an inherited container configuration file
-
load
Loads the inheritance groups from a list of resources.If the configuration for a given resource can't be read, the corresponding map entry will be null in the result.
- Parameters:
resources
- the resources- Returns:
- the inheritance group configurations, with structure ids of the corresponding resources as keys
-
loadFromIds
Loads the inheritance groups from the resources with structure ids from the given list.If the configuration for a given id can't be read, the corresponding map entry will be null in the result.
- Parameters:
structureIds
- the structure ids- Returns:
- the inheritance group configurations, with structure ids of the corresponding resources as keys
-
remove
Removes a resource from the cache.- Parameters:
structureId
- the structure id of the resourcerootPath
- the root path of the resourcetype
- the resource type
-
update
Updates a resource in the cache.- Parameters:
structureId
- the structure id of the resourcerootPath
- the root path of the resourcetype
- the resource typestate
- the resource state
-