From ff3d7d233cd306e4fe50e2219fcdfc7f4ec7c920 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 04 Sep 2013 12:34:42 +0000
Subject: [PATCH] OPENDJ-1116 Introduce abstraction for the changelog DB

---
 opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java |   40 +++++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java b/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java
index 57faad5..ccd70e2 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java
@@ -49,8 +49,10 @@
    * @param changeNumber
    *          the provided change number.
    * @return the associated CSN, null when none.
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  public CSN getCSN(long changeNumber);
+  public CSN getCSN(long changeNumber) throws ChangelogException;
 
   /**
    * Get the baseDN associated to a provided change number.
@@ -58,8 +60,10 @@
    * @param changeNumber
    *          the provided change number.
    * @return the baseDN, null when none.
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  public String getBaseDN(long changeNumber);
+  public String getBaseDN(long changeNumber) throws ChangelogException;
 
   /**
    * Get the previous cookie associated to a provided change number.
@@ -67,22 +71,28 @@
    * @param changeNumber
    *          the provided change number.
    * @return the previous cookie, null when none.
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  String getPreviousCookie(long changeNumber);
+  String getPreviousCookie(long changeNumber) throws ChangelogException;
 
   /**
    * Get the first change number stored in this DB.
    *
    * @return Returns the first change number in this DB.
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  long getFirstChangeNumber();
+  long getFirstChangeNumber() throws ChangelogException;
 
   /**
    * Get the last change number stored in this DB.
    *
    * @return Returns the last change number in this DB
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  long getLastChangeNumber();
+  long getLastChangeNumber() throws ChangelogException;
 
   /**
    * Add an update to the list of messages that must be saved to this DB managed
@@ -99,8 +109,11 @@
    *          The associated baseDN.
    * @param csn
    *          The associated replication CSN.
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  void add(long changeNumber, String previousCookie, String baseDN, CSN csn);
+  void add(long changeNumber, String previousCookie, String baseDN, CSN csn)
+      throws ChangelogException;
 
   /**
    * Generate a new {@link ChangeNumberIndexDBCursor} that allows to browse the
@@ -113,7 +126,7 @@
    *         this DBHandler and starting at the position defined by a given
    *         changeNumber.
    * @throws ChangelogException
-   *           if a database problem happened.
+   *           if a database problem occurs.
    */
   ChangeNumberIndexDBCursor getCursorFrom(long startChangeNumber)
       throws ChangelogException;
@@ -123,14 +136,16 @@
    *
    * @return <code>true</code> if this database is empty, <code>false</code>
    *         otherwise
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  boolean isEmpty();
+  boolean isEmpty() throws ChangelogException;
 
   /**
    * Clear the changes from this DB (from both memory cache and DB storage).
    *
    * @throws ChangelogException
-   *           When an exception occurs while removing the changes from this DB.
+   *           if a database problem occurs.
    */
   void clear() throws ChangelogException;
 
@@ -142,13 +157,16 @@
    *          The baseDN for which we want to remove all records from this DB,
    *          null means all.
    * @throws ChangelogException
-   *           When an exception occurs while removing the changes from this DB.
+   *           if a database problem occurs.
    */
   void clear(String baseDNToClear) throws ChangelogException;
 
   /**
    * Shutdown this DB.
+   *
+   * @throws ChangelogException
+   *           if a database problem occurs.
    */
-  void shutdown();
+  void shutdown() throws ChangelogException;
 
 }

--
Gitblit v1.10.0