Class 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 Detail

      • ContentQuotaManager

        public ContentQuotaManager()
    • Method Detail

      • 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)