ozeigermann    2004/05/05 05:07:30

  Modified:    src/webdav/server/org/apache/slide/webdav/util
                        UriHandler.java
               src/share/org/apache/slide/store ExtendedStore.java
  Log:
  Reverted fix for bug #26913 in expectation of something cleaner
  
  Revision  Changes    Path
  1.30      +39 -49    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/UriHandler.java
  
  Index: UriHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/UriHandler.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- UriHandler.java   1 Apr 2004 15:37:18 -0000       1.29
  +++ UriHandler.java   5 May 2004 12:07:30 -0000       1.30
  @@ -42,15 +42,13 @@
   import org.apache.slide.lock.ObjectLockedException;
   import org.apache.slide.security.AccessDeniedException;
   import org.apache.slide.event.VetoException;
  - 
  +
   
       /**
    * Helper class for the handling of URIs
        */
   public class UriHandler implements DeltavConstants, AclConstants, DaslConstants {
           
  -    private final static Object HISTORY_LOCK = new Object();
  -        
       /**
        * Factory method.
        */
  @@ -107,54 +105,46 @@
           Content content = nsaToken.getContentHelper();
           String hpath = hpathHandler.toString();
           
  -        // XXX guarantees that reading and writing of history counting property
  -        // is atomic. This is necessary as part of the fix to the problem described 
in
  -        // bug #26913. While the history counter is incremented no other tx can be 
allowed
  -        // to access the counter, that's why a write lock that is valid until 
commit is needed.
  -        // As this requires locking going through to the store and must thus tunnel 
caching
  -        // the other part of the fix is a HACK in ExtendedStore
  -        synchronized (HISTORY_LOCK) {
  -            NodeRevisionDescriptors hpathNrds =
  -                content.retrieve( sToken, hpath );
  -            
  -            NodeRevisionDescriptor hpathNrd =
  -                content.retrieve( sToken, hpathNrds );
  -            
  -            NodeProperty nextHnProp = hpathNrd.getProperty(I_NEXT_HISTORY_NAME,
  -                                                           
NamespaceCache.SLIDE_URI);
  -            if (nextHnProp == null) {
  -                // convert to slide namespace if this property is still
  -                // in DAV: namespace
  -                nextHnProp = hpathNrd.getProperty( I_NEXT_HISTORY_NAME );
  -                if (nextHnProp != null) {
  -                    hpathNrd.removeProperty(nextHnProp);
  -                    nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
  -                                                  nextHnProp.getValue(),
  -                                                  NamespaceCache.SLIDE_URI);
  -                    nextHnProp.setKind( NodeProperty.Kind.PROTECTED );
  -                    hpathNrd.setProperty( nextHnProp );
  -                }
  -            }
  -            if( nextHnProp == null || nextHnProp.getValue() == null ) {
  -                nextHnProp =
  -                    new NodeProperty(I_NEXT_HISTORY_NAME,
  -                                     I_INITIAL_HISTORY_NAME,
  -                                     NamespaceCache.SLIDE_URI);
  +        NodeRevisionDescriptors hpathNrds =
  +            content.retrieve( sToken, hpath );
  +        
  +        NodeRevisionDescriptor hpathNrd =
  +            content.retrieve( sToken, hpathNrds );
  +        
  +        NodeProperty nextHnProp = hpathNrd.getProperty(I_NEXT_HISTORY_NAME,
  +                                                       NamespaceCache.SLIDE_URI);
  +        if (nextHnProp == null) {
  +            // convert to slide namespace if this property is still
  +            // in DAV: namespace
  +            nextHnProp = hpathNrd.getProperty( I_NEXT_HISTORY_NAME );
  +            if (nextHnProp != null) {
  +                hpathNrd.removeProperty(nextHnProp);
  +                nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
  +                                              nextHnProp.getValue(),
  +                                              NamespaceCache.SLIDE_URI);
                   nextHnProp.setKind( NodeProperty.Kind.PROTECTED );
                   hpathNrd.setProperty( nextHnProp );
               }
  -            
  -            String nextHnStr = (String)nextHnProp.getValue();
  -            result = new UriHandler( hpath+"/"+nextHnStr );
  -            
  -            long nextHnLong = Long.parseLong( nextHnStr );
  -            nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
  -                                          String.valueOf(nextHnLong + 1),
  -                                          NamespaceCache.SLIDE_URI );
  +        }
  +        if( nextHnProp == null || nextHnProp.getValue() == null ) {
  +            nextHnProp =
  +                new NodeProperty(I_NEXT_HISTORY_NAME,
  +                                 I_INITIAL_HISTORY_NAME,
  +                                 NamespaceCache.SLIDE_URI);
  +            nextHnProp.setKind( NodeProperty.Kind.PROTECTED );
               hpathNrd.setProperty( nextHnProp );
  -            
  -            content.store( sToken, hpath, hpathNrd, null ); //revisionContent = null
           }
  +        
  +        String nextHnStr = (String)nextHnProp.getValue();
  +        result = new UriHandler( hpath+"/"+nextHnStr );
  +        
  +        long nextHnLong = Long.parseLong( nextHnStr );
  +        nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
  +                                      String.valueOf(nextHnLong + 1),
  +                                      NamespaceCache.SLIDE_URI );
  +        hpathNrd.setProperty( nextHnProp );
  +        
  +        content.store( sToken, hpath, hpathNrd, null ); //revisionContent = null
                         
           return result;
       }
  
  
  
  1.9       +4 -12     
