directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1334904 [3/3] - in /directory/apacheds/branches/apacheds-txns: core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/directory/server/core/api/interceptor/ core-api/src/main/java/org/apache/director...
Date Mon, 07 May 2012 07:53:22 GMT
Modified: directory/apacheds/branches/apacheds-txns/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=1334904&r1=1334903&r2=1334904&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
(original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
Mon May  7 07:53:21 2012
@@ -214,6 +214,15 @@ public class ReferralInterceptor extends
         Value<?> subschemaSubentry = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT
).get();
         subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString()
);
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void reinitLogicalData(  DirectoryService directoryService  ) throws LdapException
+    {
+        referralManager.reinitialize( directoryService );
+    }
 
 
     /**
@@ -250,11 +259,11 @@ public class ReferralInterceptor extends
         if ( isReferral )
         {
             // We have to add it to the referralManager
-            referralManager.lockWrite();
-
+            
+            // Ensure logical data consistency
+            directoryService.getTxnManager().startLogicalDataChange();
+            
             referralManager.addReferral( entry );
-
-            referralManager.unlock();
         }
     }
 
@@ -287,11 +296,11 @@ public class ReferralInterceptor extends
         if ( ( entry != null ) && isReferral( entry ) )
         {
             // We have to remove it from the referralManager
-            referralManager.lockWrite();
 
+            // Ensure logical data consistency
+            directoryService.getTxnManager().startLogicalDataChange();
+            
             referralManager.removeReferral( entry );
-
-            referralManager.unlock();
         }
     }
 
@@ -329,15 +338,14 @@ public class ReferralInterceptor extends
         // TODO : entries should be locked until the operation is done on it.
         if ( newEntry != null )
         {
-            referralManager.lockWrite();
-
             if ( referralManager.isReferral( newEntry.getDn() ) )
             {
+                // Ensure logical data consistency
+                directoryService.getTxnManager().startLogicalDataChange();
+                
                 referralManager.removeReferral( modifyContext.getEntry() );
                 referralManager.addReferral( newEntry );
             }
-
-            referralManager.unlock();
         }
     }
 
@@ -357,12 +365,12 @@ public class ReferralInterceptor extends
         if ( isReferral )
         {
             // Update the referralManager
-            referralManager.lockWrite();
+            
+            // Ensure logical data consistency
+            directoryService.getTxnManager().startLogicalDataChange();
 
             referralManager.addReferral( moveContext.getModifiedEntry() );
             referralManager.removeReferral( moveContext.getOriginalEntry() );
-
-            referralManager.unlock();
         }
     }
 
@@ -382,12 +390,11 @@ public class ReferralInterceptor extends
             // Update the referralManager
             Entry newEntry = moveAndRenameContext.getModifiedEntry();
 
-            referralManager.lockWrite();
-
+            // Ensure logical data consistency
+            directoryService.getTxnManager().startLogicalDataChange();
+            
             referralManager.addReferral( newEntry );
             referralManager.removeReferral( moveAndRenameContext.getOriginalEntry() );
-
-            referralManager.unlock();
         }
     }
 
@@ -411,12 +418,11 @@ public class ReferralInterceptor extends
 
             Entry newEntry = nexus.lookup( lookupContext );
 
-            referralManager.lockWrite();
-
+            // Ensure logical data consistency
+            directoryService.getTxnManager().startLogicalDataChange();
+            
             referralManager.addReferral( newEntry );
             referralManager.removeReferral( ((ClonedServerEntry)renameContext.getEntry()).getOriginalEntry()
);
-
-            referralManager.unlock();
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-txns/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1334904&r1=1334903&r2=1334904&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
(original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
Mon May  7 07:53:21 2012
@@ -193,8 +193,31 @@ public class SubentryInterceptor extends
             TRIGGER_EXECUTION_SUBENTRIES_AT
             };
 
-        ssParser = new SubtreeSpecificationParser( schemaManager );
+        ssParser = new SubtreeSpecificationParser( schemaManager );  
+        
+        // Init the sub entry cache
+        initializeSubEntryCache();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void reinitLogicalData(  DirectoryService directoryService  ) throws LdapException
+    {
+        initializeSubEntryCache();
+    }
+
 
+    //-------------------------------------------------------------------------------------------
+    // Helper methods
+    //-------------------------------------------------------------------------------------------
+    
+    /**
+     * Initializes the subentry cache
+     */
+    private void initializeSubEntryCache() throws LdapException
+    {
         // prepare to find all subentries in all namingContexts
         Set<String> suffixes = nexus.listSuffixes();
         ExprNode filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
@@ -265,13 +288,10 @@ public class SubentryInterceptor extends
                     LOG.error( I18n.err( I18n.ERR_168 ), e );
                 }
             }
-        }
+        } 
     }
-
-
-    //-------------------------------------------------------------------------------------------
-    // Helper methods
-    //-------------------------------------------------------------------------------------------
+    
+    
     /**
      * Return the list of AdministrativeRole for a subentry
      */
@@ -899,6 +919,7 @@ public class SubentryInterceptor extends
              * ----------------------------------------------------------------
              */
             setSubtreeSpecification( subentry, entry );
+            directoryService.getTxnManager().startLogicalDataChange();
             directoryService.getSubentryCache().addSubentry( dn, subentry );
 
             // Now inject the subentry into the backend
@@ -989,6 +1010,7 @@ public class SubentryInterceptor extends
         // We first remove the re
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
+            directoryService.getTxnManager().startLogicalDataChange();
             Subentry removedSubentry = directoryService.getSubentryCache().getSubentry( dn
);
 
             /* ----------------------------------------------------------------
@@ -1072,6 +1094,7 @@ public class SubentryInterceptor extends
         // Check if we have a modified subentry attribute in a Subentry entry
         if ( containsSubentryOC && isSubtreeSpecificationModification )
         {
+            directoryService.getTxnManager().startLogicalDataChange();
             Subentry subentry = directoryService.getSubentryCache().removeSubentry( dn );
             SubtreeSpecification ssOld = subentry.getSubtreeSpecification();
             SubtreeSpecification ssNew;
@@ -1249,6 +1272,7 @@ public class SubentryInterceptor extends
             // the new parent is an AP
             checkAdministrativeRole( moveContext, newSuperiorDn );
 
+            directoryService.getTxnManager().startLogicalDataChange();
             Subentry subentry = directoryService.getSubentryCache().removeSubentry( oldDn
);
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
@@ -1352,6 +1376,7 @@ public class SubentryInterceptor extends
 
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
+            directoryService.getTxnManager().startLogicalDataChange();
             Subentry subentry = directoryService.getSubentryCache().removeSubentry( oldDn
);
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
@@ -1447,6 +1472,7 @@ public class SubentryInterceptor extends
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
             // @Todo To be reviewed !!!
+            directoryService.getTxnManager().startLogicalDataChange();
             Subentry subentry = directoryService.getSubentryCache().removeSubentry( oldDn
);
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();



Mime
View raw message