org.silverpeas.quota.service
Interface QuotaService<T extends QuotaKey>

All Known Subinterfaces:
ComponentSpaceQuotaService, DataStorageSpaceQuotaService, SpaceQuotaService<T>
All Known Implementing Classes:
AbstractQuotaService, AbstractSpaceQuotaService, DefaultComponentSpaceQuotaService, DefaultDataStorageSpaceQuotaService, UserDomainQuotaService

public interface QuotaService<T extends QuotaKey>

Author:
Yohann Chastagnier

Method Summary
 Quota get(T key)
          Gets the quota of the resource from a given quota key.
 long getCurrentCount(T key)
          Gets the current count from a given quota key
 Quota initialize(T key, long maxCount)
          Initializes the quota of the resource for the given quota key.
 Quota initialize(T key, long minCount, long maxCount)
          Initializes the quota of the resource for the given quota key.
 Quota initialize(T key, Quota quota)
          Initializes the quota of the resource for the given quota key and from an existing quota.
 void remove(T key)
          Removes quietly the quota of the resource from a given quota key.
 Quota verify(T key)
          Verifies if the quota is full or not enough from a given quota key.
 Quota verify(T key, AbstractQuotaCountingOffset countingOffset)
          Verifies if the quota is full or not enough from a given quota key and adding a counting offset.
 

Method Detail

getCurrentCount

long getCurrentCount(T key)
                     throws QuotaException
Gets the current count from a given quota key

Parameters:
key -
Returns:
Throws:
QuotaException

initialize

Quota initialize(T key,
                 long maxCount)
                 throws QuotaException
Initializes the quota of the resource for the given quota key.

Parameters:
key -
maxCount -
Returns:
Throws:
QuotaException

initialize

Quota initialize(T key,
                 long minCount,
                 long maxCount)
                 throws QuotaException
Initializes the quota of the resource for the given quota key.

Parameters:
key -
minCount -
maxCount -
Returns:
Throws:
QuotaException

initialize

Quota initialize(T key,
                 Quota quota)
                 throws QuotaException
Initializes the quota of the resource for the given quota key and from an existing quota.

Parameters:
key -
quota -
Returns:
Throws:
QuotaException

get

Quota get(T key)
          throws QuotaException
Gets the quota of the resource from a given quota key. A save operation is done if the current count has changed.

Parameters:
key -
Returns:
Throws:
QuotaException

verify

Quota verify(T key)
             throws QuotaException
Verifies if the quota is full or not enough from a given quota key. If full then a quota full exception is throwed. If not enough then a quota not enough exception is throwed.

Parameters:
key -
Returns:
the quota used by the verify treatment
Throws:
QuotaException

verify

Quota verify(T key,
             AbstractQuotaCountingOffset countingOffset)
             throws QuotaException
Verifies if the quota is full or not enough from a given quota key and adding a counting offset. If full then a quota full exception is throwed. If not enough then a quota not enough exception is throwed.

Parameters:
key -
countingOffset -
Returns:
the quota used by the verify treatment
Throws:
QuotaException

remove

void remove(T key)
Removes quietly the quota of the resource from a given quota key.

Parameters:
key -


Copyright © 2016 Silverpeas. All Rights Reserved.