jakarta-slide/src/share/org/apache/slide/store/ExtendedStore.java
  
  Index: ExtendedStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/ExtendedStore.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ExtendedStore.java        30 Mar 2004 13:55:45 -0000      1.8
  +++ ExtendedStore.java        5 May 2004 12:07:30 -0000       1.9
  @@ -346,7 +346,7 @@
   
       public NodeRevisionContent retrieveRevisionContent(Uri uri, 
NodeRevisionDescriptor revisionDescriptor)
           throws ServiceAccessException, RevisionNotFoundException {
  -        if (contentStore.cacheResults() && contentCache != null && 
!omitCachingBecauseOfEvilHistoryHack(uri)) {
  +        if (contentStore.cacheResults() && contentCache != null) {
               if (isForceStoreEnlistment(uri)) {
                   enlist(this);
               }
  @@ -447,7 +447,7 @@
       //
   
       public ObjectNode retrieveObject(Uri uri) throws ServiceAccessException, 
ObjectNotFoundException {
  -        if (nodeStore.cacheResults() && !omitCachingBecauseOfEvilHistoryHack(uri)) {
  +        if (nodeStore.cacheResults()) {
               if (isForceStoreEnlistment(uri)) {
                   enlist(this);
               }
  @@ -689,7 +689,7 @@
       
       public NodeRevisionDescriptors retrieveRevisionDescriptors(Uri uri)
           throws ServiceAccessException, RevisionDescriptorNotFoundException {
  -        if (revisionDescriptorsStore.cacheResults() && 
!omitCachingBecauseOfEvilHistoryHack(uri)) {
  +        if (revisionDescriptorsStore.cacheResults()) {
               if (isForceStoreEnlistment(uri)) {
                   enlist(this);
               }
  @@ -754,7 +754,7 @@
   
       public NodeRevisionDescriptor retrieveRevisionDescriptor(Uri uri, 
NodeRevisionNumber revisionNumber)
           throws ServiceAccessException, RevisionDescriptorNotFoundException {
  -        if (revisionDescriptorStore.cacheResults() && 
!omitCachingBecauseOfEvilHistoryHack(uri)) {
  +        if (revisionDescriptorStore.cacheResults()) {
               if (isForceStoreEnlistment(uri)) {
                   enlist(this);
               }
  @@ -988,14 +988,6 @@
           getLogger().log(re, LOG_CHANNEL, Logger.CRITICAL);
           setRollbackOnly();
           throw re;
  -    }
  -
  -    // XXX HACK checks if the requested uri is the history folder. In this
  -    // case caching must be disabled to pass any lock operations to the physical 
store. 
  -    // This is needed as part of the fix to the problem described in
  -    // bug #26913
  -    protected boolean omitCachingBecauseOfEvilHistoryHack(Uri uri) {
  -        return ("/history".equals(uri.toString()));
       }
   
       protected class TxCacheWrapper implements ObjectCache {
  
  
  

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

Reply via email to