com.bradmcevoy.http.quota
Class DefaultStorageChecker
java.lang.Object
com.bradmcevoy.http.quota.DefaultStorageChecker
- All Implemented Interfaces:
- StorageChecker
public class DefaultStorageChecker
- extends java.lang.Object
- implements StorageChecker
Default storage checking mechanism checks to see if the nearest parent
resource implements QuotaResource, and if so uses the available bytes
property from that to determine whether to allow a PUT
Note that there is not always information available giving the size of new content,
and in the case of replacing an existing resource, we might not have that resource's
size. In these cases we cant determine perfectly whether we should allow or reject
a PUT request. So we allow these requests if the available storage is greater then
zero, but disallow if less then or equal to zero.
- Author:
- brad
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultStorageChecker
public DefaultStorageChecker()
checkStorageOnReplace
public StorageChecker.StorageErrorReason checkStorageOnReplace(Request request,
CollectionResource parent,
Resource replaced,
java.lang.String host)
- Description copied from interface:
StorageChecker
- Check to see if the operation should be allowed, when an existing resource
is to be overwritten or replaced.
- Specified by:
checkStorageOnReplace in interface StorageChecker
replaced - - the resource being replaced
- Returns:
- - null if the operation should proceed, otherwise a reason for the error
checkStorageOnAdd
public StorageChecker.StorageErrorReason checkStorageOnAdd(Request request,
CollectionResource nearestParent,
Path parentPath,
java.lang.String host)
- Description copied from interface:
StorageChecker
- Check to see if the operation should be allowed, when there is no existing
resource. The parent collection may or may not exist, so only its path is
provided.
- Specified by:
checkStorageOnAdd in interface StorageChecker
parentPath - - the path to the parent collection. E.g. http://abc.com/path = /path
- Returns:
- - null if the operation should proceed, or the reason for the failure
Copyright © 2011. All Rights Reserved.