pnever      2003/08/26 01:54:33

  Modified:    src/stores/slidestore/file XMLFileDescriptorsStore.java
  Log:
  Thanks to Oliver Zeigermann for providing this patch.
  
  Revision  Changes    Path
  1.7       +24 -18    
jakarta-slide/src/stores/slidestore/file/XMLFileDescriptorsStore.java
  
  Index: XMLFileDescriptorsStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/stores/slidestore/file/XMLFileDescriptorsStore.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLFileDescriptorsStore.java      21 Jan 2003 12:55:52 -0000      1.6
  +++ XMLFileDescriptorsStore.java      26 Aug 2003 08:54:33 -0000      1.7
  @@ -93,12 +93,12 @@
       
       /** Caches all the uri's definition */
       protected Hashtable definitions;
  -
  +    
       /**
        * Path from which files are stored.
        */
       protected String rootpath;
  -
  +    
       /**
        * Return de uri properties associated with uri
        * @return null if the uri has no properties
  @@ -106,7 +106,7 @@
       protected UriProperties getUriProperties(Uri uri) {
           return (UriProperties)definitions.get(uri.toString());
       }
  -
  +    
       
       // ---------------------------------------------------- ServiceImpl Methods
       
  @@ -267,7 +267,7 @@
           }
           aProps.storeObject(uri,object);
           // System.out.println("----------- XMLMemDescriptorsStore storeObject 3/n 
uri="+uri+" aProps="+aProps);
  -
  +        
       }
       
       
  @@ -286,11 +286,17 @@
               UriProperties aProps = getUriProperties(uri);
               // System.out.println("----------- XMLMemDescriptorsStore 1/n 
createObject uri="+uri+" aProps="+aProps);
               if (aProps == null) {
  -                storeObject(uri,object);
  -            }
  -            else {
  +                File aFile = UriProperties.getFile(rootpath, uri);
  +                if (aFile.exists()) {
  +                    throw new ObjectAlreadyExistsException(uri.toString());
  +                } else {
  +                    storeObject(uri,object);
  +                }
  +            } else {
                   aProps.createObject(uri, object);
               }
  +            
  +            
           } catch(ObjectNotFoundException e) {
               // Never happens
           }
  @@ -311,15 +317,15 @@
           if (aProps == null) {
               throw new ObjectNotFoundException(uri);
           }
  -
  +        
           // Delete the properties file
           File file = aProps.getFile(uri);
           if (file.exists()) {
  -          file.delete();
  +            file.delete();
           }
  -
  +        
           aProps.removeObject(uri,object);
  -
  +        
           // Delete the reference to the properties
           definitions.remove(uri.toString());
           
  @@ -415,7 +421,7 @@
           }
           aProps.putLock(uri,lock);
           // System.out.println("----------- XMLMemDescriptorsStore putLock 2/n 
uri="+uri+" aProps="+aProps);
  -     }
  +    }
       
       
       /**
  @@ -655,8 +661,8 @@
           }
           // System.out.println("----------- XMLMemDescriptorsStore 
removeRevisionDescriptor 2/n uri="+uri+" aProps="+aProps);
       }
  -
  -
  +    
  +    
       
   }
   
  
  
  

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

Reply via email to