org.opends.server.replication.plugin
Class Historical

java.lang.Object
  extended by org.opends.server.replication.plugin.Historical

public class Historical
extends java.lang.Object

This class is used to store historical information that is used to resolve modify conflicts It is assumed that the common case is not to have conflict and therefore is optimized (in order of importance) for : 1- detecting potential conflict 2- fast update of historical information for non-conflicting change 3- fast and efficient purge 4- compact 5- solve conflict. This should also be as fast as possible but not at the cost of any of the other previous objectives One Historical object is created for each entry in the entry cache each Historical Object contains a list of attribute historical information


Field Summary
static java.lang.String ENTRYUIDNAME
          The name of the entryuuid attribute.
static java.lang.String HISTORICAL
          Name used to store attachment of historical information in the operation.
static java.lang.String HISTORICALATTRIBUTENAME
          The name of the attribute used to store historical information.
 
Constructor Summary
Historical()
           
 
Method Summary
 Attribute encode()
          Encode the historical information in an operational attribute.
static java.lang.Iterable<FakeOperation> generateFakeOperations(Entry entry)
          Use this historical information to generate fake operations that would result in this historical information.
 void generateState(PreOperationModifyOperation modifyOperation)
          Append replacement of state information to a given modification.
static java.lang.String getEntryUuid(Entry entry)
          Get the entry unique Id in String form.
static java.lang.String getEntryUuid(PreOperationAddOperation op)
          Get the Entry Unique Id from an add operation.
static java.util.List<Attribute> getHistoricalAttr(Entry entry)
          Get the Attribute used to store the historical information from the given Entry.
static boolean isHistoricalAttribute(Attribute attr)
          Check if a given attribute is an attribute used to store historical information.
static Historical load(Entry entry)
          read the historical information from the entry attribute and load it into the Historical object attached to the entry.
 boolean replayOperation(PreOperationModifyOperation modifyOperation, Entry modifiedEntry)
          Process an operation.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HISTORICALATTRIBUTENAME

public static final java.lang.String HISTORICALATTRIBUTENAME
The name of the attribute used to store historical information.

See Also:
Constant Field Values

HISTORICAL

public static final java.lang.String HISTORICAL
Name used to store attachment of historical information in the operation.

See Also:
Constant Field Values

ENTRYUIDNAME

public static final java.lang.String ENTRYUIDNAME
The name of the entryuuid attribute.

See Also:
Constant Field Values
Constructor Detail

Historical

public Historical()
Method Detail

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

replayOperation

public boolean replayOperation(PreOperationModifyOperation modifyOperation,
                               Entry modifiedEntry)
Process an operation. This method is responsible for detecting and resolving conflict for modifyOperation. This is done by using the historical information.

Parameters:
modifyOperation - the operation to be processed
modifiedEntry - the entry that is being modified (before modification)
Returns:
true if the replayed operation was in conflict

generateState

public void generateState(PreOperationModifyOperation modifyOperation)
Append replacement of state information to a given modification.

Parameters:
modifyOperation - the modification.

encode

public Attribute encode()
Encode the historical information in an operational attribute.

Returns:
The historical information encoded in an operational attribute.

load

public static Historical load(Entry entry)
read the historical information from the entry attribute and load it into the Historical object attached to the entry.

Parameters:
entry - The entry which historical information must be loaded
Returns:
the generated Historical information

generateFakeOperations

public static java.lang.Iterable<FakeOperation> generateFakeOperations(Entry entry)
Use this historical information to generate fake operations that would result in this historical information. TODO : This is only implemented for modify operation, should implement ADD DELETE and MODRDN.

Parameters:
entry - The Entry to use to generate the FakeOperation Iterable.
Returns:
an Iterable of FakeOperation that would result in this historical information.

getHistoricalAttr

public static java.util.List<Attribute> getHistoricalAttr(Entry entry)
Get the Attribute used to store the historical information from the given Entry.

Parameters:
entry - The entry containing the historical information.
Returns:
The Attribute used to store the historical information.

getEntryUuid

public static java.lang.String getEntryUuid(Entry entry)
Get the entry unique Id in String form.

Parameters:
entry - The entry for which the unique id should be returned.
Returns:
The Unique Id of the entry if it has one. null, otherwise.

getEntryUuid

public static java.lang.String getEntryUuid(PreOperationAddOperation op)
Get the Entry Unique Id from an add operation. This must be called after the entry uuid preop plugin (i.e no sooner than the replication provider pre-op)

Parameters:
op - The operation
Returns:
The Entry Unique Id String form.

isHistoricalAttribute

public static boolean isHistoricalAttribute(Attribute attr)
Check if a given attribute is an attribute used to store historical information.

Parameters:
attr - The attribute that needs to be checked.
Returns:
a boolean indicating if the given attribute is used to store historical information.