Package org.alfresco.filesys.repo
Class ContentQuotaManager
java.lang.Object
org.alfresco.filesys.repo.ContentQuotaManager
- All Implemented Interfaces:
Runnable,org.alfresco.jlan.server.filesys.quota.QuotaManager
public class ContentQuotaManager
extends Object
implements org.alfresco.jlan.server.filesys.quota.QuotaManager, Runnable
Content Quota Manager Class
Implementation of JLAN QuotaManager interface for the Alfresco repository.
Keeps an in memory quota for each active user. After a configurable length of time quotas are removed from memory.
- Author:
- gkspencer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongallocateSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, long alloc) Allocate space on the filesystem.longReturn the free space available in bytesfinal ContentUsageServiceGet the usage servicelonggetUserFreeSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree) Return the free space available to the specified user/sessionlonggetUserTotalSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree) Return the quota space available to the specified user/sessionvoidinit()voidreleaseSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, int fid, String path, long alloc) Release space to the free space for the filesystem.voidrun()Inactivity checker, run in a seperate threadvoidsetContentService(ContentService contentService) final voidsetUsageService(ContentUsageService usageService) Set the usage servicevoidstartManager(org.alfresco.jlan.server.filesys.DiskInterface disk, org.alfresco.jlan.server.filesys.DiskDeviceContext ctx) Start the quota manager.voidstopManager(org.alfresco.jlan.server.filesys.DiskInterface disk, org.alfresco.jlan.server.filesys.DiskDeviceContext ctx) Stop the quota manager
-
Constructor Details
-
ContentQuotaManager
public ContentQuotaManager()
-
-
Method Details
-
init
public void init() -
getUsageService
Get the usage service- Returns:
- ContentUsageService
-
setUsageService
Set the usage service- Parameters:
usageService- ContentUsageService
-
getAvailableFreeSpace
public long getAvailableFreeSpace()Return the free space available in bytes- Specified by:
getAvailableFreeSpacein interfaceorg.alfresco.jlan.server.filesys.quota.QuotaManager- Returns:
- long
-
getUserTotalSpace
public long getUserTotalSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree) Return the quota space available to the specified user/session- Specified by:
getUserTotalSpacein interfaceorg.alfresco.jlan.server.filesys.quota.QuotaManager- Parameters:
sess- SrvSessiontree- TreeConnection- Returns:
- long
-
getUserFreeSpace
public long getUserFreeSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree) Return the free space available to the specified user/session- Specified by:
getUserFreeSpacein interfaceorg.alfresco.jlan.server.filesys.quota.QuotaManager- Parameters:
sess- SrvSessiontree- TreeConnection- Returns:
- long
-
allocateSpace
public long allocateSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, long alloc) throws IOException Allocate space on the filesystem.- Specified by:
allocateSpacein interfaceorg.alfresco.jlan.server.filesys.quota.QuotaManager- Parameters:
sess- SrvSessiontree- TreeConnectionfile- NetworkFilealloc- long requested allocation size- Returns:
- long granted allocation size
- Throws:
IOException
-
releaseSpace
public void releaseSpace(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, int fid, String path, long alloc) throws IOException Release space to the free space for the filesystem.- Specified by:
releaseSpacein interfaceorg.alfresco.jlan.server.filesys.quota.QuotaManager- Parameters:
sess- SrvSessiontree- TreeConnectionfid- intpath- Stringalloc- long- Throws:
IOException
-
startManager
public void startManager(org.alfresco.jlan.server.filesys.DiskInterface disk, org.alfresco.jlan.server.filesys.DiskDeviceContext ctx) throws org.alfresco.jlan.server.filesys.quota.QuotaManagerException Start the quota manager.- Specified by:
startManagerin interfaceorg.alfresco.jlan.server.filesys.quota.QuotaManager- Parameters:
disk- DiskInterfacectx- DiskDeviceContext- Throws:
org.alfresco.jlan.server.filesys.quota.QuotaManagerException
-
stopManager
public void stopManager(org.alfresco.jlan.server.filesys.DiskInterface disk, org.alfresco.jlan.server.filesys.DiskDeviceContext ctx) throws org.alfresco.jlan.server.filesys.quota.QuotaManagerException Stop the quota manager- Specified by:
stopManagerin interfaceorg.alfresco.jlan.server.filesys.quota.QuotaManager- Parameters:
disk- DiskInterfacectx- DiskDeviceContext- Throws:
org.alfresco.jlan.server.filesys.quota.QuotaManagerException
-
run
public void run()Inactivity checker, run in a seperate thread -
setContentService
-
getContentService
-