You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by pn...@apache.org on 2005/03/01 21:53:08 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/macro MacroImpl.java
pnever 2005/03/01 12:53:08
Modified: src/webdav/server/org/apache/slide/webdav/method Tag:
SLIDE_2_1_RELEASE_BRANCH AbstractWebdavMethod.java
CopyMethod.java
src/share/org/apache/slide/macro Tag:
SLIDE_2_1_RELEASE_BRANCH MacroImpl.java
Log:
Still too many forceStoreEnlistements: when copying, it is not required
to write-tlock the source.
Revision Changes Path
No revision
No revision
1.43.2.11 +26 -22 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
Index: AbstractWebdavMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java,v
retrieving revision 1.43.2.10
retrieving revision 1.43.2.11
diff -u -r1.43.2.10 -r1.43.2.11
--- AbstractWebdavMethod.java 30 Nov 2004 07:05:53 -0000 1.43.2.10
+++ AbstractWebdavMethod.java 1 Mar 2005 20:53:07 -0000 1.43.2.11
@@ -343,7 +343,7 @@
slideToken.setExternalTx();
// pure reads must be guaranteed to be inside transaction as well
slideToken.setForceStoreEnlistment(true);
- Transaction tx = externalTransaction.getTransaction();
+ Transaction tx = externalTransaction.getTransaction();
token.getTransactionManager().resume(tx);
transactionIsStarted = true;
}
@@ -374,12 +374,12 @@
}
/*
- * Check for object existence and cleanup locks only if we're not
+ * Check for object existence and cleanup locks only if we're not
* unlocking as part of finalizing a transaction. Otherwise we
* are making calls to the store that require a transaction to
* be in process while we're trying to commit or abort it the
* current transaction.
- */
+ */
if (!isEndofTransactionxUnlock)
{
try {
@@ -390,9 +390,9 @@
lock.clearExpiredLocks(slideToken, requestUri, listener);
if (listener.getUnlockCount() > 0) {
- // If we have have cleared any lock or any lock-null resource in
- // the previous step we commit this changes, otherwise they will
- // be lost if executeRequest() exits with an exception (e.g.
+ // If we have have cleared any lock or any lock-null resource in
+ // the previous step we commit this changes, otherwise they will
+ // be lost if executeRequest() exits with an exception (e.g.
// because of Not Found 404)
token.commit();
token.begin();
@@ -414,7 +414,7 @@
} catch (SlideException ex) {
int statusCode = getErrorCode( ex );
sendError( statusCode, ex );
- // do not throw exception as the response code has already been set,
+ // do not throw exception as the response code has already been set,
// otherwise the servlet will log this as an error and issue a stack trace
// throw new WebdavException( statusCode );
} catch (Exception ex) {
@@ -428,7 +428,7 @@
try {
token.rollback();
} catch (Exception e) {
- // TODO
+ // TODO
e.printStackTrace();
}
}
@@ -817,7 +817,7 @@
/**
* Checks if Slide is configured to allow at most a single write request at a time.
- * @return <code>true</code> if there can be at most one write request at a time
+ * @return <code>true</code> if there can be at most one write request at a time
*/
protected boolean isSequentialWrite() {
String sm = token.getNamespaceConfig().getParameter("sequential-mode");
@@ -826,7 +826,7 @@
/**
* Checks if Slide is configured to allow reads while write requests are being executed.
- * @return <code>true</code> if reads are disallowed during writes
+ * @return <code>true</code> if reads are disallowed during writes
*/
protected boolean isSequentialRead() {
return "full".equalsIgnoreCase(token.getNamespaceConfig().getParameter("sequential-mode"));
@@ -1014,10 +1014,14 @@
}
protected boolean isLockNull( String uriStr ) throws ServiceAccessException {
+ return isLockNull(uriStr, slideToken);
+ }
+
+ protected boolean isLockNull( String uriStr, SlideToken stoken ) throws ServiceAccessException {
boolean isLockNull = false;
try {
NodeRevisionDescriptor nrd =
- content.retrieve(slideToken, content.retrieve(slideToken, uriStr));
+ content.retrieve(stoken, content.retrieve(stoken, uriStr));
isLockNull = isLockNull( nrd );
}
catch (ServiceAccessException x) {
@@ -1081,7 +1085,7 @@
protected boolean checkIfHeaders(HttpServletRequest request,
HttpServletResponse response,
ResourceInfo resourceInfo)
- throws IOException
+ throws IOException
{
// the ETag without apostrophes ("), we use apostrophes as delimiters
// to because some clients provide If header with out apostrophes
@@ -1149,9 +1153,9 @@
while (commaTokenizer.hasMoreTokens()) {
if (commaTokenizer.nextToken().equals(eTag)) {
// For GET and HEAD, we respond with 304 Not Modified.
- // For every other method, 412 Precondition Failed
+ // For every other method, 412 Precondition Failed
if ( ("GET".equals(request.getMethod()))
- || ("HEAD".equals(request.getMethod())) )
+ || ("HEAD".equals(request.getMethod())) )
{
response.sendError(
HttpServletResponse.SC_NOT_MODIFIED);
@@ -1188,11 +1192,11 @@
}
/**
- * Parses the date string given as one of the {@link #formats}.
+ * Parses the date string given as one of the {@link #formats}.
* If the date does not fit any of these formats it returns <code>null</code>.
- *
+ *
* @param headerValue date string from and HTTP header (e.g. If-Modified)
- * @return a Date representing the date given of <code>null</code> if
+ * @return a Date representing the date given of <code>null</code> if
* the string has no valid format.
*/
protected Date parseHttpDate(String headerValue) {
@@ -1739,7 +1743,7 @@
hContentTypeStr = req.getHeader(H_CONTENT_TYPE);
if (hContentTypeStr != null) {
stContentType = ST_DEFINED;
- hContentType = hContentTypeStr;
+ hContentType = hContentTypeStr;
}
}
@@ -1787,4 +1791,4 @@
return result;
}
}
-}
\ No newline at end of file
+}
1.67.2.3 +8 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java
Index: CopyMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
retrieving revision 1.67.2.2
retrieving revision 1.67.2.3
diff -u -r1.67.2.2 -r1.67.2.3
--- CopyMethod.java 8 Nov 2004 08:35:46 -0000 1.67.2.2
+++ CopyMethod.java 1 Mar 2005 20:53:07 -0000 1.67.2.3
@@ -32,6 +32,8 @@
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.ServiceAccessException;
import org.apache.slide.common.SlideException;
+import org.apache.slide.common.SlideToken;
+import org.apache.slide.common.SlideTokenWrapper;
import org.apache.slide.event.EventDispatcher;
import org.apache.slide.event.VetoException;
import org.apache.slide.lock.ObjectLockedException;
@@ -125,12 +127,14 @@
// Prevent dirty reads
slideToken.setForceStoreEnlistment(true);
+ SlideToken readonlyToken = new SlideTokenWrapper(slideToken);
+ readonlyToken.setForceStoreEnlistment(false);
boolean isCollection = isCollection(sourceUri);
// check lock-null resources
try {
- if (isLockNull(sourceUri)) {
+ if (isLockNull(sourceUri, readonlyToken)) {
int statusCode = WebdavStatus.SC_NOT_FOUND;
sendError( statusCode, "lock-null resource", new Object[]{sourceUri} );
throw new WebdavException( statusCode );
No revision
No revision
1.41.2.8 +12 -9 jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java
Index: MacroImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v
retrieving revision 1.41.2.7
retrieving revision 1.41.2.8
diff -u -r1.41.2.7 -r1.41.2.8
--- MacroImpl.java 23 Feb 2005 16:50:46 -0000 1.41.2.7
+++ MacroImpl.java 1 Mar 2005 20:53:08 -0000 1.41.2.8
@@ -550,6 +550,9 @@
Domain.debug("Copy object : from " + sourceUri + " to "
+ destinationUri);
+ SlideToken readonlyToken = new SlideTokenWrapper(token);
+ readonlyToken.setForceStoreEnlistment(false);
+
try {
// check for lock-null
if (isLockNull(token, sourceUri)) {
@@ -559,7 +562,7 @@
// Remember children of orginal source
ObjectNode sourceNode =
- structureHelper.retrieve(token, sourceUri, false);
+ structureHelper.retrieve(readonlyToken, sourceUri, false);
Enumeration sourceNodeChildren = sourceNode.enumerateChildren();
ObjectNode destinationNode = null;
@@ -569,7 +572,7 @@
copyRoute = copyRedirector.getRedirectedCopyRoute(copyRoute);
sourceUri = copyRoute.getSourceUri();
destinationUri = copyRoute.getDestinationUri();
- sourceNode = structureHelper.retrieve(token, sourceUri, false);
+ sourceNode = structureHelper.retrieve(readonlyToken, sourceUri, false);
// note that childrenList is *not* re-assigned. This might be a bug ...
}
@@ -663,15 +666,15 @@
// Now copying revision descriptors and content
NodeRevisionDescriptors sourceNrds =
- contentHelper.retrieve(token, sourceNode.getUri());
+ contentHelper.retrieve(readonlyToken, sourceNode.getUri());
if (sourceNrds.hasRevisions()) {
NodeRevisionDescriptor sourceNrd =
- contentHelper.retrieve(token, sourceNrds);
+ contentHelper.retrieve(readonlyToken, sourceNrds);
NodeRevisionContent sourceNrc = null;
//if (sourceNrd.getContentLength() > 0) {
if (!sourceNrd.propertyValueContains(WebdavConstants.P_RESOURCETYPE, WebdavConstants.E_COLLECTION)) {
sourceNrc =
- contentHelper.retrieve(token, sourceNrds, sourceNrd);
+ contentHelper.retrieve(readonlyToken, sourceNrds, sourceNrd);
}
if (parameters.isDeleteCreate() || !destinationExists) {
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org