pnever      2004/10/18 01:42:59

  Modified:    src/share/org/apache/slide/macro Tag:
                        SLIDE_2_1_RELEASE_BRANCH CopyListener.java
                        MacroImpl.java
               src/webdav/server/org/apache/slide/webdav/method Tag:
                        SLIDE_2_1_RELEASE_BRANCH CopyMethod.java
                        MoveMethod.java
  Log:
  Fixed bug revealed by testcase functional\copy\mix\copyChangedProperties.xml:
  the DAV:owner property of the *copy* isn't set correctly to be the principal issuing 
the COPY request. Of course, if a resource existed at the destination location and is 
overwritten by the COPY operation, the owner should not change, as an existing 
resource is just being updated.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.6.2.1   +6 -6      jakarta-slide/src/share/org/apache/slide/macro/CopyListener.java
  
  Index: CopyListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/macro/CopyListener.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- CopyListener.java 28 Jul 2004 09:35:28 -0000      1.6
  +++ CopyListener.java 18 Oct 2004 08:42:57 -0000      1.6.2.1
  @@ -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.
  @@ -63,7 +63,7 @@
        *                             of the Macro helper (contained in the
        *                             MacroDeleteException.
        */
  -    public void afterCopy(String sourceUri, String destinationUri, boolean 
isRootOfCopy) throws SlideException;
  +    public void afterCopy(String sourceUri, String destinationUri, boolean 
isRootOfCopy, boolean destinationExists) throws SlideException;
       
   }
   
  
  
  
  1.41.2.2  +24 -24    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.1
  retrieving revision 1.41.2.2
  diff -u -r1.41.2.1 -r1.41.2.2
  --- MacroImpl.java    17 Aug 2004 15:33:39 -0000      1.41.2.1
  +++ MacroImpl.java    18 Oct 2004 08:42:57 -0000      1.41.2.2
  @@ -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.
  @@ -446,7 +446,7 @@
           try {
               if ( MacroEvent.MOVE.isEnabled() ) 
EventDispatcher.getInstance().fireVetoableEvent(MacroEvent.MOVE, new MacroEvent(this, 
token, namespace, sourceUri, destinationUri));
           } catch ( VetoException ve ) {
  -            throw new CopyMacroException(ve.getMessage()); // FIXME: Where is the 
MoveMacroException?    
  +            throw new CopyMacroException(ve.getMessage()); // FIXME: Where is the 
MoveMacroException?
           }
       }
       
  @@ -703,20 +703,20 @@
               
               // notify CopyListener
               if (copyListener != null) {
  -                copyListener.afterCopy(sourceUri, destinationUri, isRootOfCopy);
  +                copyListener.afterCopy(sourceUri, destinationUri, isRootOfCopy, 
destinationExists);
               }
               
               // We copy each of this object's children
               if (parameters.isRecursive()) {
  -                 while(sourceNodeChildren.hasMoreElements()) {
  -                     String childUri = (String) sourceNodeChildren.nextElement();
  -                     String childDestinationUri = destinationUri + childUri
  -                         .substring(sourceNode.getUri().length());
  -                     copyObject(token, childUri, childDestinationUri,
  -                                parameters, false, e, copyRedirector, copyListener,
  -                                deleteRedirector, deleteListener
  -                               );
  -                 }
  +                while(sourceNodeChildren.hasMoreElements()) {
  +                    String childUri = (String) sourceNodeChildren.nextElement();
  +                    String childDestinationUri = destinationUri + childUri
  +                        .substring(sourceNode.getUri().length());
  +                    copyObject(token, childUri, childDestinationUri,
  +                               parameters, false, e, copyRedirector, copyListener,
  +                               deleteRedirector, deleteListener
  +                              );
  +                }
               }
               
           } catch(SlideException ex) {
  @@ -776,14 +776,14 @@
                       }
                   }
   
  -                             // Removing links objects
  -                             if (currentObject.hasLinks()) {
  -                                     Enumeration links = 
currentObject.enumerateLinks();
  -                                     while (links.hasMoreElements()) {
  -                                             String linkUri = 
(String)links.nextElement();
  -                                             deleteObject(token, linkUri, e, 
deleteRedirector, deleteListener);
  -                                     }
  -                             }
  +                // Removing links objects
  +                if (currentObject.hasLinks()) {
  +                    Enumeration links = currentObject.enumerateLinks();
  +                    while (links.hasMoreElements()) {
  +                        String linkUri = (String)links.nextElement();
  +                        deleteObject(token, linkUri, e, deleteRedirector, 
deleteListener);
  +                    }
  +                }
                   
                   
                   // now let the client redirect
  
  
  
  No                   revision
  No                   revision
  1.67.2.1  +16 -39    
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
  retrieving revision 1.67.2.1
  diff -u -r1.67 -r1.67.2.1
  --- CopyMethod.java   2 Aug 2004 16:36:02 -0000       1.67
  +++ CopyMethod.java   18 Oct 2004 08:42:58 -0000      1.67.2.1
  @@ -23,56 +23,28 @@
   
   package org.apache.slide.webdav.method;
   
  -import java.io.IOException;
  -import java.util.ArrayList;
  -import java.util.Date;
  -import java.util.Enumeration;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Map;
  +import java.util.*;
  +import org.apache.slide.content.*;
  +import org.apache.slide.macro.*;
  +import org.apache.slide.webdav.util.*;
   
  +import java.io.IOException;
   import org.apache.slide.common.NamespaceAccessToken;
   import org.apache.slide.common.ServiceAccessException;
   import org.apache.slide.common.SlideException;
  -import org.apache.slide.content.BranchNotFoundException;
  -import org.apache.slide.content.NodeNotVersionedException;
  -import org.apache.slide.content.NodeProperty;
  -import org.apache.slide.content.NodeRevisionDescriptor;
  -import org.apache.slide.content.NodeRevisionDescriptors;
  -import org.apache.slide.content.NodeRevisionNumber;
  -import org.apache.slide.content.RevisionAlreadyExistException;
  -import org.apache.slide.content.RevisionDescriptorNotFoundException;
  -import org.apache.slide.content.RevisionNotFoundException;
   import org.apache.slide.event.EventDispatcher;
   import org.apache.slide.event.VetoException;
   import org.apache.slide.lock.ObjectLockedException;
  -import org.apache.slide.macro.CopyListener;
  -import org.apache.slide.macro.CopyRouteRedirector;
  -import org.apache.slide.macro.DeleteListener;
  -import org.apache.slide.macro.Macro;
  -import org.apache.slide.macro.MacroException;
  -import org.apache.slide.macro.MacroParameters;
   import org.apache.slide.security.AccessDeniedException;
   import org.apache.slide.structure.LinkedObjectNotFoundException;
   import org.apache.slide.structure.ObjectNode;
   import org.apache.slide.structure.ObjectNotFoundException;
  +import org.apache.slide.structure.SubjectNode;
   import org.apache.slide.util.Configuration;
   import org.apache.slide.util.XMLValue;
   import org.apache.slide.webdav.WebdavException;
   import org.apache.slide.webdav.WebdavServletConfig;
   import org.apache.slide.webdav.event.WebdavEvent;
  -import org.apache.slide.webdav.util.AclConstants;
  -import org.apache.slide.webdav.util.BindConstants;
  -import org.apache.slide.webdav.util.DeltavConstants;
  -import org.apache.slide.webdav.util.LabeledRevisionNotFoundException;
  -import org.apache.slide.webdav.util.PreconditionViolationException;
  -import org.apache.slide.webdav.util.PropertyHelper;
  -import org.apache.slide.webdav.util.UriHandler;
  -import org.apache.slide.webdav.util.VersioningHelper;
  -import org.apache.slide.webdav.util.ViolatedPrecondition;
  -import org.apache.slide.webdav.util.WebdavStatus;
  -import org.apache.slide.webdav.util.WebdavUtils;
   import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind;
   import org.apache.slide.webdav.util.resourcekind.CheckedInVersionControlled;
   import org.apache.slide.webdav.util.resourcekind.ResourceKind;
  @@ -181,7 +153,7 @@
                   // COPY on existing WSs or WRs is *not* restricted !!!
                   try {
                       if ( WebdavEvent.COPY.isEnabled() ) 
EventDispatcher.getInstance().fireVetoableEvent(WebdavEvent.COPY, new 
WebdavEvent(this));
  -
  +                    
                       content.retrieve(slideToken, destinationUri);
                       sendError = false;
                   }
  @@ -541,7 +513,7 @@
        *                             of the Macro helper (contained in the
        *                             MacroDeleteException.
        */
  -    public void afterCopy(String sourceUri, String destinationUri, boolean 
isRootOfCopy) throws SlideException {
  +    public void afterCopy(String sourceUri, String destinationUri, boolean 
isRootOfCopy, boolean destinationExists) throws SlideException {
           
           if(Configuration.useVersionControl()) {
               
  @@ -570,6 +542,11 @@
               // set some other properties
               destinationNrd.setLastModified( new Date() ); // P_GETLASTMODIFIED
               destinationNrd.setETag( PropertyHelper.computeEtag(destinationUri, 
destinationNrd) ); // P_GETETAG
  +            if (!destinationExists) {
  +                // copy is creating a new resource
  +                String creator = 
((SubjectNode)security.getPrincipal(slideToken)).getPath().lastSegment();
  +                destinationNrd.setOwner(creator);
  +            }
               
               content.store(slideToken, destinationNrds.getUri(), destinationNrd, 
null);
               
  
  
  
  1.72.2.2  +5 -5      
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java
  
  Index: MoveMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
  retrieving revision 1.72.2.1
  retrieving revision 1.72.2.2
  diff -u -r1.72.2.1 -r1.72.2.2
  --- MoveMethod.java   25 Sep 2004 20:38:43 -0000      1.72.2.1
  +++ MoveMethod.java   18 Oct 2004 08:42:58 -0000      1.72.2.2
  @@ -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.
  @@ -411,7 +411,7 @@
        *                             of the Macro helper (contained in the
        *                             MacroDeleteException.
        */
  -    public void afterCopy(String sourceUri, String destinationUri, boolean 
isRootOfCopy) throws SlideException {
  +    public void afterCopy(String sourceUri, String destinationUri, boolean 
isRootOfCopy, boolean destinationExists) throws SlideException {
   
           if( Configuration.useVersionControl() ) {
   
  
  
  

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

Reply via email to