org.opends.server.replication.plugin
Class AttrInfoMultiple

java.lang.Object
  extended by org.opends.server.replication.plugin.AttributeInfo
      extended by org.opends.server.replication.plugin.AttrInfoMultiple

public class AttrInfoMultiple
extends AttributeInfo

This classes is used to store historical information for multiple valued attributes. One object of this type is created for each attribute that was changed in the entry. It allows to record the last time a given value was added, the last time a given value was deleted and the last time the whole attribute was deleted.


Constructor Summary
AttrInfoMultiple()
          create a new empty AttrInfo object.
AttrInfoMultiple(ChangeNumber deleteTime, ChangeNumber updateTime, java.util.ArrayList<ValueInfo> valuesInfo)
          create a new AttrInfo object.
 
Method Summary
protected  void add(AttributeValue val, ChangeNumber CN)
          Update the historical information when a value is added.
protected  void delete(AttributeValue val, ChangeNumber CN)
          Change historical information after a delete value.
protected  void delete(ChangeNumber CN)
          Delete all historical information that is older than the provided ChangeNumber for this attribute type.
protected  void delete(java.util.LinkedHashSet<AttributeValue> values, ChangeNumber CN)
          Change historical information after a delete of a set of values.
 ChangeNumber getDeleteTime()
          Returns the last time when the attribute was deleted.
 java.util.ArrayList<ValueInfo> getValuesInfo()
          Get the List of ValueInfo for this attribute Info.
 void load(HistKey histKey, AttributeValue value, ChangeNumber cn)
          Load the provided information.
 void processLocalOrNonConflictModification(ChangeNumber changeNumber, Modification mod)
          This method calculate the historical information and update the hist attribute to store the historical information for modify operation that does not conflict with previous operation.
 boolean replayOperation(java.util.Iterator<Modification> modsIterator, ChangeNumber changeNumber, Entry modifiedEntry, Modification m)
          This method will be called when replaying an operation.
 
Methods inherited from class org.opends.server.replication.plugin.AttributeInfo
createAttributeInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttrInfoMultiple

public AttrInfoMultiple(ChangeNumber deleteTime,
                        ChangeNumber updateTime,
                        java.util.ArrayList<ValueInfo> valuesInfo)
create a new AttrInfo object.

Parameters:
deleteTime - the deletion time
updateTime - the update time
valuesInfo - of Value Info

AttrInfoMultiple

public AttrInfoMultiple()
create a new empty AttrInfo object.

Method Detail

getDeleteTime

public ChangeNumber getDeleteTime()
Returns the last time when the attribute was deleted.

Specified by:
getDeleteTime in class AttributeInfo
Returns:
the last time when the attribute was deleted

delete

protected void delete(ChangeNumber CN)
Delete all historical information that is older than the provided ChangeNumber for this attribute type. Add the delete attribute state information

Parameters:
CN - time when the delete was done

delete

protected void delete(AttributeValue val,
                      ChangeNumber CN)
Change historical information after a delete value.

Parameters:
val - value that was deleted
CN - time when the delete was done

delete

protected void delete(java.util.LinkedHashSet<AttributeValue> values,
                      ChangeNumber CN)
Change historical information after a delete of a set of values.

Parameters:
values - values that were deleted
CN - time when the delete was done

add

protected void add(AttributeValue val,
                   ChangeNumber CN)
Update the historical information when a value is added.

Parameters:
val - values that was added
CN - time when the value was added

getValuesInfo

public java.util.ArrayList<ValueInfo> getValuesInfo()
Get the List of ValueInfo for this attribute Info.

Specified by:
getValuesInfo in class AttributeInfo
Returns:
the List of ValueInfo

replayOperation

public boolean replayOperation(java.util.Iterator<Modification> modsIterator,
                               ChangeNumber changeNumber,
                               Entry modifiedEntry,
                               Modification m)
This method will be called when replaying an operation. It should use whatever historical information is stored in this class to solve the conflict and modify the mod and the mods iterator accordingly

Specified by:
replayOperation in class AttributeInfo
Parameters:
modsIterator - The iterator on the mods from which the mod is\ extracted.
changeNumber - The changeNumber associated to the operation.
modifiedEntry - The entry modified by this operation.
m - The modification.
Returns:
a boolean indicating if a conflict was detected.

processLocalOrNonConflictModification

public void processLocalOrNonConflictModification(ChangeNumber changeNumber,
                                                  Modification mod)
This method calculate the historical information and update the hist attribute to store the historical information for modify operation that does not conflict with previous operation. This is the usual path and should therefore be optimized. It does not check if the operation to process is conflicting or not with previous operations. The caller is responsible for this.

Specified by:
processLocalOrNonConflictModification in class AttributeInfo
Parameters:
changeNumber - The changeNumber of the operation to process
mod - The modify operation to process.

load

public void load(HistKey histKey,
                 AttributeValue value,
                 ChangeNumber cn)
Load the provided information.

Specified by:
load in class AttributeInfo
Parameters:
histKey - the key to load.
value - the associated value or null if there is no value;
cn - the associated ChangeNumber.