Class AbstractRebaseDiff
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.state.AbstractRebaseDiff
-
- All Implemented Interfaces:
NodeStateDiff
- Direct Known Subclasses:
ConflictAnnotatingRebaseDiff
public abstract class AbstractRebaseDiff extends Object implements NodeStateDiff
AbstractRebaseDiffserves as base for rebase implementations. It implements aNodeStateDiff, which performs the conflict handling as defined inNodeStore.rebase(NodeBuilder)on the Oak SPI state level.Intended use of this class is to re-base a branched version of the node state tree. Given below situation:
+ head (master) | | + branch |/ + base |The current state on the master branch isheadand a branch was created atbase. The current state on the branch isbranch. Re-basingbranchto the currentheadworks as follows:NodeState head = ... NodeState branch = ... NodeState base = ... NodeBuilder builder = new MemoryNodeBuilder(head); branch.compareAgainstBaseState(base, new MyRebaseDiff(builder)); branch = builder.getNodeState();The result is:+ branch / + head (master) |Conflicts during rebase cause calls to the various abstracts conflict resolution methods of this class. Concrete subclasses of this class need to implement these methods for handling such conflicts.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRebaseDiff(NodeBuilder builder)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddExistingNode(NodeBuilder builder, String name, NodeState before, NodeState after)Called when the nodeafterwas added on the branch but the node exists already in the trunk.protected abstract voidaddExistingProperty(NodeBuilder builder, PropertyState before, PropertyState after)Called when the propertyafterwas added on the branch but the property exists already in the trunk.protected abstract voidchangeChangedProperty(NodeBuilder builder, PropertyState before, PropertyState after)Called when the propertyafterwas changed on the branch but was already changed tobeforein the trunk.protected abstract voidchangeDeletedNode(NodeBuilder builder, String name, NodeState after, NodeState base)Called when the nodeafterwas changed on the branch but was deleted already in the trunk.protected abstract voidchangeDeletedProperty(NodeBuilder builder, PropertyState after, PropertyState base)Called when the propertyafterwas changed on the branch but was deleted already in the trunk.booleanchildNodeAdded(String name, NodeState after)Called for all added child nodes.booleanchildNodeChanged(String name, NodeState before, NodeState after)Called for all child nodes that may contain changes between the before and after states.booleanchildNodeDeleted(String name, NodeState before)Called for all deleted child nodes.protected abstract AbstractRebaseDiffcreateDiff(NodeBuilder builder, String name)Factory method for creating a rebase handler for the named child of the passed parent builder.protected abstract voiddeleteChangedNode(NodeBuilder builder, String name, NodeState before)Called when the nodebeforewas deleted in the branch but was already changed in the trunk.protected abstract voiddeleteChangedProperty(NodeBuilder builder, PropertyState before)Called when the propertybeforewas deleted in the branch but was already changed in the trunk.protected abstract voiddeleteDeletedNode(NodeBuilder builder, String name, NodeState before)Called when the nodebeforewas deleted in the branch but was already deleted in the trunk.protected abstract voiddeleteDeletedProperty(NodeBuilder builder, PropertyState before)Called when the propertybeforewas deleted in the branch but was already deleted in the trunk.booleanpropertyAdded(PropertyState after)Called for all added properties.booleanpropertyChanged(PropertyState before, PropertyState after)Called for all changed properties.booleanpropertyDeleted(PropertyState before)Called for all deleted properties.
-
-
-
Constructor Detail
-
AbstractRebaseDiff
protected AbstractRebaseDiff(NodeBuilder builder)
-
-
Method Detail
-
createDiff
protected abstract AbstractRebaseDiff createDiff(NodeBuilder builder, String name)
Factory method for creating a rebase handler for the named child of the passed parent builder.- Parameters:
builder- parent buildername- name of the child for which to return a rebase handler- Returns:
- rebase handler for child
nameinbuilder
-
addExistingProperty
protected abstract void addExistingProperty(NodeBuilder builder, PropertyState before, PropertyState after)
Called when the propertyafterwas added on the branch but the property exists already in the trunk.- Parameters:
builder- parent builderbefore- existing propertyafter- added property
-
changeDeletedProperty
protected abstract void changeDeletedProperty(NodeBuilder builder, PropertyState after, PropertyState base)
Called when the propertyafterwas changed on the branch but was deleted already in the trunk.- Parameters:
builder- parent builderafter- changed propertybase- base property
-
changeChangedProperty
protected abstract void changeChangedProperty(NodeBuilder builder, PropertyState before, PropertyState after)
Called when the propertyafterwas changed on the branch but was already changed tobeforein the trunk.- Parameters:
builder- parent propertybefore- changed property in branchafter- changed property in trunk
-
deleteDeletedProperty
protected abstract void deleteDeletedProperty(NodeBuilder builder, PropertyState before)
Called when the propertybeforewas deleted in the branch but was already deleted in the trunk.- Parameters:
builder- parent builderbefore- deleted property
-
deleteChangedProperty
protected abstract void deleteChangedProperty(NodeBuilder builder, PropertyState before)
Called when the propertybeforewas deleted in the branch but was already changed in the trunk.- Parameters:
builder- parent builderbefore- deleted property
-
addExistingNode
protected abstract void addExistingNode(NodeBuilder builder, String name, NodeState before, NodeState after)
Called when the nodeafterwas added on the branch but the node exists already in the trunk.- Parameters:
builder- parent buildername- name of the added nodebefore- existing nodeafter- added added
-
changeDeletedNode
protected abstract void changeDeletedNode(NodeBuilder builder, String name, NodeState after, NodeState base)
Called when the nodeafterwas changed on the branch but was deleted already in the trunk.- Parameters:
builder- parent buildername- name of the changed nodeafter- changed nodebase- base node
-
deleteDeletedNode
protected abstract void deleteDeletedNode(NodeBuilder builder, String name, NodeState before)
Called when the nodebeforewas deleted in the branch but was already deleted in the trunk.- Parameters:
builder- parent builderbefore- deleted node
-
deleteChangedNode
protected abstract void deleteChangedNode(NodeBuilder builder, String name, NodeState before)
Called when the nodebeforewas deleted in the branch but was already changed in the trunk.- Parameters:
builder- parent builderbefore- deleted node
-
propertyAdded
public boolean propertyAdded(PropertyState after)
Description copied from interface:NodeStateDiffCalled for all added properties.- Specified by:
propertyAddedin interfaceNodeStateDiff- Parameters:
after- property state after the change- Returns:
trueto continue the comparison,falseto abort. Abort will stop comparing completely, that means sibling nodes and sibling nodes of all parents are not further compared.
-
propertyChanged
public boolean propertyChanged(PropertyState before, PropertyState after)
Description copied from interface:NodeStateDiffCalled for all changed properties. The names of the given two property states are guaranteed to be the same.- Specified by:
propertyChangedin interfaceNodeStateDiff- Parameters:
before- property state before the changeafter- property state after the change- Returns:
trueto continue the comparison,falseto abort. Abort will stop comparing completely, that means sibling nodes and sibling nodes of all parents are not further compared.
-
propertyDeleted
public boolean propertyDeleted(PropertyState before)
Description copied from interface:NodeStateDiffCalled for all deleted properties.- Specified by:
propertyDeletedin interfaceNodeStateDiff- Parameters:
before- property state before the change- Returns:
trueto continue the comparison,falseto abort. Abort will stop comparing completely, that means sibling nodes and sibling nodes of all parents are not further compared.
-
childNodeAdded
public boolean childNodeAdded(String name, NodeState after)
Description copied from interface:NodeStateDiffCalled for all added child nodes.- Specified by:
childNodeAddedin interfaceNodeStateDiff- Parameters:
name- name of the added child nodeafter- child node state after the change- Returns:
trueto continue the comparison,falseto abort. Abort will stop comparing completely, that means sibling nodes and sibling nodes of all parents are not further compared.
-
childNodeChanged
public boolean childNodeChanged(String name, NodeState before, NodeState after)
Description copied from interface:NodeStateDiffCalled for all child nodes that may contain changes between the before and after states. The comparison implementation is expected to make an effort to avoid calling this method on child nodes under which nothing has changed.- Specified by:
childNodeChangedin interfaceNodeStateDiff- Parameters:
name- name of the changed child nodebefore- child node state before the changeafter- child node state after the change- Returns:
trueto continue the comparison,falseto abort. Abort will stop comparing completely, that means sibling nodes and sibling nodes of all parents are not further compared.
-
childNodeDeleted
public boolean childNodeDeleted(String name, NodeState before)
Description copied from interface:NodeStateDiffCalled for all deleted child nodes.- Specified by:
childNodeDeletedin interfaceNodeStateDiff- Parameters:
name- name of the deleted child nodebefore- child node state before the change- Returns:
trueto continue the comparison,falseto abort. Abort will stop comparing completely, that means sibling nodes and sibling nodes of all parents are not further compared.
-
-