com.bradmcevoy.http.quota
Interface StorageChecker

All Known Implementing Classes:
DefaultStorageChecker

public interface StorageChecker

Implementations will check some aspect of whether or not its allowable to load some content into the system. This may be whether there is sufficient disk space, or whether the user's quota is full. This is generally called on a PUT, so there are 2 possibilities: a. the PUT is to an existing resource which will be replaced. Even if a quota is currently exceeded this might be allowed if the new resource is no larger then the one it is replacing b. the PUT is to create a new resource. In this case it is simply an add, but the parent folder might or might not exist.

Author:
brad

Nested Class Summary
static class StorageChecker.StorageErrorReason
           
 
Method Summary
 StorageChecker.StorageErrorReason checkStorageOnAdd(Request request, CollectionResource nearestParent, Path parentPath, java.lang.String host)
          Check to see if the operation should be allowed, when there is no existing resource.
 StorageChecker.StorageErrorReason checkStorageOnReplace(Request request, CollectionResource parent, Resource replaced, java.lang.String host)
          Check to see if the operation should be allowed, when an existing resource is to be overwritten or replaced.
 

Method Detail

checkStorageOnReplace

StorageChecker.StorageErrorReason checkStorageOnReplace(Request request,
                                                        CollectionResource parent,
                                                        Resource replaced,
                                                        java.lang.String host)
Check to see if the operation should be allowed, when an existing resource is to be overwritten or replaced.

Parameters:
request -
replaced - - the resource being replaced
host -
Returns:
- null if the operation should proceed, otherwise a reason for the error

checkStorageOnAdd

StorageChecker.StorageErrorReason checkStorageOnAdd(Request request,
                                                    CollectionResource nearestParent,
                                                    Path parentPath,
                                                    java.lang.String host)
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.

Parameters:
request -
parentPath - - the path to the parent collection. E.g. http://abc.com/path = /path
host -
Returns:
- null if the operation should proceed, or the reason for the failure


Copyright © 2011. All Rights Reserved.