I am working on a UserQuotaContentInterceptor to add support for
user-quotas to Slide using ContentInterceptor API.
To be able to achieve this, I need to add to Slide the ability
to notify clients that their quota has been exhausted (507 http
status code).
As Remy suggested, I added InsufficientStorageException to content
package that is thrown by UserQuotaContentInterceptor in such cases.
To integrate my work into Slide, I would need to modify
ContentInterceptor and Content interface to allow some of their methods
to throw this InsufficientStorageException :
For ContentInterceptor interface, methods :
void preStoreContent(SlideToken token,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
public void postStoreContent(SlideToken token,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
For Content interface, methods :
void create(SlideToken token, String strUri,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
void create(SlideToken token, String strUri, String branch,
NodeRevisionDescriptor newRevisionDescriptor,
NodeRevisionContent revisionContent)
void fork(SlideToken token, String strUri, String branchName,
NodeRevisionDescriptor basedOnRevisionDescriptor)
void fork(SlideToken token, String strUri, String branchName,
NodeRevisionNumber basedOnRevisionNumber)
void merge(SlideToken token, String strUri,
NodeRevisionDescriptor mainBranch,
NodeRevisionDescriptor branch,
NodeRevisionDescriptor newRevisionDescriptor,
NodeRevisionContent revisionContent)
void merge(SlideToken token, String strUri,
String mainBranch, String branch,
NodeRevisionDescriptor newRevisionDescriptor,
NodeRevisionContent revisionContent)
void store(SlideToken token, String strUri,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
As I think these changes qualify as API changes, I call for a vote to
determine agreement/objections, both for SLIDE_1_0 and HEAD branches.
I have already written (and tested) patches for these changes on
SLIDE_1_0 branch as well as UserQuotaContentInterceptor.
If you want to have a look on them, you will find them enclosed.
Apologies in advance if I've missed some formal conventions on votes.
1. Add InsufficientStorageException to content package.
[ ] +1. I agree with the change.
[ ] +0. I don't care.
[ ] -1. I don't agree, because:
2. Allow the above stated methods of ContentInterceptor interface to
throw InsufficientStorageException into HEAD branch.
[ ] +1. I agree with the change.
[ ] +0. I don't care.
[ ] -1. I don't agree, because:
3. Allow the above stated methods of Content interface to throw
InsufficientStorageException into HEAD branch.
[ ] +1. I agree with the change.
[ ] +0. I don't care.
[ ] -1. I don't agree, because:
4. Allow the above stated methods of ContentInterceptor interface to
throw InsufficientStorageException into SLIDE_1_0 branch.
[ ] +1. I agree with the change.
[ ] +0. I don't care.
[ ] -1. I don't agree, because:
5. Allow the above stated methods of Content interface to throw
InsufficientStorageException into SLIDE_1_0 branch.
[ ] +1. I agree with the change.
[ ] +0. I don't care.
[ ] -1. I don't agree, because:
Regards
Jp
/*
* $Header$
* $Revision$
* $Date$
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Slide", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.slide.content;
import java.util.Hashtable;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.SlideToken;
import org.apache.slide.common.ServiceAccessException;
import org.apache.slide.lock.ObjectLockedException;
import org.apache.slide.security.AccessDeniedException;
import org.apache.slide.structure.LinkedObjectNotFoundException;
import org.apache.slide.structure.ObjectNotFoundException;
/**
* Provides quota per user feature.
*
* <p>
* This class implements <code>ContentInterceptor</code> interface by
* extending <code>AbstractContentInterceptor</code> class.<br>
* It throws an InsufficientStorageException back to client
* (http status 507) when a user has exhausted its quota.
* </p>
*
* <p>
* This ContentInterceptor has two parameters :
* <ul>
* <li>
* <code>unknownSize</code>
* <ul>
* Should requests without content-length header be accepted ?
* </ul>
* </li>
* <li>
* <code>exceed</code>
* <ul>
* Should users be allowed to exceed their quota one time ?<br>
* When using WebFolders, you have to set this to true because
* to create or overwrite ressources, an empty one is first
* created before beeing updated with ressource content.<br>
* Throwing an InsufficientStorageException in such cases leads
* to 0 byte length ressource creation or even data lose in case
* of overwritting.
* </ul>
* </li>
* </ul>
* </p>
*
* <p>
* To enable UserQuotaContentInterceptor, you need to plug it into Slide
* by adding to <code><configuration></code> section of Domain.xml
* file lines like :
* </p>
*
* <p><code>
* <content-interceptor
class="org.apache.slide.content.UserQuotaContentInterceptor">
* <br>
* <parameter name="unknownSize">false</parameter>
* <br>
* <parameter name="exceed">true</parameter>
* <br>
* </content-interceptor>
* </code></p>
*
* <p>
* To set a quota for a user, just add to its user node a <code>quota</code>
* protected property with the quota in byte.<br>
* This ContentInterceptor has no effect if the user has no quota property
* set on its node.
* </p>
*
* <p>
* For more informations on ContentInterceptors, please see
* <a href="../../../../../interceptors.html">Interceptors documentation</a>.
* </p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jean-Philippe Courson</a>
*/
public class UserQuotaContentInterceptor
extends AbstractContentInterceptor {
// ----------------------------------------------------------- Constructors
/**
* Empty constructor required to implement ContentInterceptor interface
*/
public UserQuotaContentInterceptor() {
}
// -------------------------------------- ContentInterceptor Implementation
/**
* This method is called before content store.<br>
* It checks user's quota and decrease it in case of overwritting.
*
* @throws InsufficientStorageException if user has exceeded its quota
* or if request has no
* content-length header
* @throws AccessDeniedException if access to a resource has
* been denied
* @throws ObjectNotFoundException if an object could not be found
* @throws LinkedObjectNotFoundException if an object linked to by
* another object could not be
* found
* @throws ObjectLockedException if an object is locked
* @throws ServiceAccessException low-level service failure
*/
public void preStoreContent
(SlideToken token, NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
ServiceAccessException, InsufficientStorageException {
// if there is no content
if(revisionContent == null) return;
// retrieve user's node
NodeRevisionDescriptors userRevisionDescriptors =
getUserNodeRevisionDescriptors(token);
NodeRevisionDescriptor userRevisionDescriptor =
getUserNodeRevisionDescriptor(userRevisionDescriptors, token);
// check user's quota
check(userRevisionDescriptors, userRevisionDescriptor,
revisionDescriptors, revisionDescriptor);
// in case of content overwritting, substract old contentLength
clean(userRevisionDescriptors, userRevisionDescriptor,
revisionDescriptors, token);
}
/**
* This method is called after content store.<br>
* It checks user's quota then increase it.
*
* @throws InsufficientStorageException if user has exceeded its quota
* @throws AccessDeniedException if access to a resource has
* been denied
* @throws ObjectNotFoundException if an object could not be found
* @throws LinkedObjectNotFoundException if an object linked to by
* another object could not be
* found
* @throws ObjectLockedException if an object is locked
* @throws ServiceAccessException low-level service failure
*/
public void postStoreContent
(SlideToken token, NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
NodeRevisionContent revisionContent)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
ServiceAccessException, InsufficientStorageException {
// if there is no content
if(revisionContent == null) return;
// retrieve user's node
NodeRevisionDescriptors userRevisionDescriptors =
getUserNodeRevisionDescriptors(token);
NodeRevisionDescriptor userRevisionDescriptor =
getUserNodeRevisionDescriptor(userRevisionDescriptors, token);
// check user's quota
check(userRevisionDescriptors, userRevisionDescriptor,
revisionDescriptors, revisionDescriptor);
// update user's node bytesUsed properties
update(userRevisionDescriptors, userRevisionDescriptor,
revisionDescriptors, revisionDescriptor, true, token);
}
/**
* This method is called after content remove.<br>
* It decreases user's quota.
*/
public void postRemoveContent
(SlideToken token, NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
ServiceAccessException {
// we only process specified revision removing
if(revisionDescriptor == null) return;
// retrieve user's node
NodeRevisionDescriptors userRevisionDescriptors =
getUserNodeRevisionDescriptors(token);
NodeRevisionDescriptor userRevisionDescriptor =
getUserNodeRevisionDescriptor(userRevisionDescriptors, token);
// update user's node bytesUsed properties
update(userRevisionDescriptors, userRevisionDescriptor,
revisionDescriptors, revisionDescriptor, false, token);
}
// -------------------------------------------------------- Private methods
/**
* Method used to check user's quota.
*
* @param userRevisionDescriptors User's node revision descriptors
* @param userRevisionDescriptor User's node revision descriptor
* @param revisionDescriptors New node revision descriptors
* @param revisionDescriptor New node revision descriptor
*
* @throws InsufficientStorageException if user has exceeded its quota
* or if request has no
* content-length header
*/
private void check(NodeRevisionDescriptors userRevisionDescriptors,
NodeRevisionDescriptor userRevisionDescriptor,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor)
throws InsufficientStorageException {
// retrieve new content's length
long contentLength = revisionDescriptor.getContentLength();
// if request do not have a content-length header and unknowSize
// parameter is set to false, throw a InsufficientStorageException
if(contentLength < 0 && getParameter("unknownSize").equals("false")) {
throw new InsufficientStorageException(
revisionDescriptors.getUri(),
userRevisionDescriptors.getUri(),
"Request has no content-length header");
}
// retrieve user's node quota properties
NodeProperty property = userRevisionDescriptor.getProperty("quota");
if(property != null) {
long quota = Long.parseLong((String)property.getValue());
// retrieve user's node bytesUsed properties
property = userRevisionDescriptor.getProperty("bytesUsed");
long bytesUsed = 0;
if(property != null) {
bytesUsed = Long.parseLong((String)property.getValue());
}
// if exceed parameter is set to true, ignore new content length
if(getParameter("exceed").equals("true")) {
contentLength = 0;
}
// if user's quota is exhausted, throws InsufficientStorageException
if(bytesUsed + contentLength > quota) {
throw new InsufficientStorageException(
revisionDescriptors.getUri(),
userRevisionDescriptors.getUri(),
"User's quota exhausted");
}
}
}
/**
* Method used to update user's node bytesUsed property.
*
* @param userRevisionDescriptors user's node revision descriptors
* @param userRevisionDescriptor user's node revision descriptor
* @param revisionDescriptors node revision descriptors
* @param revisionDescriptor node revision descriptor
* @param add If true we add else we substract given contentLength
* @param token Slide's token
*/
private void update(NodeRevisionDescriptors userRevisionDescriptors,
NodeRevisionDescriptor userRevisionDescriptor,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
boolean add,
SlideToken token)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
ServiceAccessException {
// retrieve content's length
long contentLength = revisionDescriptor.getContentLength();
// retrieve user's node bytesUsed properties
NodeProperty property =
userRevisionDescriptor.getProperty("bytesUsed");
long bytesUsed = 0;
if(property != null) {
bytesUsed = Long.parseLong((String)property.getValue());
}
// computes new bytesUsed value
if(add) bytesUsed = bytesUsed + contentLength;
else {
bytesUsed = bytesUsed - contentLength;
if(bytesUsed < 0) bytesUsed = 0;
}
// update user's node bytesUsed properties
userRevisionDescriptor.setProperty("bytesUsed",
Long.toString(bytesUsed),
true);
try {
getNamespace().getContentHelper().store(token,
userRevisionDescriptors.getUri(),
userRevisionDescriptor, null);
// following exception should never happen
} catch(RevisionDescriptorNotFoundException e) {
} catch(InsufficientStorageException e) {
} catch(RevisionNotFoundException e) {}
}
/**
* In the case of an overwriting, this method substract the old
* content's contentLength from user's node bytesUsed properties.
*
* @param userRevisionDescriptors user's node revision descriptors
* @param userRevisionDescriptor user's node revision descriptor
* @param revisionDescriptors new node revision descriptors
* @param token Slide's token
*/
private void clean(NodeRevisionDescriptors userRevisionDescriptors,
NodeRevisionDescriptor userRevisionDescriptor,
NodeRevisionDescriptors revisionDescriptors,
SlideToken token)
throws AccessDeniedException, ObjectLockedException, ServiceAccessException {
try {
Content contentHelper = getNamespace().getContentHelper();
NodeRevisionDescriptors oldRevisionDescriptors =
contentHelper.retrieve(token, revisionDescriptors.getUri());
NodeRevisionDescriptor oldRevisionDescriptor =
contentHelper.retrieve(token, oldRevisionDescriptors);
update(userRevisionDescriptors, userRevisionDescriptor,
oldRevisionDescriptors, oldRevisionDescriptor, false, token);
// if object was not existing, nothing to clean
} catch(ObjectNotFoundException e) {
} catch(LinkedObjectNotFoundException e) {
} catch(RevisionDescriptorNotFoundException e) {}
}
/**
* Method used to retrieve user's node revision descriptors.
*
* @param token User's token
*
* @return User's node revision descriptors
*/
private NodeRevisionDescriptors getUserNodeRevisionDescriptors(
SlideToken token)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
ServiceAccessException {
return getNamespace().getContentHelper().retrieve(token,
getUserUri(token));
}
/**
* Method used to retrieve user's node revision descriptor.
*
* @param userRevisionDescriptors User's node revision descriptors
* @param token User's token
*
* @return User's node revision descriptor
*/
private NodeRevisionDescriptor getUserNodeRevisionDescriptor(
NodeRevisionDescriptors userRevisionDescriptors,
SlideToken token)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
ServiceAccessException {
NodeRevisionDescriptor userRevisionDescriptor = null;
try {
userRevisionDescriptor =
getNamespace().getContentHelper().retrieve(token,
userRevisionDescriptors);
}
catch(RevisionDescriptorNotFoundException e) {
// should never happen
}
return userRevisionDescriptor;
}
/**
* Method used to retrieve user's node uri from his token.
*
* @param token User's token
*
* @return User's node uri
*/
private String getUserUri(SlideToken token) {
String usersPath = getNamespace().getNamespaceConfig().getUsersPath();
StringBuffer sb = new StringBuffer(usersPath);
sb.append("/");
sb.append(token.getCredentialsToken().getPublicCredentials());
return sb.toString();
}
}
/*
* $Header$
* $Revision$
* $Date$
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Slide", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.slide.content;
import org.apache.slide.util.Messages;
/**
* Storage not sufficient.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jean-Philippe Courson</a>
* @version $Revision$
*/
public class InsufficientStorageException extends ContentException {
// ----------------------------------------------------------- Constructors
/**
* Constructor.
*
* @param objectUri Uri of the object
* @param userUri Uri of the user
* @param details Details on the exception
*/
public InsufficientStorageException(String objectUri, String userUri, String
details) {
super(Messages.format(InsufficientStorageException.class.getName(),
objectUri, userUri, details));
this.objectUri = objectUri;
this.userUri = userUri;
this.details = details;
}
// ----------------------------------------------------- Instance Variables
/**
* Object Uri.
*/
private String objectUri;
/**
* userUri.
*/
private String userUri;
/**
* Exception details.
*/
private String details;
// ------------------------------------------------------------- Properties
/**
* Object Uri accessor.
*
* @return String object Uri
*/
public String getObjectUri() {
if (objectUri == null) {
return new String();
} else {
return objectUri;
}
}
/**
* User Uri accessor.
*
* @return String user Uri
*/
public String getUserUri() {
return userUri;
}
/**
* Exception details accessor.
*
* @return String exception details
*/
public String getDetails() {
return details;
}
}
diff -u -r jakarta-slide/src/share/org/apache/slide/common/XMLUnmarshaller.java
jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/common/XMLUnmarshaller.java
--- jakarta-slide/src/share/org/apache/slide/common/XMLUnmarshaller.java Thu
Mar 28 06:41:29 2002
+++
+jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/common/XMLUnmarshaller.java
+ Sun Apr 28 14:20:48 2002
@@ -371,6 +371,8 @@
(e.toString(),LOG_CHANNEL,Logger.WARNING);
} catch (ObjectLockedException e) {
// Ignore
+ } catch(InsufficientStorageException e) {
+ // Ignore
}
} else {
@@ -388,6 +390,8 @@
accessToken.getLogger().log(e,LOG_CHANNEL,Logger.WARNING);
accessToken.getLogger().log
(e.toString(),LOG_CHANNEL,Logger.WARNING);
+ } catch(InsufficientStorageException e) {
+ // Ignore
}
}
diff -u -r
jakarta-slide/src/share/org/apache/slide/content/AbstractContentInterceptor.java
jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/AbstractContentInterceptor.java
--- jakarta-slide/src/share/org/apache/slide/content/AbstractContentInterceptor.java
Sat Apr 20 15:58:36 2002
+++
+jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/AbstractContentInterceptor.java
+ Sun Apr 28 15:02:40 2002
@@ -130,7 +130,7 @@
NodeRevisionContent revisionContent)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
- ServiceAccessException {
+ ServiceAccessException, InsufficientStorageException {
}
@@ -144,7 +144,7 @@
NodeRevisionContent revisionContent)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
- ServiceAccessException {
+ ServiceAccessException, InsufficientStorageException {
}
diff -u -r jakarta-slide/src/share/org/apache/slide/content/Content.java
jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/Content.java
--- jakarta-slide/src/share/org/apache/slide/content/Content.java Thu Mar 28
06:41:31 2002
+++
+jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/Content.java
+ Sun Apr 28 14:04:01 2002
@@ -192,7 +192,8 @@
NodeRevisionContent revisionContent)
throws ObjectNotFoundException, AccessDeniedException,
RevisionAlreadyExistException, LinkedObjectNotFoundException,
- ServiceAccessException, ObjectLockedException;
+ ServiceAccessException, ObjectLockedException,
+ InsufficientStorageException;
/**
@@ -210,7 +211,7 @@
RevisionAlreadyExistException, LinkedObjectNotFoundException,
ServiceAccessException, RevisionDescriptorNotFoundException,
ObjectLockedException, NodeNotVersionedException,
- BranchNotFoundException;
+ BranchNotFoundException, InsufficientStorageException;
/**
@@ -226,7 +227,8 @@
throws ObjectNotFoundException, AccessDeniedException,
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
- NodeNotVersionedException, RevisionAlreadyExistException;
+ NodeNotVersionedException, RevisionAlreadyExistException,
+ InsufficientStorageException;
/**
@@ -242,7 +244,8 @@
throws ObjectNotFoundException, AccessDeniedException,
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
- NodeNotVersionedException, RevisionAlreadyExistException;
+ NodeNotVersionedException, RevisionAlreadyExistException,
+ InsufficientStorageException;
/**
@@ -263,7 +266,7 @@
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
NodeNotVersionedException, BranchNotFoundException,
- RevisionAlreadyExistException;
+ RevisionAlreadyExistException, InsufficientStorageException;
/**
@@ -283,7 +286,7 @@
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
NodeNotVersionedException, BranchNotFoundException,
- RevisionAlreadyExistException;
+ RevisionAlreadyExistException, InsufficientStorageException;
/**
@@ -299,7 +302,7 @@
throws ObjectNotFoundException, AccessDeniedException,
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
- RevisionNotFoundException;
+ RevisionNotFoundException, InsufficientStorageException;
/**
diff -u -r jakarta-slide/src/share/org/apache/slide/content/ContentImpl.java
jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/ContentImpl.java
--- jakarta-slide/src/share/org/apache/slide/content/ContentImpl.java Sat Apr 20
17:57:04 2002
+++
+jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/ContentImpl.java
+ Sun Apr 28 14:10:04 2002
@@ -78,7 +78,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Christopher Lenz</a>
- * @author Jean-Philippe Courson
+ * @author <a href="mailto:[EMAIL PROTECTED]">Jean-Philippe Courson</a>
* @version $Revision: 1.29.2.4 $
*/
public final class ContentImpl implements Content {
@@ -262,9 +262,14 @@
(objectUri, revisionNumber);
// Invoke interceptors
- invokeInterceptors(token, revisionDescriptors, revisionDescriptor,
- null, POST_RETRIEVE);
-
+ try {
+ invokeInterceptors(token, revisionDescriptors, revisionDescriptor,
+ null, POST_RETRIEVE);
+ }
+ catch(InsufficientStorageException e) {
+ // could not happen during retrieving
+ }
+
return revisionDescriptor;
}
@@ -341,9 +346,14 @@
revisionDescriptor);
// Invoke interceptors
- invokeInterceptors(token, null, revisionDescriptor,
- revisionContent, POST_RETRIEVE);
-
+ try {
+ invokeInterceptors(token, null, revisionDescriptor,
+ revisionContent, POST_RETRIEVE);
+ }
+ catch(InsufficientStorageException e) {
+ // could not happen during retrieving
+ }
+
return revisionContent;
}
@@ -404,7 +414,8 @@
NodeRevisionContent revisionContent)
throws ObjectNotFoundException, AccessDeniedException,
RevisionAlreadyExistException, LinkedObjectNotFoundException,
- ServiceAccessException, ObjectLockedException {
+ ServiceAccessException, ObjectLockedException,
+ InsufficientStorageException {
// Retrieve the associated object
ObjectNode associatedObject =
@@ -620,7 +631,7 @@
RevisionAlreadyExistException, LinkedObjectNotFoundException,
ServiceAccessException, RevisionDescriptorNotFoundException,
ObjectLockedException, NodeNotVersionedException,
- BranchNotFoundException {
+ BranchNotFoundException, InsufficientStorageException {
Uri objectUri = namespace.getUri(token, strUri);
@@ -654,7 +665,8 @@
throws ObjectNotFoundException, AccessDeniedException,
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
- NodeNotVersionedException, RevisionAlreadyExistException {
+ NodeNotVersionedException, RevisionAlreadyExistException,
+ InsufficientStorageException {
fork(token, strUri, branchName,
basedOnRevisionDescriptor.getRevisionNumber());
@@ -675,7 +687,8 @@
throws ObjectNotFoundException, AccessDeniedException,
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
- NodeNotVersionedException, RevisionAlreadyExistException {
+ NodeNotVersionedException, RevisionAlreadyExistException,
+ InsufficientStorageException {
if (branchName.equals(NodeRevisionDescriptors.MAIN_BRANCH))
return;
@@ -777,7 +790,7 @@
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
NodeNotVersionedException, BranchNotFoundException,
- RevisionAlreadyExistException {
+ RevisionAlreadyExistException, InsufficientStorageException {
merge(token, strUri, mainBranch.getBranchName(),
branch.getBranchName(), newRevisionDescriptor, revisionContent);
@@ -802,7 +815,7 @@
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
NodeNotVersionedException, BranchNotFoundException,
- RevisionAlreadyExistException {
+ RevisionAlreadyExistException, InsufficientStorageException {
// Retrieve the associated object
ObjectNode associatedObject =
@@ -894,7 +907,7 @@
throws ObjectNotFoundException, AccessDeniedException,
LinkedObjectNotFoundException, ServiceAccessException,
RevisionDescriptorNotFoundException, ObjectLockedException,
- RevisionNotFoundException {
+ RevisionNotFoundException, InsufficientStorageException {
// Retrieve the associated object
ObjectNode associatedObject =
@@ -966,7 +979,12 @@
RevisionDescriptorNotFoundException, ObjectLockedException {
// Invoke interceptors
- invokeInterceptors(token, revisionDescriptors, null, null, PRE_REMOVE);
+ try {
+ invokeInterceptors(token, revisionDescriptors, null, null, PRE_REMOVE);
+ }
+ catch(InsufficientStorageException e) {
+ // could not happen during remove
+ }
// Retrieve the associated object
ObjectNode associatedObject = structureHelper.retrieve
@@ -990,8 +1008,13 @@
objectUri.getStore().removeRevisionDescriptors(objectUri);
// Invoke interceptors
- invokeInterceptors(token, revisionDescriptors, null, null,
- POST_REMOVE);
+ try {
+ invokeInterceptors(token, revisionDescriptors, null, null,
+ POST_REMOVE);
+ }
+ catch(InsufficientStorageException e) {
+ // could not happen during remove
+ }
}
@@ -1048,7 +1071,12 @@
(objectUri, revisionNumber);
// Invoke interceptors
- invokeInterceptors(token, null, revisionDescriptor, null, PRE_REMOVE);
+ try {
+ invokeInterceptors(token, null, revisionDescriptor, null, PRE_REMOVE);
+ }
+ catch(InsufficientStorageException e) {
+ // could not happen during remove
+ }
objectUri.getStore().removeRevisionContent
(objectUri, revisionDescriptor);
@@ -1056,7 +1084,12 @@
.removeRevisionDescriptor(objectUri, revisionNumber);
// Invoke interceptors
- invokeInterceptors(token, null, revisionDescriptor, null, POST_REMOVE);
+ try {
+ invokeInterceptors(token, null, revisionDescriptor, null, POST_REMOVE);
+ }
+ catch(InsufficientStorageException e) {
+ // could not happen during remove
+ }
}
@@ -1079,7 +1112,8 @@
throws ObjectNotFoundException, AccessDeniedException,
RevisionAlreadyExistException, LinkedObjectNotFoundException,
ServiceAccessException, RevisionDescriptorNotFoundException,
- ObjectLockedException, NodeNotVersionedException {
+ ObjectLockedException, NodeNotVersionedException,
+ InsufficientStorageException {
// Retrieve the associated object
ObjectNode associatedObject =
@@ -1205,7 +1239,7 @@
NodeRevisionContent revisionContent, int type)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
- ServiceAccessException {
+ ServiceAccessException, InsufficientStorageException {
ContentInterceptor[] contentInterceptors =
namespace.getContentInterceptors();
for (int i = 0; i < contentInterceptors.length; i++) {
diff -u -r jakarta-slide/src/share/org/apache/slide/content/ContentInterceptor.java
jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/ContentInterceptor.java
--- jakarta-slide/src/share/org/apache/slide/content/ContentInterceptor.java Sat
Apr 20 15:58:36 2002
+++
+jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content/ContentInterceptor.java
+ Sun Apr 28 13:26:36 2002
@@ -149,6 +149,7 @@
* found
* @throws ObjectLockedException if an object is locked
* @throws ServiceAccessException low-level service failure
+ * @throws InsufficientStorageException if storage is not sufficient
*/
public void preStoreContent
(SlideToken token, NodeRevisionDescriptors revisionDescriptors,
@@ -156,7 +157,7 @@
NodeRevisionContent revisionContent)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
- ServiceAccessException;
+ ServiceAccessException, InsufficientStorageException;
/**
@@ -176,6 +177,7 @@
* found
* @throws ObjectLockedException if an object is locked
* @throws ServiceAccessException low-level service failure
+ * @throws InsufficientStorageException if storage is not sufficient
*/
public void postStoreContent
(SlideToken token, NodeRevisionDescriptors revisionDescriptors,
@@ -183,7 +185,7 @@
NodeRevisionContent revisionContent)
throws AccessDeniedException, ObjectNotFoundException,
LinkedObjectNotFoundException, ObjectLockedException,
- ServiceAccessException;
+ ServiceAccessException, InsufficientStorageException;
/**
Only in jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content:
InsufficientStorageException.java
Only in jakarta-slide-InsufficientStorageException/src/share/org/apache/slide/content:
UserQuotaContentInterceptor.java
diff -u -r
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java
jakarta-slide-InsufficientStorageException/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java
--- jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java
Thu Mar 28 06:41:44 2002
+++
+jakarta-slide-InsufficientStorageException/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java
+ Sun Apr 28 14:47:13 2002
@@ -543,6 +543,8 @@
return getErrorCode((ServiceAccessException)ex);
} catch(ObjectLockedException e) {
return WebdavStatus.SC_LOCKED;
+ } catch(InsufficientStorageException e) {
+ return WebdavStatus.SC_INSUFFICIENT_STORAGE;
} catch(SlideException e) {
return WebdavStatus.SC_INTERNAL_SERVER_ERROR;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>