pnever      2004/12/14 06:07:42

  Modified:    src/share/org/apache/slide/macro MacroImpl.java
               src/webdav/server/org/apache/slide/webdav/method
                        RebindMethod.java
  Log:
  REBIND Method: postcondition DAV:lock-deleted was not implemented.
  The Binding spec states that (non-inherited) locks are to be removed after
  rebinding a resource. If binding is enabled, Slide maps the MOVE method
  onto REBIND, so that MOVE was affected in this case too.
  
  Revision  Changes    Path
  1.52      +10 -4     
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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- MacroImpl.java    7 Dec 2004 14:10:06 -0000       1.51
  +++ MacroImpl.java    14 Dec 2004 14:07:42 -0000      1.52
  @@ -393,6 +393,12 @@
               
               structureHelper.addBinding( token, destinationParentNode, 
destinationSegment, sourceNode );
               structureHelper.removeBinding( token, sourceParentNode, 
sourceSegment );
  +            
  +            // Postcondition: DAV:lock-delete
  +            Enumeration locksEnum = lockHelper.enumerateLocks(token, 
destinationUri, false);
  +            while (locksEnum.hasMoreElements()) {
  +                lockHelper.unlock(token, (NodeLock)locksEnum.nextElement());
  +            }
           }
           catch (SlideException x) {
               e.addException(x);
  
  
  
  1.19      +33 -24    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/RebindMethod.java
  
  Index: RebindMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/RebindMethod.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RebindMethod.java 31 Oct 2004 11:32:40 -0000      1.18
  +++ RebindMethod.java 14 Dec 2004 14:07:42 -0000      1.19
  @@ -5,7 +5,7 @@
    *
    * ====================================================================
    *
  - * Copyright 1999-2002 The Apache Software Foundation 
  + * Copyright 1999-2002 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -24,12 +24,14 @@
   package org.apache.slide.webdav.method;
   
   import java.io.IOException;
  +import java.util.Enumeration;
   import java.util.List;
  -
   import org.apache.slide.common.NamespaceAccessToken;
   import org.apache.slide.common.ServiceAccessException;
   import org.apache.slide.common.SlideException;
  +import org.apache.slide.common.UriPath;
   import org.apache.slide.event.EventDispatcher;
  +import org.apache.slide.lock.NodeLock;
   import org.apache.slide.lock.ObjectLockedException;
   import org.apache.slide.structure.CrossServerBindingException;
   import org.apache.slide.structure.ObjectNode;
  @@ -59,8 +61,8 @@
       private ObjectNode sourceNode = null;
       private ObjectNode sourceParentNode = null;
       private ObjectNode collectionNode = null;
  -
  -
  +    
  +    
       /**
        * Constructor.
        *
  @@ -70,7 +72,7 @@
       public RebindMethod(NamespaceAccessToken token, WebdavServletConfig 
config) {
           super(token, config);
       }
  -
  +    
       /**
        * @see 
org.apache.slide.webdav.method.FineGrainedLockingMethod#acquireFineGrainLocks()
        */
  @@ -89,10 +91,10 @@
           if (collectionUri == null) {
               collectionUri = "/";
           }
  -
  +        
           List content;
  -
  -//        readRequestContent();
  +        
  +        //        readRequestContent();
           try{
               content = parseRequestContent(E_REBIND).getChildren();
               segment = MethodUtil.getChildText(content, E_SEGMENT);
  @@ -108,15 +110,15 @@
               sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
  -
  +        
           collectionUri = requestUri;
           if (collectionUri == null) {
               collectionUri = "/";
           }
  -
  +        
           overwrite = requestHeaders.getOverwrite(true);
       }
  -
  +    
       private void checkPreconditions() throws PreconditionViolationException, 
ServiceAccessException {
           resp.setStatus( WebdavStatus.SC_CREATED );
           UriHandler sourceUh = UriHandler.getUriHandler(sourceUri);
  @@ -125,7 +127,7 @@
           if (sourceParentUh != null) {
               sourceParentUri = sourceUh.getParentUriHandler().toString();
           }
  -
  +        
           try {
               collectionNode = structure.retrieve( slideToken, collectionUri );
           }
  @@ -133,7 +135,7 @@
               throw e;
           }
           catch (SlideException e) {} // ignore silently
  -
  +        
           try {
               sourceNode = structure.retrieve( slideToken, sourceUri );
           }
  @@ -141,7 +143,7 @@
               throw e;
           }
           catch (SlideException e) {} // ignore silently
  -
  +        
           try {
               sourceParentNode = structure.retrieve( slideToken, 
sourceParentUri );
           }
  @@ -149,7 +151,7 @@
               throw e;
           }
           catch (SlideException e) {} // ignore silently
  -
  +        
           if (collectionNode == null || !isCollection(collectionUri)) {
               throw new PreconditionViolationException(
                   new ViolatedPrecondition(C_REBIND_INTO_COLLECTION, 
WebdavStatus.SC_CONFLICT), collectionUri);
  @@ -178,17 +180,17 @@
               }
           }
       }
  -
  +    
       /**
        * Execute the request.
        *
        * @exception WebdavException
        */
       protected void executeRequest() throws WebdavException, IOException {
  -
  +        
           // Prevent dirty reads
           slideToken.setForceStoreEnlistment(true);
  -
  +        
           // check lock-null resources
           try {
               if (isLockNull(collectionUri)) {
  @@ -202,13 +204,20 @@
               sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
  -
  +        
           try {
               if ( WebdavEvent.REBIND.isEnabled() ) 
EventDispatcher.getInstance().fireVetoableEvent(WebdavEvent.REBIND, new 
WebdavEvent(this));
  -
  +            
               checkPreconditions();
               structure.addBinding( slideToken, collectionNode, segment, 
sourceNode );
               structure.removeBinding( slideToken, sourceParentNode, 
sourceSegment );
  +            
  +            // Postcondition: DAV:lock-delete
  +            UriPath destUp = new UriPath(collectionUri).child(segment);
  +            Enumeration locksEnum = lock.enumerateLocks(slideToken, 
destUp.toString(), false);
  +            while (locksEnum.hasMoreElements()) {
  +                lock.unlock(slideToken, (NodeLock)locksEnum.nextElement());
  +            }
           }
           catch (CrossServerBindingException e) {
               sendPreconditionViolation(
  @@ -250,6 +259,6 @@
               throw new WebdavException( statusCode );
           }
       }
  -
  +    
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to