directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r676006 - in /directory/apacheds/branches/bigbang: core-entry/src/main/java/org/apache/directory/server/core/entry/ core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-store/src/main/java/org/apache/directory...
Date Fri, 11 Jul 2008 15:58:30 GMT
Author: elecharny
Date: Fri Jul 11 08:58:29 2008
New Revision: 676006

URL: http://svn.apache.org/viewvc?rev=676006&view=rev
Log:
Fixed a bug in the way we were storing entries in the backend.
If the entry is an instance of ClonedServerEntry, we should not
store it as is, but store the cloned entry instead, otherwise we may have problems when restoring
the entry back.

Modified:
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java?rev=676006&r1=676005&r2=676006&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
(original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
Fri Jul 11 08:58:29 2008
@@ -72,6 +72,15 @@
     }
 
 
+    /**
+     * @return the cloned Entry
+     */
+    public ServerEntry getClonedEntry()
+    {
+        return clonedEntry;
+    }
+
+
     public void add( AttributeType attributeType, byte[]... values ) throws NamingException
     {
         clonedEntry.add( attributeType, values );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=676006&r1=676005&r2=676006&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Fri Jul 11 08:58:29 2008
@@ -449,7 +449,7 @@
     
     public final void add( AddOperationContext addContext ) throws Exception
     {
-        store.add( addContext.getDn(), addContext.getEntry() );
+        store.add( addContext.getDn(), ((ClonedServerEntry)addContext.getEntry()).getClonedEntry()
);
     }
 
 

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=676006&r1=676005&r2=676006&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Fri Jul 11 08:58:29 2008
@@ -37,6 +37,7 @@
 import jdbm.recman.CacheRecordManager;
 
 import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerStringValue;
@@ -1007,6 +1008,11 @@
 
     public void add( LdapDN normName, ServerEntry entry ) throws Exception
     {
+        if ( entry instanceof ClonedServerEntry )
+        {
+            throw new Exception( "Cannot store a ClonedServerEntry" );
+        }
+        
         Long id;
         Long parentId;
 
@@ -1237,6 +1243,11 @@
      */
     private void add( Long id, ServerEntry entry, EntryAttribute mods ) throws Exception
     {
+        if ( entry instanceof ClonedServerEntry )
+        {
+            throw new Exception( "Cannot store a ClonedServerEntry" );
+        }
+        
         String modsOid = oidRegistry.getOid( mods.getId() );
 
         if ( hasUserIndexOn( modsOid ) )
@@ -1286,6 +1297,11 @@
      */
     private void remove( Long id, ServerEntry entry, EntryAttribute mods ) throws Exception
     {
+        if ( entry instanceof ClonedServerEntry )
+        {
+            throw new Exception( "Cannot store a ClonedServerEntry" );
+        }
+        
         String modsOid = oidRegistry.getOid( mods.getId() );
 
         if ( hasUserIndexOn( modsOid ) )
@@ -1363,6 +1379,11 @@
      */
     private void replace( Long id, ServerEntry entry, EntryAttribute mods ) throws Exception
     {
+        if ( entry instanceof ClonedServerEntry )
+        {
+            throw new Exception( "Cannot store a ClonedServerEntry" );
+        }
+        
         String modsOid = oidRegistry.getOid( mods.getId() );
 
         if ( hasUserIndexOn( modsOid ) )
@@ -1415,6 +1436,11 @@
 
     public void modify( LdapDN dn, ModificationOperation modOp, ServerEntry mods ) throws
Exception
     {
+        if ( mods instanceof ClonedServerEntry )
+        {
+            throw new Exception( "Cannot store a ClonedServerEntry" );
+        }
+        
         Long id = getEntryId( dn.toString() );
         ServerEntry entry = ( ServerEntry ) master.get( id );
 



Mime
View raw message