From 93bfdddfe14f5f805a5a3515ab50727f2e5ed787 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Fri, 12 Jun 2009 13:02:42 +0000
Subject: [PATCH] ECL - Add attribute lastExternalChangelogCookie for initialization
---
opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java b/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java
index 2bf4bf1..0c6bfea 100644
--- a/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java
+++ b/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java
@@ -26,10 +26,14 @@
*/
package org.opends.server.replication.server;
+import java.util.Iterator;
+
import org.opends.server.replication.common.ExternalChangeLogSession;
+import org.opends.server.replication.common.MultiDomainServerState;
import org.opends.server.replication.protocol.ECLUpdateMsg;
import org.opends.server.replication.protocol.StartECLSessionMsg;
import org.opends.server.types.DirectoryException;
+import org.opends.server.util.ServerConstants;
/**
* This interface defines a session used to search the external changelog
@@ -45,6 +49,17 @@
/**
* Create a new external changelog session.
* @param rs The replication server to which we will request the log.
+ * @throws DirectoryException When an error occurs.
+ */
+ public ExternalChangeLogSessionImpl(ReplicationServer rs)
+ throws DirectoryException
+ {
+ this.rs = rs;
+ }
+
+ /**
+ * Create a new external changelog session.
+ * @param rs The replication server to which we will request the log.
* @param startECLSessionMsg The start session message containing the
* details of the search request on the ECL.
* @throws DirectoryException When an error occurs.
@@ -82,4 +97,28 @@
{
handler.getDomain().stopServer(handler);
}
+
+ /**
+ * Returns the last (newest) cookie value.
+ * @return the last cookie value.
+ */
+ public MultiDomainServerState getLastCookie()
+ {
+ MultiDomainServerState result = new MultiDomainServerState();
+ // Initialize start state for all running domains with empty state
+ Iterator<ReplicationServerDomain> rsdk = this.rs.getCacheIterator();
+ if (rsdk != null)
+ {
+ while (rsdk.hasNext())
+ {
+ // process a domain
+ ReplicationServerDomain rsd = rsdk.next();
+ if (rsd.getBaseDn().compareToIgnoreCase(
+ ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT)==0)
+ continue;
+ result.update(rsd.getBaseDn(), rsd.getCLElligibleState());
+ }
+ }
+ return result;
+ }
}
--
Gitblit v1.10.0