Class CmsFlexBucketConfiguration

java.lang.Object
org.opencms.flex.CmsFlexBucketConfiguration

public class CmsFlexBucketConfiguration extends Object
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.

  • Field Details

  • Constructor Details

  • 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

      Loads a flex bucket configuration from the OpenCms VFS.

      Parameters:
      cms - the CMS context to use for VFS operations
      path - the path of the resource
      Returns:
      the flex bucket configuration
      Throws:
      CmsException - if something goes wrong
    • add

      public void add(String key, List<String> values)
      Adds a flex bucket definition, consisting of a flex bucket name and a list of paths.

      Parameters:
      key - the flex bucket name
      values - the flex bucket paths
    • freeze

      public void freeze()
      Freeze the bucket configuration, i.e. make it non-modifiable.

    • getBucketName

      public String getBucketName(int bitIndex)
      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

      public 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.

      Parameters:
      clearAll - a list of paths
    • shouldClearAll

      public boolean shouldClearAll(List<CmsPublishedResource> publishedResources)
      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