org.olat.admin.quota
Class QuotaManagerImpl

java.lang.Object
  extended by org.olat.core.util.vfs.QuotaManager
      extended by org.olat.admin.quota.QuotaManagerImpl

public class QuotaManagerImpl
extends QuotaManager

Description:

Quota manager implementation for the OLAT LMS. This is a singleton that must be specified in the spring configuration and be properly initialized!

Initial Date: 23.05.2007

Author:
Florian Gnaegi, frentix GmbH, http://www.frentix.com

Method Summary
 Quota createQuota(java.lang.String path, java.lang.Long quotaKB, java.lang.Long ulLimitKB)
          Create a quota object (transient, not yet stored)
 boolean deleteCustomQuota(Quota quota)
           
 Quota getCustomQuota(java.lang.String path)
          Get the quota (in KB) for this path.
 Quota getCustomQuotaOrDefaultDependingOnRole(Identity identity, java.lang.String relPath)
          call to get appropriate quota depending on role.
 Quota getDefaultQuota(java.lang.String identifyer)
          Get the default quota for the given identifyer or NULL if no such quota found
 Quota getDefaultQuotaDependingOnRole(Identity identity)
          call to get appropriate quota depending on role.
 java.util.Set getDefaultQuotaIdentifyers()
          Get the identifyers for the default quotas
 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.
 int getUploadLimitKB(long quotaKB2, long uploadLimitKB2, VFSContainer currentContainer2)
          Return upload-limit depending on quota-limit and upload-limit values.
 void init()
          Initialize the
 boolean isValidQuotaPath(java.lang.String path)
          Check if a quota path is valid
 java.util.List listCustomQuotasKB()
          Get a list of all objects which have an individual quota.
 void setCustomQuotaKB(Quota quota)
          Sets or updates the quota (in KB) for this path.
 
Methods inherited from class org.olat.core.util.vfs.QuotaManager
getInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createQuota

public Quota createQuota(java.lang.String path,
                         java.lang.Long quotaKB,
                         java.lang.Long ulLimitKB)
Description copied from class: QuotaManager
Create a quota object (transient, not yet stored)

Specified by:
createQuota in class QuotaManager
Returns:
See Also:
QuotaManager.createQuota(java.lang.String, java.lang.Long, java.lang.Long)

init

public void init()
Initialize the

Specified by:
init in class QuotaManager

getDefaultQuotaIdentifyers

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

Specified by:
getDefaultQuotaIdentifyers in class QuotaManager
Returns:

getDefaultQuota

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

Specified by:
getDefaultQuota in class QuotaManager
Parameters:
identifyer -
Returns:

getCustomQuota

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

Specified by:
getCustomQuota in class QuotaManager
Parameters:
path -
Returns:
Quota object.

setCustomQuotaKB

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

Specified by:
setCustomQuotaKB in class QuotaManager
Parameters:
quota -

deleteCustomQuota

public boolean deleteCustomQuota(Quota quota)
Specified by:
deleteCustomQuota in class QuotaManager
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 java.util.List listCustomQuotasKB()
Get a list of all objects which have an individual quota.

Specified by:
listCustomQuotasKB in class QuotaManager
Returns:
list of quotas.

getDefaultQuotaDependingOnRole

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

Specified by:
getDefaultQuotaDependingOnRole in class QuotaManager
Parameters:
identity -
Returns:

getCustomQuotaOrDefaultDependingOnRole

public 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

Specified by:
getCustomQuotaOrDefaultDependingOnRole in class QuotaManager
Parameters:
identity -
Returns:
custom quota or quota depending on role

getUploadLimitKB

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

Specified by:
getUploadLimitKB in class QuotaManager
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 boolean isValidQuotaPath(java.lang.String path)
Check if a quota path is valid

Specified by:
isValidQuotaPath in class QuotaManager
Parameters:
path -
Returns:

getQuotaEditorInstance

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

The controller must fire the following events:

Specified by:
getQuotaEditorInstance in class QuotaManager
Returns:
See Also:
QuotaManager.getQuotaEditorInstance(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl, java.lang.String, boolean)