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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    allocateSpace(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.
    long
    Return the free space available in bytes
     
    Get the usage service
    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
    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
    void
     
    void
    releaseSpace(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.
    void
    run()
    Inactivity checker, run in a seperate thread
    void
     
    final void
    Set the usage service
    void
    startManager(org.alfresco.jlan.server.filesys.DiskInterface disk, org.alfresco.jlan.server.filesys.DiskDeviceContext ctx)
    Start the quota manager.
    void
    stopManager(org.alfresco.jlan.server.filesys.DiskInterface disk, org.alfresco.jlan.server.filesys.DiskDeviceContext ctx)
    Stop the quota manager

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ContentQuotaManager

      public ContentQuotaManager()
  • Method Details

    • init

      public void init()
    • getUsageService

      public final ContentUsageService getUsageService()
      Get the usage service
      Returns:
      ContentUsageService
    • setUsageService

      public final void setUsageService(ContentUsageService usageService)
      Set the usage service
      Parameters:
      usageService - ContentUsageService
    • getAvailableFreeSpace

      public long getAvailableFreeSpace()
      Return the free space available in bytes
      Specified by:
      getAvailableFreeSpace in interface org.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:
      getUserTotalSpace in interface org.alfresco.jlan.server.filesys.quota.QuotaManager
      Parameters:
      sess - SrvSession
      tree - 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:
      getUserFreeSpace in interface org.alfresco.jlan.server.filesys.quota.QuotaManager
      Parameters:
      sess - SrvSession
      tree - 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:
      allocateSpace in interface org.alfresco.jlan.server.filesys.quota.QuotaManager
      Parameters:
      sess - SrvSession
      tree - TreeConnection
      file - NetworkFile
      alloc - 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:
      releaseSpace in interface org.alfresco.jlan.server.filesys.quota.QuotaManager
      Parameters:
      sess - SrvSession
      tree - TreeConnection
      fid - int
      path - String
      alloc - 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:
      startManager in interface org.alfresco.jlan.server.filesys.quota.QuotaManager
      Parameters:
      disk - DiskInterface
      ctx - 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:
      stopManager in interface org.alfresco.jlan.server.filesys.quota.QuotaManager
      Parameters:
      disk - DiskInterface
      ctx - DiskDeviceContext
      Throws:
      org.alfresco.jlan.server.filesys.quota.QuotaManagerException
    • run

      public void run()
      Inactivity checker, run in a seperate thread
      Specified by:
      run in interface Runnable
    • setContentService

      public void setContentService(ContentService contentService)
    • getContentService

      public ContentService getContentService()