directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r746410 - in /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core: ./ interceptor/context/
Date Fri, 20 Feb 2009 23:08:36 GMT
Author: elecharny
Date: Fri Feb 20 23:08:35 2009
New Revision: 746410

URL: http://svn.apache.org/viewvc?rev=746410&view=rev
Log:
Changed the operationContext and the CoreSession to be able to pass a paramater to avoid logging
when reverting

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/CoreSession.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/CoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/CoreSession.java?rev=746410&r1=746409&r2=746410&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/CoreSession.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/CoreSession.java
Fri Feb 20 23:08:35 2009
@@ -27,12 +27,12 @@
 import javax.naming.ldap.Control;
 
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.DefaultDirectoryService.LogChange;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
-import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -43,6 +43,7 @@
 import org.apache.directory.shared.ldap.message.DeleteRequest;
 import org.apache.directory.shared.ldap.message.ModifyDnRequest;
 import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.message.UnbindRequest;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
@@ -212,6 +213,16 @@
     
     /**
      * Adds an entry into the DirectoryService associated with this CoreSession.
+     * 
+     * @param entry the entry to add
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @exception Exception on failures to add the entry
+     */
+    void add( ServerEntry entry, LogChange log ) throws Exception;
+    
+    
+    /**
+     * Adds an entry into the DirectoryService associated with this CoreSession.
      * The flag is used to tell the server to ignore the referrals and manipulate
      * them as if they were normal entries.
      * 
@@ -224,6 +235,19 @@
     
     /**
      * Adds an entry into the DirectoryService associated with this CoreSession.
+     * The flag is used to tell the server to ignore the referrals and manipulate
+     * them as if they were normal entries.
+     * 
+     * @param entry the entry to add
+     * @param ignoreReferral a flag to tell the server to ignore referrals
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @exception Exception on failures to add the entry
+     */
+    void add( ServerEntry entry, boolean ignoreReferral, LogChange log ) throws Exception;
+    
+    
+    /**
+     * Adds an entry into the DirectoryService associated with this CoreSession.
      * The entry is built using the received AddRequest.
      * 
      * @param AddRequest the request to execute
@@ -233,6 +257,17 @@
     
     
     /**
+     * Adds an entry into the DirectoryService associated with this CoreSession.
+     * The entry is built using the received AddRequest.
+     * 
+     * @param AddRequest the request to execute
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @exception Exception on failures to add the entry
+     */
+    void add( AddRequest addRequest, LogChange log ) throws Exception;
+    
+    
+    /**
      * Checks to see if an attribute in an entry contains a value.
      *
      * @param dn the distinguished name of the entry to check
@@ -273,7 +308,23 @@
      * @throws Exception if there are failures while deleting the entry
      */
     void delete( LdapDN dn ) throws Exception;
+
+    
+    /**
+     * Deletes an entry in the server.
+     *
+     * @param dn the distinguished name of the entry to delete
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while deleting the entry
+     */
+    void delete( LdapDN dn, LogChange log ) throws Exception;
+    
     
+    void delete( DeleteRequest deleteRequest ) throws Exception;
+    
+    
+    void delete( DeleteRequest deleteRequest, LogChange log ) throws Exception;
+
     
     /**
      * Deletes an entry in the server.
@@ -287,9 +338,19 @@
     void delete( LdapDN dn, boolean ignoreReferral ) throws Exception;
     
     
-    void delete( DeleteRequest deleteRequest ) throws Exception;
+    /**
+     * Deletes an entry in the server.
+     * The flag is used to tell the server to ignore the referrals and manipulate
+     * them as if they were normal entries.
+     *
+     * @param dn the distinguished name of the entry to delete
+     * @param ignoreReferral a flag to tell the server to ignore referrals
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while deleting the entry
+     */
+    void delete( LdapDN dn, boolean ignoreReferral, LogChange log ) throws Exception;
+    
     
-
     /**
      * Checks to see if an entry exists. 
      */
