Class CmsFolderSizeTracker

java.lang.Object
org.opencms.file.quota.CmsFolderSizeTracker

public class CmsFolderSizeTracker extends Object
Maintains folder size information for the system and updates it regularly.

The folder size information is updated asynchronously and with a delay, so it is not necessarily 100% exact at any particular time.

  • Field Details

  • Constructor Details

    • CmsFolderSizeTracker

      public CmsFolderSizeTracker(CmsObject cms, boolean online)
      Creates a new instance.
      Parameters:
      cms - the CMS context
      true - if we want to track folder sizes in the Online project instead of the Offline project
  • Method Details

    • getFolderReport

      Prepares a folder report consisting of subtree sizes for a bunch of folders.

      This is more efficient than querying for folder sizes individually.

      Parameters:
      folders - the folders (list of root paths)
      Returns:
      the folder report
    • getTimerInterval

      public long getTimerInterval()
      Gets the timer interval.
      Returns:
      the timer interval
    • getTotalFolderSize

      public long getTotalFolderSize(String rootPath)
      Gets the total folder size for the complete subtree at the given root path.
      Parameters:
      rootPath - the root path for which to compute the size
      Returns:
      the total size
    • getTotalFolderSizeExclusive

      public long getTotalFolderSizeExclusive(String rootPath, Collection<String> otherPaths)
      Gets the folder size for the subtree at the given root path, but without including any folder sizes of subtrees at any paths from 'otherPaths' of which rootPath is a proper prefix.
      Parameters:
      rootPath - the root path for which to calculate the size
      otherPaths - the other paths to exclude from the size
      Returns:
      the total size
    • initialize

      Initializes this object (and then returns it).
      Returns:
      this instance
    • processUpdates

      public void processUpdates()
      The scheduled task.
    • refresh

      public void refresh(String rootPath)
      Refreshes the data for a particular subtree.
      Parameters:
      rootPath - the root path to refresh the data for
    • reload

      public void reload()
      Reloads the complete folder size information (this is expensive!).