directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r939064 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/ core/src/test/java/org/apache/directory/server/core/authz/support/ core/src/test/java/org/...
Date Wed, 28 Apr 2010 19:48:49 GMT
Author: kayyagari
Date: Wed Apr 28 19:48:49 2010
New Revision: 939064

URL: http://svn.apache.org/viewvc?rev=939064&view=rev
Log:
o added support for storing the contextCSN attribute used in replication
o added set/getSyncPeriodMillis() methods to the DirectoryService interface
o updated the classes implementing DirectoryService

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=939064&r1=939063&r2=939064&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
Wed Apr 28 19:48:49 2010
@@ -494,4 +494,32 @@ public interface DirectoryService extend
      * @param schemaManager The SchemaManager to associate
      */
     void setSchemaManager( SchemaManager schemaManager );
+    
+
+    /**
+     * the highest committed CSN value
+     *
+     * @param lastCommittedCsnVal the CSN value
+     */
+    void setContextCsn( String lastCommittedCsnVal );
+
+    
+    /**
+     * @return the current highest committed CSN value
+     */
+    String getContextCsn();
+    
+    
+    /**
+     * the time interval at which the DirectoryService's data is flushed to disk
+     * 
+     * @param syncPeriodMillis the syncPeriodMillis to set
+     */
+    void setSyncPeriodMillis( long syncPeriodMillis );
+    
+    
+    /**
+     * @return the syncPeriodMillis
+     */
+    long getSyncPeriodMillis();
 }

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=939064&r1=939063&r2=939064&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
Wed Apr 28 19:48:49 2010
@@ -45,6 +45,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.changelog.Tag;
 import org.apache.directory.server.core.changelog.TaggableSearchableChangeLogStore;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.event.EventService;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
@@ -229,7 +230,8 @@ public class DefaultDirectoryService imp
     /** The maximum size for an incoming PDU */
     private int maxPDUSize = Integer.MAX_VALUE;
 
-
+    /** the value of last successful add/update operation's CSN */
+    private String contextCsn;
     
     /**
      * The synchronizer thread. It flush data on disk periodically.
@@ -912,7 +914,19 @@ public class DefaultDirectoryService imp
             workerThread.start();
         }
 
+        // load the last stored valid CSN value
+        LookupOperationContext loc = new LookupOperationContext( getAdminSession() );
+        loc.setDn( systemPartition.getSuffixDn() );
+        loc.setAttrsId( new String[]{ "+" } );
+        ClonedServerEntry entry = systemPartition.lookup( loc );
         
+        EntryAttribute cntextCsnAt = entry.get( SchemaConstants.CONTEXT_CSN_AT );
+        if( cntextCsnAt != null )
+        {
+            // this is a multivalued attribute but current syncrepl provider implementation
stores only ONE value at ou=system
+            contextCsn = cntextCsnAt.getString();
+        }
+
         started = true;
 
         if ( !testEntries.isEmpty() )
@@ -1694,7 +1708,7 @@ public class DefaultDirectoryService imp
     
     
     /**
-     * @return the syncPeriodMillis
+     * {@inheritDoc}
      */
     public long getSyncPeriodMillis()
     {
@@ -1703,10 +1717,28 @@ public class DefaultDirectoryService imp
 
 
     /**
-     * @param syncPeriodMillis the syncPeriodMillis to set
+     * {@inheritDoc}
      */
     public void setSyncPeriodMillis( long syncPeriodMillis )
     {
         this.syncPeriodMillis = syncPeriodMillis;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getContextCsn()
+    {
+        return contextCsn;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setContextCsn( String lastKnownCsn )
+    {
+        this.contextCsn = lastKnownCsn;
+    }
 }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=939064&r1=939063&r2=939064&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
Wed Apr 28 19:48:49 2010
@@ -888,6 +888,18 @@ public class MaxImmSubFilterTest
             // TODO Auto-generated method stub
             
         }
+
+        public String getContextCsn()
+        {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void setContextCsn( String lastKnownCsn )
+        {
+            // TODO Auto-generated method stub
+            
+        }
     }
 
     

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=939064&r1=939063&r2=939064&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Wed Apr 28 19:48:49 2010
@@ -708,5 +708,20 @@ public class InterceptorChainTest
             // TODO Auto-generated method stub
             
         }
+
+
+        public String getContextCsn()
+        {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+
+        public void setContextCsn( String lastKnownCsn )
+        {
+            // TODO Auto-generated method stub
+            
+        }
+        
     }
 }



Mime
View raw message