001 /*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License"). You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 * Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 * Copyright 2006-2008 Sun Microsystems, Inc.
026 */
027 package org.opends.server.replication.plugin;
028
029 import org.opends.server.replication.common.ChangeNumber;
030 import org.opends.server.replication.protocol.ReplicationMessage;
031 import org.opends.server.types.Modification;
032
033
034 /**
035 * This class if used to build fake Operation from the historical
036 * information that stay in the entry in the database.
037 *
038 * This is usefull when a LDAP server can't find a LDAP server that
039 * has already seen all its changes and therefore need to retransmit them
040 *
041 * @author Gilles Bellaton
042 */
043 public abstract class FakeOperation
044 {
045 private ChangeNumber changeNumber;
046
047 /**
048 * Creates a new FakeOperation using the provided ChangeNumber.
049 *
050 * @param changeNumber The ChangeNumber to use to build the FakeOperation.
051 */
052 public FakeOperation(ChangeNumber changeNumber)
053 {
054 this.changeNumber = changeNumber;
055 }
056
057 /**
058 * Get the ChangeNumber.
059 *
060 * @return Returns the changeNumber.
061 */
062 public ChangeNumber getChangeNumber()
063 {
064 return changeNumber;
065 }
066
067 /**
068 * Generate a ReplicationMessage from this fake operation.
069 * The ReplicationMessage is used to send the informations about
070 * this operation to the other servers.
071 *
072 * @return A ReplicationMessage that can be used to send information
073 * about this operation to remote servers.
074 */
075 abstract public ReplicationMessage generateMessage();
076
077 /**
078 * Add a modification to the list of modification included
079 * in this fake operation.
080 *
081 * @param mod A modification that must be adde to the list of modifications
082 * included in this fake operation.
083 */
084 abstract public void addModification(Modification mod);
085
086 }