@@ -330,6 +391,18 @@
     /**
      * Modifies an entry within the server by applying a list of modifications 
      * to the entry.
+     *
+     * @param dn the distinguished name of the entry to modify
+     * @param mods the list of modifications to apply
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while modifying the entry
+     */
+    void modify( LdapDN dn, List<Modification> mods, LogChange log ) throws Exception;
+    
+    
+    /**
+     * Modifies an entry within the server by applying a list of modifications 
+     * to the entry.
      * The flag is used to tell the server to ignore the referrals and manipulate
      * them as if they were normal entries.
      *
@@ -341,7 +414,25 @@
     void modify( LdapDN dn, List<Modification> mods, boolean ignoreReferral ) throws
Exception;
     
     
+    /**
+     * Modifies an entry within the server by applying a list of modifications 
+     * to the entry.
+     * The flag is used to tell the server to ignore the referrals and manipulate
+     * them as if they were normal entries.
+     *
+     * @param dn the distinguished name of the entry to modify
+     * @param ignoreReferral a flag to tell the server to ignore referrals
+     * @param mods the list of modifications to apply
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while modifying the entry
+     */
+    void modify( LdapDN dn, List<Modification> mods, boolean ignoreReferral, LogChange
log ) throws Exception;
+    
+    
     void modify( ModifyRequest modifyRequest ) throws Exception;
+    
+    
+    void modify( ModifyRequest modifyRequest, LogChange log ) throws Exception;
 
     
     /**
@@ -361,6 +452,18 @@
      * 
      * @param dn the distinguished name of the entry/branch to move
      * @param newParent the new parent under which the entry/branch is moved
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @exception if there are failures while moving the entry/branch
+     */
+    void move( LdapDN dn, LdapDN newParent, LogChange log ) throws Exception;
+    
+    
+    /**
+     * Moves an entry or a branch of entries at a specified distinguished name
+     * to a position under a new parent.
+     * 
+     * @param dn the distinguished name of the entry/branch to move
+     * @param newParent the new parent under which the entry/branch is moved
      * @param ignoreReferral a flag to tell the server to ignore referrals
      * @exception if there are failures while moving the entry/branch
      */
@@ -368,6 +471,19 @@
     
     
     /**
+     * Moves an entry or a branch of entries at a specified distinguished name
+     * to a position under a new parent.
+     * 
+     * @param dn the distinguished name of the entry/branch to move
+     * @param newParent the new parent under which the entry/branch is moved
+     * @param ignoreReferral a flag to tell the server to ignore referrals
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @exception if there are failures while moving the entry/branch
+     */
+    void move( LdapDN dn, LdapDN newParent, boolean ignoreReferral, LogChange log ) throws
Exception;
+    
+    
+    /**
      * Move an entry by changing its superior.
      *
      * @param modifyDnRequest The ModifyDN request
@@ -376,8 +492,14 @@
     void move( ModifyDnRequest modifyDnRequest ) throws Exception;
     
     
-//    void move( LdapDN dn, LdapDN newParent, Control[] requestControls, ReferralHandlingMode
refMode, 
-//        LdapDN authorized ) throws Exception;
+    /**
+     * Move an entry by changing its superior.
+     *
+     * @param modifyDnRequest The ModifyDN request
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while moving the entry/branch
+     */
+    void move( ModifyDnRequest modifyDnRequest, LogChange log ) throws Exception;
     
     
     /**
@@ -404,6 +526,22 @@
      * @param newParent the new parent under which the entry/branch is moved
      * @param newRdn the new relative distinguished name of the entry at the 
      * root of the branch
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @exception if there are failures while moving and renaming the entry
+     * or branch
+     */
+    void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn, LogChange
log ) throws Exception;
+    
+    
+    /**
+     * Moves and renames (the relative distinguished name of) an entry (or a 
+     * branch if the entry has children) at a specified distinguished name to 
+     * a position under a new parent.
+     * 
+     * @param dn the distinguished name of the entry/branch to move
+     * @param newParent the new parent under which the entry/branch is moved
+     * @param newRdn the new relative distinguished name of the entry at the 
+     * root of the branch
      * @param ignoreReferral  a flag to tell the server to ignore referrals
      * @exception if there are failures while moving and renaming the entry
      * or branch
@@ -412,6 +550,23 @@
     
     
     /**
+     * Moves and renames (the relative distinguished name of) an entry (or a 
+     * branch if the entry has children) at a specified distinguished name to 
+     * a position under a new parent.
+     * 
+     * @param dn the distinguished name of the entry/branch to move
+     * @param newParent the new parent under which the entry/branch is moved
+     * @param newRdn the new relative distinguished name of the entry at the 
+     * root of the branch
+     * @param ignoreReferral  a flag to tell the server to ignore referrals
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @exception if there are failures while moving and renaming the entry
+     * or branch
+     */
+    void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn, boolean
ignoreReferral, LogChange log ) throws Exception;
+    
+    
+    /**
      * Move and rename an entry. We change the RDN and the superior.
      *
      * @param modifyDnRequest The move and rename request
@@ -421,8 +576,15 @@
     void moveAndRename( ModifyDnRequest modifyDnRequest ) throws Exception;
     
     
-//    void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn,

-//        Control[] requestControls, ReferralHandlingMode refMode, LdapDN authorized ) throws
Exception;
+    /**
+     * Move and rename an entry. We change the RDN and the superior.
+     *
+     * @param modifyDnRequest The move and rename request
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while moving and renaming the entry
+     * or branch
+     */
+    void moveAndRename( ModifyDnRequest modifyDnRequest, LogChange log ) throws Exception;
     
     
     /**
@@ -450,6 +612,22 @@
      * @param newRdn the new relative distinguished name for the entry
      * @param deleteOldRdn whether or not the old value for the relative 
      * distinguished name is to be deleted from the entry
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while renaming the entry
+     */
+    void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn, LogChange log ) throws Exception;
+    
+    
+    /**
+     * Renames an entry by changing it's relative distinguished name.  This 
+     * has the side effect of changing the distinguished name of all entries
+     * directly or indirectly subordinate to the named entry if it has 
+     * descendants.
+     *
+     * @param dn the distinguished name of the entry to rename
+     * @param newRdn the new relative distinguished name for the entry
+     * @param deleteOldRdn whether or not the old value for the relative 
+     * distinguished name is to be deleted from the entry
      * @param ignoreReferral a flag to tell the server to ignore referrals
      * @throws Exception if there are failures while renaming the entry
      */
