directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r683513 - in /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core: event/EventInterceptor.java interceptor/context/MoveAndRenameOperationContext.java interceptor/context/RenameOperationContext.java
Date Thu, 07 Aug 2008 05:43:15 GMT
Author: akarasulu
Date: Wed Aug  6 22:43:14 2008
New Revision: 683513

URL: http://svn.apache.org/viewvc?rev=683513&view=rev
Log:
added cached newDn which is computed when needed and reused in rename based ops; added altered
entry in event interceptor to rename based opContexts to be used in change notifications

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=683513&r1=683512&r2=683513&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
Wed Aug  6 22:43:14 2008
@@ -220,6 +220,8 @@
             return;
         }
 
+        opContext.setAlteredEntry( opContext.lookup( opContext.getNewDn(), ByPassConstants.LOOKUP_BYPASS
) );
+        
         for ( final RegistrationEntry registration : selecting )
         {
             if ( EventType.isRename( registration.getCriteria().getEventMask() ) )
@@ -241,6 +243,8 @@
             return;
         }
 
+        opContext.setAlteredEntry( opContext.lookup( opContext.getNewDn(), ByPassConstants.LOOKUP_BYPASS
) );
+        
         for ( final RegistrationEntry registration : selecting )
         {
             if ( EventType.isMoveAndRename( registration.getCriteria().getEventMask() ) )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java?rev=683513&r1=683512&r2=683513&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
Wed Aug  6 22:43:14 2008
@@ -38,6 +38,8 @@
     /** The parent DN */
     private LdapDN parent;
 
+    /** Cached calculated new DN after move and rename */
+    private LdapDN newDn;
 
     /**
      * Creates a new instance of MoveAndRenameOperationContext.
@@ -95,6 +97,26 @@
         this.parent = parent;
     }
 
+    
+    /**
+     * Gets cached copy of already computed new name or creates it if not 
+     *
+     * @return the normalized new name after move and rename
+     * @throws Exception if the name cannot be normalized
+     */
+    public LdapDN getNewDn() throws Exception
+    {
+        if ( newDn == null )
+        {
+            newDn = new LdapDN( getParent().getUpName() );
+            newDn.add( getNewRdn().getUpName() );
+            newDn.normalize( session.getDirectoryService()
+                .getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+        }
+        
+        return newDn;
+    }
+    
 
     /**
      * @see Object#toString()

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java?rev=683513&r1=683512&r2=683513&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
Wed Aug  6 22:43:14 2008
@@ -39,9 +39,12 @@
  */
 public class RenameOperationContext extends AbstractChangeOperationContext
 {
-    /** The new DN */
+    /** The new RDN */
     private Rdn newRdn;
 
+    /** Cached copy of the new DN */
+    private LdapDN newDn;
+
     /** The flag to remove the old DN Attribute  */
     private boolean delOldDn;
 
@@ -108,6 +111,24 @@
 
 
     /**
+     * @return The new DN either computed if null or already computed
+     */
+    public LdapDN getNewDn() throws Exception
+    {
+        if ( newDn == null )
+        {
+            newDn = new LdapDN( getDn().getUpName() );
+            newDn.remove( newDn.size() - 1 );
+            newDn.add( newRdn.getUpName() );
+            newDn.normalize( session.getDirectoryService().getRegistries()
+                .getAttributeTypeRegistry().getNormalizerMapping() );
+        }
+        
+        return newDn;
+    }
+
+
+    /**
      * @return The new RDN
      */
     public Rdn getNewRdn()
@@ -147,6 +168,12 @@
     }
 
     
+    public void setAlteredEntry( ClonedServerEntry alteredEntry ) 
+    {
+        this.alteredEntry = alteredEntry;
+    }
+    
+    
     /**
      * @see Object#toString()
      */



Mime
View raw message