pnever      2005/02/23 08:33:31

  Modified:    src/share/org/apache/slide/content Tag:
                        SLIDE_2_1_RELEASE_BRANCH ContentImpl.java
               src/share/org/apache/slide/lock Tag:
                        SLIDE_2_1_RELEASE_BRANCH LockImpl.java
               src/share/org/apache/slide/structure Tag:
                        SLIDE_2_1_RELEASE_BRANCH StructureImpl.java
               src/webdav/server/org/apache/slide/webdav/util Tag:
                        SLIDE_2_1_RELEASE_BRANCH WebdavUtils.java
  Log:
  Removed some unnecessary forceStoreEnlistments
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.60.2.1  +11 -20    
jakarta-slide/src/share/org/apache/slide/content/ContentImpl.java
  
  Index: ContentImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/content/ContentImpl.java,v
  retrieving revision 1.60
  retrieving revision 1.60.2.1
  diff -u -r1.60 -r1.60.2.1
  --- ContentImpl.java  5 Aug 2004 15:44:57 -0000       1.60
  +++ ContentImpl.java  23 Feb 2005 16:33:30 -0000      1.60.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.
  @@ -23,28 +23,17 @@
   
   package org.apache.slide.content;
   
  +import org.apache.slide.common.*;
  +import org.apache.slide.structure.*;
  +
   import java.lang.reflect.Method;
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.Vector;
  -
  -import org.apache.slide.common.Domain;
  -import org.apache.slide.common.Namespace;
  -import org.apache.slide.common.NamespaceConfig;
  -import org.apache.slide.common.ServiceAccessException;
  -import org.apache.slide.common.SlideToken;
  -import org.apache.slide.common.Uri;
  -import org.apache.slide.common.UriPath;
   import org.apache.slide.lock.Lock;
   import org.apache.slide.lock.ObjectLockedException;
   import org.apache.slide.security.AccessDeniedException;
   import org.apache.slide.security.Security;
  -import org.apache.slide.structure.ActionNode;
  -import org.apache.slide.structure.LinkedObjectNotFoundException;
  -import org.apache.slide.structure.ObjectNode;
  -import org.apache.slide.structure.ObjectNotFoundException;
  -import org.apache.slide.structure.Structure;
  -import org.apache.slide.structure.SubjectNode;
   import org.apache.slide.util.Configuration;
   import org.apache.slide.event.EventDispatcher;
   import org.apache.slide.event.ContentEvent;
  @@ -426,7 +415,9 @@
           ServiceAccessException, ObjectLockedException, VetoException {
           
           // Check parent exists and is not lock-null
  -        checkParentExists(strUri, token);
  +        SlideTokenWrapper readOnlyToken = new SlideTokenWrapper(token);
  +        readOnlyToken.setForceStoreEnlistment(false);
  +        checkParentExists(strUri, readOnlyToken);
           
           // Retrieve the associated object
           ObjectNode associatedObject =
  
  
  
  No                   revision
  No                   revision
  1.47.2.2  +15 -18    
jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java
  
  Index: LockImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java,v
  retrieving revision 1.47.2.1
  retrieving revision 1.47.2.2
  diff -u -r1.47.2.1 -r1.47.2.2
  --- LockImpl.java     3 Sep 2004 14:42:12 -0000       1.47.2.1
  +++ LockImpl.java     23 Feb 2005 16:33:30 -0000      1.47.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.
  @@ -23,17 +23,12 @@
   
   package org.apache.slide.lock;
   
  +import org.apache.slide.common.*;
  +
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.Stack;
   import java.util.Vector;
  -
  -import org.apache.slide.common.Namespace;
  -import org.apache.slide.common.NamespaceConfig;
  -import org.apache.slide.common.ServiceAccessException;
  -import org.apache.slide.common.SlideException;
  -import org.apache.slide.common.SlideToken;
  -import org.apache.slide.common.Uri;
   import org.apache.slide.event.EventDispatcher;
   import org.apache.slide.event.LockEvent;
   import org.apache.slide.event.VetoException;
  @@ -95,15 +90,15 @@
           
       /**
        * Put a lock on a subject.
  -     * 
  +     *
        * @param slideToken The token to access slide.
        * @param lockToken Object containing all the lock information
        * @exception ServiceAccessException Low level service access exception
  -     * @exception ObjectNotFoundException One of the objects referenced 
  +     * @exception ObjectNotFoundException One of the objects referenced
        * in the lock token were not found
  -     * @exception ObjectIsAlreadyLockedException Object is already locked 
  +     * @exception ObjectIsAlreadyLockedException Object is already locked
        * with an incompatible lock token
  -     * @exception AccessDeniedException Insufficient credentials to allow 
  +     * @exception AccessDeniedException Insufficient credentials to allow
        * object locking
        */
       public void lock(SlideToken slideToken, NodeLock lockToken)
  @@ -489,7 +484,9 @@
                               boolean tryToLock)
           throws ServiceAccessException, ObjectNotFoundException {
           
  -        return isLockedInternal(slideToken, token, tryToLock, null);
  +        SlideTokenWrapper readOnlyToken = new SlideTokenWrapper(slideToken);
  +        readOnlyToken.setForceStoreEnlistment(false);
  +        return isLockedInternal(readOnlyToken, token, tryToLock, null);
           
       }
       
  @@ -547,7 +544,7 @@
               
               if (ownerNode != null &&
                   !ownerNode.equals(SubjectNode.UNAUTHENTICATED) &&
  -                ownerNode.equals(principalNode)) 
  +                ownerNode.equals(principalNode))
               {
                   return true;
               }
  
  
  
  No                   revision
  No                   revision
  1.49.2.4  +22 -16    
jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java
  
  Index: StructureImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v
  retrieving revision 1.49.2.3
  retrieving revision 1.49.2.4
  diff -u -r1.49.2.3 -r1.49.2.4
  --- StructureImpl.java        27 Oct 2004 15:43:11 -0000      1.49.2.3
  +++ StructureImpl.java        23 Feb 2005 16:33:31 -0000      1.49.2.4
  @@ -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.
  @@ -23,19 +23,13 @@
   
   package org.apache.slide.structure;
   
  +import org.apache.slide.common.*;
  +
   import java.util.ArrayList;
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.List;
   import java.util.Vector;
  -
  -import org.apache.slide.common.Namespace;
  -import org.apache.slide.common.NamespaceConfig;
  -import org.apache.slide.common.ServiceAccessException;
  -import org.apache.slide.common.SlideToken;
  -import org.apache.slide.common.Uri;
  -import org.apache.slide.common.UriPath;
  -import org.apache.slide.common.UriTokenizer;
   import org.apache.slide.content.NodeRevisionDescriptor;
   import org.apache.slide.content.NodeRevisionNumber;
   import org.apache.slide.content.RevisionDescriptorNotFoundException;
  @@ -196,6 +190,10 @@
               
               String resolvedUri = uri.toString();
               
  +            SlideToken originalToken = token;
  +            token = new SlideTokenWrapper(token);  // do the traversing in 
read mode
  +            token.setForceStoreEnlistment(false);
  +            
               // 1 - Tokemization of the Uri
               UriTokenizer uriTokenizer = new UriTokenizer(token, 
uri.getNamespace(),
                                                            resolvedUri);
  @@ -260,8 +258,8 @@
               }
               
               // 10 - We return the last object which has been found
  -            
  -            result = courObject;
  +            // we will re-read it taken the real force-enlistment into 
account
  +            result = 
uri.getStore().retrieveObject(namespace.getUri(originalToken, courObject.uri));
           }
           
           return result;
  @@ -278,6 +276,10 @@
           // Fire event
           if ( StructureEvent.CREATE.isEnabled() ) 
EventDispatcher.getInstance().fireVetoableEvent(StructureEvent.CREATE, new 
StructureEvent(this, token, namespace, strUri));
           
  +        SlideToken originalToken = token;
  +        token = new SlideTokenWrapper(token);  // do the traversing in read 
mode
  +        token.setForceStoreEnlistment(false);
  +        
           // Checking roles
           Enumeration roles = securityHelper.getRoles(object);
           while (roles.hasMoreElements()) {
  @@ -357,7 +359,7 @@
                       //                    newObject = 
courUri.getStore().retrieveObject(courUri);
                       
                       // re-read the parent taking the forceEnlistment flag 
into account
  -                    Uri parentUri = namespace.getUri(token, 
parentObject.getUri());
  +                    Uri parentUri = namespace.getUri(originalToken, 
parentObject.getUri());
                       parentObject = 
parentUri.getStore().retrieveObject(parentUri);
                       // Add the newly created object to its parent's
                       // children list
  @@ -503,6 +505,9 @@
               catch (RevisionDescriptorNotFoundException e) {
                   // ignore silently
               }
  +            catch (Exception e) {
  +                e.printStackTrace();
  +            }
           }
       }
       
  @@ -713,3 +718,4 @@
       }
   }
   
  +
  
  
  
  No                   revision
  No                   revision
  1.24.2.4  +12 -13    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java
  
  Index: WebdavUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java,v
  retrieving revision 1.24.2.3
  retrieving revision 1.24.2.4
  diff -u -r1.24.2.3 -r1.24.2.4
  --- WebdavUtils.java  27 Sep 2004 08:46:55 -0000      1.24.2.3
  +++ WebdavUtils.java  23 Feb 2005 16:33:31 -0000      1.24.2.4
  @@ -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.
  @@ -23,19 +23,14 @@
   
   package org.apache.slide.webdav.util;
   
  +import org.apache.slide.common.*;
  +
   import java.net.SocketException;
   import java.security.Principal;
   import java.util.Enumeration;
  -
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpSession;
  -
   import org.apache.slide.authenticate.CredentialsToken;
  -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.SlideTokenImpl;
   import org.apache.slide.content.Content;
   import org.apache.slide.content.NodeRevisionDescriptor;
   import org.apache.slide.content.NodeRevisionDescriptors;
  @@ -371,6 +366,10 @@
       public static boolean isCollection
           (NamespaceAccessToken token, SlideToken slideToken,
            String path) {
  +
  +        SlideTokenWrapper readOnlyToken = new SlideTokenWrapper(slideToken);
  +        readOnlyToken.setForceStoreEnlistment(false);
  +        slideToken = readOnlyToken;
           
           // Added for DeltaV --start--
           if( Configuration.useVersionControl() ) {
  @@ -495,7 +494,7 @@
           // XXX SocketException pops up when the client closes the connection 
in the middle of transferring
           // the HTTP body, so this is no internal error, really!
           if (cause != null && cause instanceof SocketException) {
  -            // XXX is this a reasonable code? 
  +            // XXX is this a reasonable code?
               return WebdavStatus.SC_PRECONDITION_FAILED;
           } else if (cause == null || !(cause instanceof SlideException))  {
               //            ex.printStackTrace();
  
  
  

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

Reply via email to