@@ -457,6 +635,23 @@
     
     
     /**
+     * Renames an entry by changing it's relative distinguished name.  This 
+     * has the side effect of changing the distinguished name of all entries
+     * directly or indirectly subordinate to the named entry if it has 
+     * descendants.
+     *
+     * @param dn the distinguished name of the entry to rename
+     * @param newRdn the new relative distinguished name for the entry
+     * @param deleteOldRdn whether or not the old value for the relative 
+     * distinguished name is to be deleted from the entry
+     * @param ignoreReferral a flag to tell the server to ignore referrals
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while renaming the entry
+     */
+    void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange
log ) throws Exception;
+    
+    
+    /**
      * Rename an entry applying the ModifyDN request 
      *
      * @param modifyDnRequest The requested modification
@@ -465,8 +660,14 @@
     void rename( ModifyDnRequest modifyDnRequest ) throws Exception;
     
     
-//    void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn,
-//        Control[] requestControls, ReferralHandlingMode refMode, LdapDN authorized ) throws
Exception;
+    /**
+     * Rename an entry applying the ModifyDN request 
+     *
+     * @param modifyDnRequest The requested modification
+     * @param log a flag set if the added entry should be stored in the changeLog
+     * @throws Exception if there are failures while renaming the entry
+     */
+    void rename( ModifyDnRequest modifyDnRequest, LogChange log ) throws Exception;
     
     
     /**
@@ -552,8 +753,6 @@
      * @param returningAttributes the attributes to return
      * @throws Exception if there are failures while listing children
      */
