org.olat.core.util.vfs
Class QuotaManager

java.lang.Object
  extended by org.olat.core.util.vfs.QuotaManager
Direct Known Subclasses:
QuotaManagerImpl

public abstract class QuotaManager
extends java.lang.Object

Initial Date: Feb 17, 2004

Author:
Mike Stock
Comment: Original author

, Florian Gnägi
Comment: Refactoring to core package make default quotas generic


Constructor Summary
QuotaManager()
           
 
Method Summary
abstract  Quota createQuota(java.lang.String path, java.lang.Long quotaKB, java.lang.Long ulLimitKB)
          Create a quota object (transient, not yet stored)
abstract  boolean deleteCustomQuota(Quota quota)
           
abstract  Quota getCustomQuota(java.lang.String path)
          Get the quota (in KB) for this path.
abstract  Quota getCustomQuotaOrDefaultDependingOnRole(Identity identity, java.lang.String relPath)
          call to get appropriate quota depending on role.
abstract  Quota getDefaultQuota(java.lang.String identifyer)
          Get the default quota for the given identifyer or NULL if no such quota found
abstract  Quota getDefaultQuotaDependingOnRole(Identity identity)
          call to get appropriate quota depending on role.
abstract  java.util.Set getDefaultQuotaIdentifyers()
          Get the identifyers for the default quotas
static QuotaManager getInstance()
           
abstract  Controller getQuotaEditorInstance(UserRequest ureq, WindowControl wControl, java.lang.String relPath, boolean modalMode)
          Factory method to create a controller that is capable of editing the quota for the given path.
abstract  int getUploadLimitKB(long quotaKB2, long uploadLimitKB2, VFSContainer currentContainer2)
          Return upload-limit depending on quota-limit and upload-limit values.
abstract  void init()
          Initialize the
abstract  boolean isValidQuotaPath(java.lang.String path)
          Check if a quota path is valid
abstract  java.util.List listCustomQuotasKB()
          Get a list of all objects which have an individual quota.
abstract  void setCustomQuotaKB(Quota quota)
          Sets or updates the quota (in KB) for this path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuotaManager

public QuotaManager()
Method Detail

getInstance

public static QuotaManager getInstance()
Returns:
an instance via the spring bean loading mechanism.

createQuota

public abstract Quota createQuota(java.lang.String path,
                                  java.lang.Long quotaKB,
                                  java.lang.Long ulLimitKB)
Create a quota object (transient, not yet stored)

Parameters:
path -
quotaKB -
ulLimitKB -
Returns:

init

public abstract void init()
Initialize the


getDefaultQuotaIdentifyers

public abstract java.util.Set getDefaultQuotaIdentifyers()
Get the identifyers for the default quotas

Returns:

getDefaultQuota

public abstract Quota getDefaultQuota(java.lang.String identifyer)
Get the default quota for the given identifyer or NULL if no such quota found

Parameters:
identifyer -
Returns:

getCustomQuota

public abstract Quota getCustomQuota(java.lang.String path)
Get the quota (in KB) for this path. Important: Must provide a path with a valid base.

Parameters:
path -
Returns:
Quota object.

setCustomQuotaKB

public abstract void setCustomQuotaKB(Quota quota)
Sets or updates the quota (in KB) for this path. Important: Must provide a path with a valid base.

Parameters:
quota -

deleteCustomQuota

public abstract boolean deleteCustomQuota(Quota quota)
Parameters:
quota - to be deleted
Returns:
true if quota successfully deleted or no such quota, false if quota not deleted because it was a default quota that can not be deleted

listCustomQuotasKB

public abstract java.util.List listCustomQuotasKB()
Get a list of all objects which have an individual quota.

Returns:
list of quotas.

getDefaultQuotaDependingOnRole

public abstract Quota getDefaultQuotaDependingOnRole(Identity identity)
call to get appropriate quota depending on role. Authors have normally bigger quotas than normal users.

Parameters:
identity -
Returns:

getCustomQuotaOrDefaultDependingOnRole

public abstract Quota getCustomQuotaOrDefaultDependingOnRole(Identity identity,
                                                             java.lang.String relPath)
call to get appropriate quota depending on role. Authors have normally bigger quotas than normal users. The method checks also if the user has a custom quota on the path specified. If yes the custom quota is retuned

Parameters:
identity -
Returns:
custom quota or quota depending on role

getUploadLimitKB

public abstract int getUploadLimitKB(long quotaKB2,
                                     long uploadLimitKB2,
                                     VFSContainer currentContainer2)
Return upload-limit depending on quota-limit and upload-limit values.

Parameters:
quotaKB2 - Quota limit in KB, can be Quota.UNLIMITED
uploadLimitKB2 - Upload limit in KB, can be Quota.UNLIMITED
currentContainer2 - Upload container (folder)
Returns:
Upload limit on KB

isValidQuotaPath

public abstract boolean isValidQuotaPath(java.lang.String path)
Check if a quota path is valid

Parameters:
path -
Returns:

getQuotaEditorInstance

public abstract Controller getQuotaEditorInstance(UserRequest ureq,
                                                  WindowControl wControl,
                                                  java.lang.String relPath,
                                                  boolean modalMode)
Factory method to create a controller that is capable of editing the quota for the given path.

The controller must fire the following events:

Parameters:
ureq -
wControl -
relPath -
modalMode -
Returns: