Package net.sf.basedb.core
Class DiskUsageStatistics
- java.lang.Object
-
- net.sf.basedb.core.DiskUsageStatistics
-
public class DiskUsageStatistics extends Object
Get disk usage statistics for the BASE server. The statistics information is lazily loaded and internally cached. Ie. callinggetSummary(User)
only hits the database the first time the method is called for a user. Use thereset()
method to clear the internal cache.You can control how long summaries are cached by setting a maximum age with the
setMaxAge(int)
method.- Version:
- 2.2
- Author:
- nicklas
- See Also:
DiskUsage.getStatistics(DbControl)
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
DiskUsageStatistics.Summary
Holds summary disk usage information for the total disk usage or for a specific user or group.
-
Constructor Summary
Constructors Constructor Description DiskUsageStatistics(DbControl dc)
Create a new disk usage statistics object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMaxAge()
Get the max age in seconds for a disk usage summary object before it is reloaded from the database again.List<QuotaType>
getQuotaTypes()
Get the list of quota types that are registered forDiskConsumable
items.DiskUsageStatistics.Summary
getSummary(Group group)
Get a summary of the disk usage for the specified group.DiskUsageStatistics.Summary
getSummary(User user)
Get a summary of the disk usage for the specified user.DiskUsageStatistics.Summary
getTotalSummary()
Get a summary of the total disk usage.void
reset()
Reset the internal cache of already loaded statistics.void
setDbControl(DbControl dc)
Set the DbControl which will be used to get statisics if it is not cached.void
setMaxAge(int maxAge)
Set the max age in seconds for a disk usage summary object before it is reloaded from the database again.
-
-
-
Constructor Detail
-
DiskUsageStatistics
DiskUsageStatistics(DbControl dc)
Create a new disk usage statistics object.
-
-
Method Detail
-
setDbControl
public void setDbControl(DbControl dc)
Set the DbControl which will be used to get statisics if it is not cached.- Parameters:
dc
- An open DbControl object
-
setMaxAge
public void setMaxAge(int maxAge)
Set the max age in seconds for a disk usage summary object before it is reloaded from the database again. A negative value keeps the object forever, a value of zero disabled caching.- Parameters:
maxAge
- Number of seconds to keep summary in the cache, or zero to disable the cache or a negative value to cache forever
-
getMaxAge
public int getMaxAge()
Get the max age in seconds for a disk usage summary object before it is reloaded from the database again. A negative value keeps the object forever, a value of zero disabled caching. The default value is -1.
-
reset
public void reset()
Reset the internal cache of already loaded statistics.
-
getQuotaTypes
public List<QuotaType> getQuotaTypes()
Get the list of quota types that are registered forDiskConsumable
items.- Returns:
- A list with QuotaType objects
-
getTotalSummary
public DiskUsageStatistics.Summary getTotalSummary()
Get a summary of the total disk usage. This method will first check if a cached summary exists and only hit the database if not.- Returns:
- A summary object
-
getSummary
public DiskUsageStatistics.Summary getSummary(User user)
Get a summary of the disk usage for the specified user. This method will first check if a cached summary exists and only hit the database if not.- Parameters:
user
- The user to get the disk usage for- Returns:
- A summary object
-
getSummary
public DiskUsageStatistics.Summary getSummary(Group group)
Get a summary of the disk usage for the specified group. This method will first check if a cached summary exists and only hit the database if not.- Parameters:
group
- The group to get the disk usage for- Returns:
- A summary object
-
-