From 21a56b12e18b3de7afb2c6b90e1b729890be8865 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 21 Jul 2014 17:06:28 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1206 : Create a new ReplicationBackend/ChangelogBackend   to support cn=changelog CR-4053

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/file/FileReplicaDB.java |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/file/FileReplicaDB.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/file/FileReplicaDB.java
index 4e6cba9..995eca0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/file/FileReplicaDB.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/file/FileReplicaDB.java
@@ -41,6 +41,7 @@
 import org.opends.server.replication.server.ReplicationServerDomain;
 import org.opends.server.replication.server.changelog.api.ChangelogException;
 import org.opends.server.replication.server.changelog.api.DBCursor;
+import org.opends.server.replication.server.changelog.api.DBCursor.PositionStrategy;
 import org.opends.server.replication.server.changelog.file.Log.RepositionableCursor;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.Attributes;
@@ -203,21 +204,25 @@
   }
 
   /**
-   * Returns a cursor that allows to retrieve the update messages from this DB,
-   * starting at the position defined by the smallest CSN that is strictly
-   * higher than the provided CSN.
+   * Returns a cursor that allows to retrieve the update messages from this DB.
+   * The starting position is defined by the provided CSN and cursor
+   * positioning strategy.
    *
-   * @param startAfterCSN
+   * @param startCSN
    *          The position where the cursor must start. If null, start from the
    *          oldest CSN
+   * @param positionStrategy
+   *          Cursor position strategy, which allow to choose if cursor must
+   *          start from the provided CSN or just after the provided CSN.
    * @return a new {@link DBCursor} to retreive update messages.
    * @throws ChangelogException
    *           if a database problem happened
    */
-  DBCursor<UpdateMsg> generateCursorFrom(CSN startAfterCSN) throws ChangelogException
+  DBCursor<UpdateMsg> generateCursorFrom(final CSN startCSN, final PositionStrategy positionStrategy)
+      throws ChangelogException
   {
-    RepositionableCursor<CSN, UpdateMsg> cursor = log.getNearestCursor(startAfterCSN);
-    return new FileReplicaDBCursor(cursor, startAfterCSN);
+    RepositionableCursor<CSN, UpdateMsg> cursor = log.getNearestCursor(startCSN, positionStrategy);
+    return new FileReplicaDBCursor(cursor, startCSN, positionStrategy);
   }
 
   /**

--
Gitblit v1.10.0