mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

pgamba
12.02.2009 b60c65cbc435695166677ffd2fc8d6dc714da9a4
opendj-sdk/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;
  }
}