Package org.opencms.file.quota
Class CmsFolderSizeTracker
java.lang.Object
org.opencms.file.quota.CmsFolderSizeTracker
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Default interval for the update timer (in ms). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFolderReport
(Collection<String> folders) Prepares a folder report consisting of subtree sizes for a bunch of folders.long
Gets the timer interval.long
getTotalFolderSize
(String rootPath) Gets the total folder size for the complete subtree at the given root path.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.Initializes this object (and then returns it).void
The scheduled task.void
Refreshes the data for a particular subtree.void
reload()
Reloads the complete folder size information (this is expensive!).
-
Field Details
-
DEFAULT_TIMER_INTERVAL
Default interval for the update timer (in ms).- See Also:
-
-
Constructor Details
-
CmsFolderSizeTracker
Creates a new instance.- Parameters:
cms
- the CMS contexttrue
- 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
Gets the timer interval.- Returns:
- the timer interval
-
getTotalFolderSize
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
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 sizeotherPaths
- the other paths to exclude from the size- Returns:
- the total size
-
initialize
Initializes this object (and then returns it).- Returns:
- this instance
-
processUpdates
The scheduled task. -
refresh
Refreshes the data for a particular subtree.- Parameters:
rootPath
- the root path to refresh the data for
-
reload
Reloads the complete folder size information (this is expensive!).
-