001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2013-2015 ForgeRock AS.
016 */
017package org.opends.server.replication.plugin;
018
019import org.opends.server.replication.common.CSN;
020import org.opends.server.replication.protocol.ReplicationMsg;
021
022/**
023 * This class if used to build fake Operation from the historical
024 * information that stay in the entry in the database.
025 *
026 * This is useful when a LDAP server can't find a LDAP server that
027 * has already seen all its changes and therefore need to retransmit them.
028 */
029public abstract class FakeOperation
030{
031  private CSN csn;
032
033  /**
034   * Creates a new FakeOperation using the provided CSN.
035   *
036   * @param csn The CSN to use to build the FakeOperation.
037   */
038  public FakeOperation(CSN csn)
039  {
040    this.csn = csn;
041  }
042
043  /**
044   * Get the CSN.
045   *
046   * @return Returns the CSN.
047   */
048  public CSN getCSN()
049  {
050    return csn;
051  }
052
053  /**
054   * Generate a ReplicationMsg from this fake operation.
055   * The ReplicationMsg is used to send the informations about
056   * this operation to the other servers.
057   *
058   * @return A ReplicationMsg that can be used to send information
059   *         about this operation to remote servers.
060   */
061  public abstract ReplicationMsg generateMessage();
062}