Package org.opencms.flex
Class CmsFlexBucketConfiguration
java.lang.Object
org.opencms.flex.CmsFlexBucketConfiguration
Represents a Flex bucket configuration.
This consists of a list of flex bucket definitions, and a 'clear all' list.
Each flex bucket definition consists of a name and a list of paths. If any resources from the given list of paths or their descendants is published, the corresponding Flex bucket's contents should be removed from the Flex cache. If a resource with its path below one of the paths from the 'clear all' list is published, the complete Flex cache should be cleared.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
A data structure representing a set of Flex cache buckets. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Special bucket name for everything that doesn't belong in any other bucket.static final String
Configuration key for the list of folders for which the whole flex cache should be purged when a resource in them is published.static final String
The configuration key prefix used to define a bucket. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a flex bucket definition, consisting of a flex bucket name and a list of paths.void
freeze()
Freeze the bucket configuration, i.e.getBucketName
(int bitIndex) Gets the bucket name for the given bit index.getBucketSet
(Iterable<String> paths) Computes the bucket set for a set of paths based on this configuration.static CmsFlexBucketConfiguration
loadFromProperties
(Properties properties) Loads the flex bucket configuration from a java.util.Properties instance.static CmsFlexBucketConfiguration
loadFromVfsFile
(CmsObject cms, String path) Loads a flex bucket configuration from the OpenCms VFS.void
setClearAll
(List<String> clearAll) Sets the 'clear all' list, a list of paths for which the complete Flex cache should be cleared if any resource below them is published.boolean
shouldClearAll
(List<CmsPublishedResource> publishedResources) Returns true if for the given publish list, the complete Flex cache should be cleared based on this configuration.
-
Field Details
-
BUCKET_OTHER
Special bucket name for everything that doesn't belong in any other bucket.- See Also:
-
KEY_CLEAR_ALL
Configuration key for the list of folders for which the whole flex cache should be purged when a resource in them is published.- See Also:
-
KEY_PREFIX_BUCKET
The configuration key prefix used to define a bucket.- See Also:
-
-
Constructor Details
-
CmsFlexBucketConfiguration
public CmsFlexBucketConfiguration()
-
-
Method Details
-
loadFromProperties
Loads the flex bucket configuration from a java.util.Properties instance.- Parameters:
properties
- the properties from which to load the configuration- Returns:
- the configuration
-
loadFromVfsFile
public static CmsFlexBucketConfiguration loadFromVfsFile(CmsObject cms, String path) throws CmsException Loads a flex bucket configuration from the OpenCms VFS.- Parameters:
cms
- the CMS context to use for VFS operationspath
- the path of the resource- Returns:
- the flex bucket configuration
- Throws:
CmsException
- if something goes wrong
-
add
Adds a flex bucket definition, consisting of a flex bucket name and a list of paths.- Parameters:
key
- the flex bucket namevalues
- the flex bucket paths
-
freeze
Freeze the bucket configuration, i.e. make it non-modifiable. -
getBucketName
Gets the bucket name for the given bit index.- Parameters:
bitIndex
- the bit index for the bucket in the bit set representation.- Returns:
- the name of the bucket
-
getBucketSet
Computes the bucket set for a set of paths based on this configuration.The resulting bucket set contains all buckets for which one of the given paths is below the configured roots of that bucket.
- Parameters:
paths
- a list of root paths- Returns:
- the bucket set for the input paths
-
setClearAll
Sets the 'clear all' list, a list of paths for which the complete Flex cache should be cleared if any resource below them is published.- Parameters:
clearAll
- a list of paths
-
shouldClearAll
Returns true if for the given publish list, the complete Flex cache should be cleared based on this configuration.- Parameters:
publishedResources
- a publish list- Returns:
- true if the complete Flex cache should be cleared
-