-    //EntryFilteringCursor search( LdapDN dn, SearchScope scope, String filter, AliasDerefMode
aliasDerefMode, 
-    //    String[] returningAttributes ) throws Exception;
     
     
     /**
@@ -571,41 +770,6 @@
         Set<AttributeTypeOptions> returningAttributes, int sizeLimit, int timeLimit
) throws Exception;
 
 
-    /**
-     * Searches the directory using a specified search scope and filter.
-     *
-     * @param dn the distinguished name of the entry to list the children of
-     * @param scope the search scope
-     * @param filter the search filter
-     * @param aliasDerefMode the alias dereferencing mode used
-     * @param returningAttributes the attributes to return
-     * @param sizeLimit the upper bound to the number of entries to return
-     * @param timeLimit the upper bound to the amount of time before 
-     * terminating the search
-     * @throws Exception if there are failures while listing children
-     */
-    //EntryFilteringCursor search( LdapDN dn, SearchScope scope, String filter, AliasDerefMode
aliasDerefMode, 
-    //    String[] returningAttributes, int sizeLimit, int timeLimit ) throws Exception;
-
-
-    /**
-     * Searches the directory using a specified search scope and filter.
-     *
-     * @param dn the distinguished name of the entry to list the children of
-     * @param scope the search scope
-     * @param filter the search filter
-     * @param aliasDerefMode the alias dereferencing mode used
-     * @param returningAttributes the attributes to return
-     * @param sizeLimit the upper bound to the number of entries to return
-     * @param timeLimit the upper bound to the amount of time before 
-     * terminating the search
-     * @param ignoreReferral a flag to tell the server to ignore referrals
-     * @throws Exception if there are failures while listing children
-     */
-    //EntryFilteringCursor search( LdapDN dn, SearchScope scope, String filter, AliasDerefMode
aliasDerefMode, 
-    //    String[] returningAttributes, int sizeLimit, int timeLimit, boolean ignoreReferral
) throws Exception;
-
-
     EntryFilteringCursor search( SearchRequest searchRequest ) throws Exception;
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java?rev=746410&r1=746409&r2=746410&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
Fri Feb 20 23:08:35 2009
@@ -29,6 +29,7 @@
 import javax.naming.ldap.Control;
 
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.DefaultDirectoryService.LogChange;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerBinaryValue;
@@ -118,7 +119,28 @@
      */
     public void add( ServerEntry entry ) throws Exception
     {
+        add( entry, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void add( ServerEntry entry, boolean ignoreReferral ) throws Exception
+    {
+        add( entry, ignoreReferral, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void add( ServerEntry entry, LogChange log ) throws Exception
+    {
         AddOperationContext opContext = new AddOperationContext( this, entry );
+
+        opContext.setLogChange( log );
+        
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( opContext );
     }
@@ -127,10 +149,11 @@
     /**
      * {@inheritDoc} 
      */
-    public void add( ServerEntry entry, boolean ignoreReferral ) throws Exception
+    public void add( ServerEntry entry, boolean ignoreReferral, LogChange log ) throws Exception
     {
         AddOperationContext opContext = new AddOperationContext( this, entry );
-        
+
+        opContext.setLogChange( log );
         setReferralHandling( opContext, ignoreReferral );
         
         OperationManager operationManager = directoryService.getOperationManager();
@@ -143,7 +166,19 @@
      */
     public void add( AddRequest addRequest ) throws Exception
     {
+        add( addRequest, LogChange.TRUE );
+    }
+
+    
+    /**
+     * {@inheritDoc} 
+     */
+    public void add( AddRequest addRequest, LogChange log ) throws Exception
+    {
         AddOperationContext opContext = new AddOperationContext( this, addRequest );
+
+        opContext.setLogChange( log );
+        
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( opContext );
         addRequest.getResultResponse().addAll( opContext.getResponseControls() );
@@ -225,8 +260,21 @@
      */
     public void delete( LdapDN dn ) throws Exception
     {
+        delete( dn, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void delete( LdapDN dn, LogChange log ) throws Exception
+    {
+        DeleteOperationContext opContext = new DeleteOperationContext( this, dn );
+
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.delete( new DeleteOperationContext( this, dn ) );
+        operationManager.delete( opContext );
     }
 
 
@@ -235,8 +283,18 @@
      */
     public void delete( LdapDN dn, boolean ignoreReferral  ) throws Exception
     {
+        delete( dn, ignoreReferral, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void delete( LdapDN dn, boolean ignoreReferral, LogChange log ) throws Exception
+    {
         DeleteOperationContext opContext = new DeleteOperationContext( this, dn );
         
+        opContext.setLogChange( log );
         setReferralHandling( opContext, ignoreReferral );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -432,6 +490,15 @@
      */
     public void modify( LdapDN dn, List<Modification> mods ) throws Exception
     {
+        modify( dn, mods, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void modify( LdapDN dn, List<Modification> mods, LogChange log ) throws
Exception
+    {
         if ( mods == null )
         {
             return;
@@ -444,8 +511,12 @@
             serverModifications.add( new ServerModification( directoryService.getRegistries(),
mod ) );
         }
         
+        ModifyOperationContext opContext = new ModifyOperationContext( this, dn, serverModifications
);
+
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.modify( new ModifyOperationContext( this, dn, serverModifications
) );
+        operationManager.modify( opContext );
     }
 
 
@@ -454,6 +525,15 @@
      */
     public void modify( LdapDN dn, List<Modification> mods, boolean ignoreReferral
) throws Exception
     {
+        modify( dn, mods, ignoreReferral, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void modify( LdapDN dn, List<Modification> mods, boolean ignoreReferral,
LogChange log ) throws Exception
+    {
         if ( mods == null )
         {
             return;
@@ -469,6 +549,7 @@
         ModifyOperationContext opContext = new ModifyOperationContext( this, dn, serverModifications
);
         
         setReferralHandling( opContext, ignoreReferral );
+        opContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.modify( opContext );
@@ -480,8 +561,21 @@
      */
     public void move( LdapDN dn, LdapDN newParent ) throws Exception
     {
+        move( dn, newParent, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void move( LdapDN dn, LdapDN newParent, LogChange log ) throws Exception
+    {
+        MoveOperationContext opContext = new MoveOperationContext( this, dn, newParent );
+        
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.move( new MoveOperationContext( this, dn, newParent ) );
+        operationManager.move( opContext );
     }
 
 
@@ -490,10 +584,20 @@
      */
     public void move( LdapDN dn, LdapDN newParent, boolean ignoreReferral ) throws Exception
     {
+        move( dn, newParent, ignoreReferral, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void move( LdapDN dn, LdapDN newParent, boolean ignoreReferral, LogChange log
) throws Exception
+    {
         OperationManager operationManager = directoryService.getOperationManager();
         MoveOperationContext opContext = new MoveOperationContext( this, dn, newParent );
         
         setReferralHandling( opContext, ignoreReferral );
+        opContext.setLogChange( log );
 
         operationManager.move( opContext );
     }
@@ -504,9 +608,22 @@
      */
     public void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn
) throws Exception
     {
+        moveAndRename( dn, newParent, newRdn, deleteOldRdn, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn,
LogChange log ) throws Exception
+    {
+        MoveAndRenameOperationContext opContext = 
+            new MoveAndRenameOperationContext( this, dn, newParent, newRdn, deleteOldRdn
);
+        
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.moveAndRename( 
-            new MoveAndRenameOperationContext( this, dn, newParent, newRdn, deleteOldRdn
) );
+        operationManager.moveAndRename( opContext );
     }
 
 
@@ -515,9 +632,19 @@
      */
     public void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn,
boolean ignoreReferral ) throws Exception
     {
+        moveAndRename( dn, newParent, newRdn, deleteOldRdn, ignoreReferral, LogChange.TRUE
);
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn,
boolean ignoreReferral, LogChange log ) throws Exception
+    {
         OperationManager operationManager = directoryService.getOperationManager();
         MoveAndRenameOperationContext opContext = new MoveAndRenameOperationContext( this,
dn, newParent, newRdn, deleteOldRdn );
         
+        opContext.setLogChange( log );
         setReferralHandling( opContext, ignoreReferral );
 
         operationManager.moveAndRename( opContext );
@@ -529,8 +656,21 @@
      */
     public void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn ) throws Exception
     {
+        rename( dn, newRdn, deleteOldRdn, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn, LogChange log ) throws
Exception
+    {
+        RenameOperationContext opContext = new RenameOperationContext( this, dn, newRdn,
deleteOldRdn );
+        
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
-        operationManager.rename( new RenameOperationContext( this, dn, newRdn, deleteOldRdn
) );
+        operationManager.rename( opContext );
     }
 
 
@@ -539,9 +679,19 @@
      */
     public void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn, boolean ignoreReferral
) throws Exception
     {
+        rename( dn, newRdn, deleteOldRdn, ignoreReferral, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn, boolean ignoreReferral,
LogChange log ) throws Exception
+    {
         OperationManager operationManager = directoryService.getOperationManager();
         RenameOperationContext opContext = new RenameOperationContext( this, dn, newRdn,
deleteOldRdn );
         
+        opContext.setLogChange( log );
         setReferralHandling( opContext, ignoreReferral );
 
         operationManager.rename( opContext );
@@ -630,7 +780,19 @@
      */
     public void delete( DeleteRequest deleteRequest ) throws Exception
     {
+        delete( deleteRequest, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void delete( DeleteRequest deleteRequest, LogChange log ) throws Exception
+    {
         DeleteOperationContext opContext = new DeleteOperationContext( this, deleteRequest
);
+        
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.delete( opContext );
         deleteRequest.getResultResponse().addAll( opContext.getResponseControls() );
@@ -650,7 +812,19 @@
      */
     public void modify( ModifyRequest modifyRequest ) throws Exception
     {
+        modify( modifyRequest, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void modify( ModifyRequest modifyRequest, LogChange log ) throws Exception
+    {
         ModifyOperationContext opContext = new ModifyOperationContext( this, modifyRequest
);
+
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.modify( opContext );
         modifyRequest.getResultResponse().addAll( opContext.getResponseControls() );
@@ -662,7 +836,19 @@
      */
     public void move( ModifyDnRequest modifyDnRequest ) throws Exception
     {
+        move( modifyDnRequest, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void move( ModifyDnRequest modifyDnRequest, LogChange log ) throws Exception
+    {
         MoveOperationContext opContext = new MoveOperationContext( this, modifyDnRequest
);
+        
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.move( opContext );
         modifyDnRequest.getResultResponse().addAll( opContext.getResponseControls() );
@@ -674,7 +860,19 @@
      */
     public void moveAndRename( ModifyDnRequest modifyDnRequest ) throws Exception
     {
+        moveAndRename( modifyDnRequest, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc} 
+     */
+    public void moveAndRename( ModifyDnRequest modifyDnRequest, LogChange log ) throws Exception
+    {
         MoveAndRenameOperationContext opContext = new MoveAndRenameOperationContext( this,
modifyDnRequest );
+
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.moveAndRename( opContext );
         modifyDnRequest.getResultResponse().addAll( opContext.getResponseControls() );
@@ -686,7 +884,19 @@
      */
     public void rename( ModifyDnRequest modifyDnRequest ) throws Exception
     {
+        rename( modifyDnRequest, LogChange.TRUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void rename( ModifyDnRequest modifyDnRequest, LogChange log ) throws Exception
+    {
         RenameOperationContext opContext = new RenameOperationContext( this, modifyDnRequest
);
+
+        opContext.setLogChange( log );
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.rename( opContext );
         modifyDnRequest.getResultResponse().addAll( opContext.getResponseControls() );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=746410&r1=746409&r2=746410&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Fri Feb 20 23:08:35 2009
@@ -180,6 +180,14 @@
             "changes are made by the admin user.\n Furthermore the used controls are not
at " +
             "all taken into account";
 
+    
+    /** A structure telling the changeLog what to do with the incoming change */
+    public enum LogChange
+    {
+        TRUE,  // The change must me stored 
+        FALSE  // The change must not be stred
+    };
+   
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java?rev=746410&r1=746409&r2=746410&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java
Fri Feb 20 23:08:35 2009
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DefaultDirectoryService.LogChange;
 import org.apache.directory.server.core.changelog.ChangeLogEvent;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
@@ -35,6 +36,9 @@
 {
     private ChangeLogEvent changeLogEvent;
     
+    /** The flag used to tell the server to store the change sinto the changeLog */
+    protected LogChange logChange;
+
     
     public AbstractChangeOperationContext( CoreSession session )
     {
@@ -61,4 +65,22 @@
     {
         this.changeLogEvent = changeLogEvent;
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void setLogChange( LogChange logChange )
+    {
+        this.logChange = logChange;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isLogChange()
+    {
+        return logChange != logChange.FALSE;
+    }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java?rev=746410&r1=746409&r2=746410&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
Fri Feb 20 23:08:35 2009
@@ -73,7 +73,8 @@
 
     /** A flag used to tell if we should consider referrals as standard entries */
     protected boolean throwReferral;
-
+    
+    
     /**
      * Creates a new instance of AbstractOperationContext.
      */

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java?rev=746410&r1=746409&r2=746410&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java
Fri Feb 20 23:08:35 2009
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.interceptor.context;
 
 
+import org.apache.directory.server.core.DefaultDirectoryService.LogChange;
 import org.apache.directory.server.core.changelog.ChangeLogEvent;
 
 
@@ -39,4 +40,19 @@
      * @return the ChangeLogEvent associated with this operation, or null
      */
     ChangeLogEvent getChangeLogEvent();
+    
+    
+    /**
+     * Set the flag which tells the server to log the changes into
+     * the changeLog file
+     * 
+     * @param log The flag
+     */
+    void setLogChange( LogChange log );
+
+    
+    /**
+     * @return True if the changes are logged into the changeLog
+     */
+    boolean isLogChange();
 }



Mime
View raw message