Package de.unirostock.sems.cbarchive.web
Class QuotaManager
- java.lang.Object
-
- de.unirostock.sems.cbarchive.web.QuotaManager
-
public class QuotaManager extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
QuotaManager.Worker
-
Field Summary
Fields Modifier and Type Field Description protected StatisticData
stats
protected Date
statsTimestamp
protected long
totalSize
protected long
workerExecutionTime
protected Thread
workerThread
protected Map<String,Long>
workspaceCache
protected WorkspaceManager
workspaceManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
forceAsyncScan(boolean storeSettingsAfterwards)
Starts an async scan of all workspaces, also deletes workspaces which are too oldstatic QuotaManager
getInstance()
Returns the Singleton instanceStatisticData
getStats()
Gets the statistics on the page.long
getTotalSize()
Retuns the total size in bytes from all workspaces or 0L if it fails.StatisticData
getUserStats(UserManager user)
Gets the user stats.long
getWorkspaceSize(Workspace workspace)
Returns the size in bytes of all archives together in the workspace or0L
if it fails.long
updateWorkspace(Workspace workspace)
Updates the size of the workspacelong
updateWorkspace(String workspaceId)
Updates the size of the workspace or removes the result from the cache, if the workspace is not available anymore
-
-
-
Field Detail
-
workspaceManager
protected WorkspaceManager workspaceManager
-
totalSize
protected long totalSize
-
workerThread
protected Thread workerThread
-
workerExecutionTime
protected long workerExecutionTime
-
stats
protected StatisticData stats
-
statsTimestamp
protected Date statsTimestamp
-
-
Method Detail
-
getInstance
public static QuotaManager getInstance()
Returns the Singleton instance- Returns:
- the QuotaManager
-
getTotalSize
public long getTotalSize()
Retuns the total size in bytes from all workspaces or 0L if it fails.- Returns:
- the total size
-
forceAsyncScan
public void forceAsyncScan(boolean storeSettingsAfterwards)
Starts an async scan of all workspaces, also deletes workspaces which are too old- Parameters:
storeSettingsAfterwards
- if set to true, the main properties will be stored after the scan
-
getWorkspaceSize
public long getWorkspaceSize(Workspace workspace)
Returns the size in bytes of all archives together in the workspace or0L
if it fails.- Parameters:
workspace
- the workspace- Returns:
- the size in bytes of all archives in the workspace
-
updateWorkspace
public long updateWorkspace(String workspaceId)
Updates the size of the workspace or removes the result from the cache, if the workspace is not available anymore- Parameters:
workspaceId
- id of the workspace- Returns:
- the new size of the workspace
-
getStats
public StatisticData getStats()
Gets the statistics on the page.- Returns:
- the stats
-
getUserStats
public StatisticData getUserStats(UserManager user)
Gets the user stats.- Parameters:
user
- the user- Returns:
- the user stats
-
updateWorkspace
public long updateWorkspace(Workspace workspace)
Updates the size of the workspace- Parameters:
workspace
- the workspace- Returns:
- updated size of the workspace
-
-