|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.QuotaManager
public class QuotaManager
Nested Class Summary | |
---|---|
static class |
QuotaManager.WorkspaceNode
Inner class to save a workspace and it's level in hierarchy |
Field Summary | |
---|---|
protected ExecutorService |
analyzerThreadPool
|
protected Map<String,FileSize> |
cacheFileSize
|
protected WorkspaceFileAnalyzer |
channelFileAnalyzer
|
protected QuotaElement |
channelQuotaAlert
|
protected FileAnalyzerThread |
currentChannelAnalyzerThread
|
static int |
DEFAULT_ALERT_THRESHOLD
|
static long |
DEFAULT_DELAY
|
static long |
DEFAULT_SITE_QUOTA
|
static long |
DEFAULT_WORKSPACE_QUOTA
|
static boolean |
ENABLED_DEFAULT
|
protected long |
lastChannelQuotaNotificationDate
|
Fields inherited from interface com.jalios.util.JPropertiesListener |
---|
REVISION |
Fields inherited from interface com.jalios.jdring.AlarmListener |
---|
REVISION |
Method Summary | |
---|---|
void |
associatedFileEventFired(AssociatedFileEvent event)
Trigger a quota refresh if a new associated file is added/updated or deleted |
void |
checkQuotas()
Check all quotas and send notifications if needed, this method is called after the end of an analyzeThread. |
static FileSize |
computeFileSizes(File realFile,
AssociatedFilesManager afMgr)
Compute file size (with and without associated files) |
AssociatedFilesEventListener |
createAssociatedFilesEventListener()
|
FileAnalyzerThread |
executeFileAnalyzerThread(Workspace workspace)
|
static List<QuotaManager.WorkspaceNode> |
generateWorkspaceTreeList()
Generate Workspace List ordered by tree order and with Workspace .getNameComparator by level |
ExecutorService |
getAnalyzerThreadPool()
get analyzer thread pool use to compute workspace file analyze in background mode |
FileSize |
getCacheFileSize(File file)
get the cache file size with computed size |
QuotaElement |
getChannelQuotaAlert()
|
FileAnalyzerThread |
getCurrentChannelAnalyzerThread()
Return the current analyzer thread if analyze is in progress |
int |
getDefaultAlertThreshold()
|
long |
getDefaultQuotaSize()
|
QuotaElement |
getElement(Workspace wk)
create a QuotaElement for a Workspace . |
Map<Workspace,QuotaElement> |
getElements()
returns the Map with all QuotaElement per workspace, the value with the null key is for the whole site. |
WorkspaceFileAnalyzer |
getGlobalFileAnalyzer(boolean refresh)
returns WorkspaceFileAnalyzer instance associated with this site. |
static QuotaManager |
getInstance()
|
long |
getLastChannelQuotaNotificationDate()
|
QuotaElement |
getSiteElement()
create a QuotaElement for a whiole site. |
void |
handleAlarm(AlarmEntry entry)
Manage periodically quota refresh |
void |
handleFileAnalyzeEnd(WorkspaceFileAnalyzer fileAnalyzer)
This method is called when global file analyzer has end |
boolean |
isQuotaEnabled()
|
void |
propertiesChange(JProperties properties)
|
protected void |
readProperties()
|
void |
setChannelQuotaAlert(QuotaElement channelQuotaAlert)
|
void |
setDefaultAlertThreshold(int defaultAlertThreshold)
|
void |
setDefaultQuotaSize(long defaultQuotaSize)
|
void |
setLastChannelQuotaNotificationDate(long lastChannelQuotaNotificationDate)
|
void |
shutdownThreads()
|
void |
updateAfterFileChange(File file)
update quota after a file change |
void |
updateAfterFileDocumentChange(FileDocument fileDoc)
update quota after a filedocument change |
void |
updateCacheFileSize(File file,
FileSize fileSizeObj)
update the cache file size with computed size |
void |
updateQuota(Workspace wk)
Update workspace quota in separate threads |
void |
updateWorkspacesQuota()
Update all workspaces quota in separate threads |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_ALERT_THRESHOLD
public static final long DEFAULT_WORKSPACE_QUOTA
public static final long DEFAULT_SITE_QUOTA
public static final long DEFAULT_DELAY
public static final boolean ENABLED_DEFAULT
protected transient WorkspaceFileAnalyzer channelFileAnalyzer
protected transient FileAnalyzerThread currentChannelAnalyzerThread
protected transient ExecutorService analyzerThreadPool
protected transient long lastChannelQuotaNotificationDate
protected transient QuotaElement channelQuotaAlert
protected transient Map<String,FileSize> cacheFileSize
Method Detail |
---|
public static QuotaManager getInstance()
public void propertiesChange(JProperties properties)
propertiesChange
in interface JPropertiesListener
protected void readProperties()
public QuotaElement getElement(Workspace wk)
QuotaElement
for a Workspace
. If the workspace has a running analyze thread, this method will return null
wk
- the Workspace
QuotaElement
public QuotaElement getSiteElement()
QuotaElement
for a whiole site. If the site has a running analyze thread, this method will return null
QuotaElement
public Map<Workspace,QuotaElement> getElements()
Map
with all QuotaElement
per workspace, the value with the null key is for the whole site. Values can be null is a running analyze thread exists for the workspace or site.
Map
with all QuotaElement
per workspace, the value with the null key is for the whole site. Values can be null is a running analyze thread exists for the workspace or site.public boolean isQuotaEnabled()
public long getDefaultQuotaSize()
public void setDefaultQuotaSize(long defaultQuotaSize)
public int getDefaultAlertThreshold()
public void setDefaultAlertThreshold(int defaultAlertThreshold)
public AssociatedFilesEventListener createAssociatedFilesEventListener()
public void updateWorkspacesQuota()
public void updateQuota(Workspace wk)
public void associatedFileEventFired(AssociatedFileEvent event)
associatedFileEventFired
in interface AssociatedFilesEventListener
public void updateAfterFileChange(File file)
file
- the File
public void updateAfterFileDocumentChange(FileDocument fileDoc)
fileDoc
- the FileDocument
public void handleAlarm(AlarmEntry entry)
handleAlarm
in interface AlarmListener
entry
- the AlarmEntry which has been triggered.public void checkQuotas()
public FileAnalyzerThread executeFileAnalyzerThread(Workspace workspace)
public ExecutorService getAnalyzerThreadPool()
ExecutorService
public WorkspaceFileAnalyzer getGlobalFileAnalyzer(boolean refresh)
WorkspaceFileAnalyzer
instance associated with this site. Note that as file analyze is down asynchronously, this method should returns null if an analyze is in progress (or if refresh is asked).
In this case, user should ask getCurrentAnalyzerThread() to retrieve the analyze thread. getCompleteness() method on the thread can be used to know the state of the thread.
refresh
- force to ignore data previously present in cache
WorkspaceFileAnalyzer
instance associated with this site or null if an analyze is in progress (or if refresh is asked).public FileAnalyzerThread getCurrentChannelAnalyzerThread()
FileAnalyzerThread
or null if no analyze is runningpublic void handleFileAnalyzeEnd(WorkspaceFileAnalyzer fileAnalyzer)
public long getLastChannelQuotaNotificationDate()
public void setLastChannelQuotaNotificationDate(long lastChannelQuotaNotificationDate)
public QuotaElement getChannelQuotaAlert()
public void setChannelQuotaAlert(QuotaElement channelQuotaAlert)
public void shutdownThreads()
public void updateCacheFileSize(File file, FileSize fileSizeObj)
file
- the File
used to generate map keyfileSizeObj
- the FileSize
to storepublic FileSize getCacheFileSize(File file)
file
- the File
used to generate map keypublic static FileSize computeFileSizes(File realFile, AssociatedFilesManager afMgr)
realFile
- the File
afMgr
- the current AssociatedFilesManager
if any
public static List<QuotaManager.WorkspaceNode> generateWorkspaceTreeList()
Workspace
List
ordered by tree order and with Workspace
.getNameComparator by level
Workspace
List
already sorted
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |