public abstract class AbstractRebaseDiff extends Object implements NodeStateDiff
AbstractRebaseDiff serves as base for rebase implementations.
It implements a NodeStateDiff, which performs the conflict
handling as defined in NodeStore.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 is head and a branch
was created at base. The current state on the branch is
branch. Re-basing branch to the current
head works 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.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRebaseDiff(NodeBuilder builder) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
addExistingNode(NodeBuilder builder,
String name,
NodeState before,
NodeState after)
Called when the node
after was added on the branch but the node
exists already in the trunk. |
protected abstract void |
addExistingProperty(NodeBuilder builder,
org.apache.jackrabbit.oak.api.PropertyState before,
org.apache.jackrabbit.oak.api.PropertyState after)
Called when the property
after was added on the branch but the property
exists already in the trunk. |
protected abstract void |
changeChangedProperty(NodeBuilder builder,
org.apache.jackrabbit.oak.api.PropertyState before,
org.apache.jackrabbit.oak.api.PropertyState after)
Called when the property
after was changed on the branch but was
already changed to before in the trunk. |
protected abstract void |
changeDeletedNode(NodeBuilder builder,
String name,
NodeState after,
NodeState base)
Called when the node
after was changed on the branch but was
deleted already in the trunk. |
protected abstract void |
changeDeletedProperty(NodeBuilder builder,
org.apache.jackrabbit.oak.api.PropertyState after,
org.apache.jackrabbit.oak.api.PropertyState base)
Called when the property
after was changed on the branch but was
deleted already in the trunk. |
boolean |
childNodeAdded(String name,
NodeState after)
Called for all added child nodes.
|
boolean |
childNodeChanged(String name,
NodeState before,
NodeState after)
Called for all child nodes that may contain changes between the before
and after states.
|
boolean |
childNodeDeleted(String name,
NodeState before)
Called for all deleted child nodes.
|
protected abstract AbstractRebaseDiff |
createDiff(NodeBuilder builder,
String name)
Factory method for creating a rebase handler for the named child of the passed
parent builder.
|
protected abstract void |
deleteChangedNode(NodeBuilder builder,
String name,
NodeState before)
Called when the node
before was deleted in the branch but was
already changed in the trunk. |
protected abstract void |
deleteChangedProperty(NodeBuilder builder,
org.apache.jackrabbit.oak.api.PropertyState before)
Called when the property
before was deleted in the branch but was
already changed in the trunk. |
protected abstract void |
deleteDeletedNode(NodeBuilder builder,
String name,
NodeState before)
Called when the node
before was deleted in the branch but was
already deleted in the trunk. |
protected abstract void |
deleteDeletedProperty(NodeBuilder builder,
org.apache.jackrabbit.oak.api.PropertyState before)
Called when the property
before was deleted in the branch but was
already deleted in the trunk. |
boolean |
propertyAdded(org.apache.jackrabbit.oak.api.PropertyState after)
Called for all added properties.
|
boolean |
propertyChanged(org.apache.jackrabbit.oak.api.PropertyState before,
org.apache.jackrabbit.oak.api.PropertyState after)
Called for all changed properties.
|
boolean |
propertyDeleted(org.apache.jackrabbit.oak.api.PropertyState before)
Called for all deleted properties.
|
protected AbstractRebaseDiff(NodeBuilder builder)
protected abstract AbstractRebaseDiff createDiff(NodeBuilder builder, String name)
builder - parent buildername - name of the child for which to return a rebase handlername in builderprotected abstract void addExistingProperty(NodeBuilder builder, org.apache.jackrabbit.oak.api.PropertyState before, org.apache.jackrabbit.oak.api.PropertyState after)
after was added on the branch but the property
exists already in the trunk.builder - parent builderbefore - existing propertyafter - added propertyprotected abstract void changeDeletedProperty(NodeBuilder builder, org.apache.jackrabbit.oak.api.PropertyState after, org.apache.jackrabbit.oak.api.PropertyState base)
after was changed on the branch but was
deleted already in the trunk.builder - parent builderafter - changed propertybase - base propertyprotected abstract void changeChangedProperty(NodeBuilder builder, org.apache.jackrabbit.oak.api.PropertyState before, org.apache.jackrabbit.oak.api.PropertyState after)
after was changed on the branch but was
already changed to before in the trunk.builder - parent propertybefore - changed property in branchafter - changed property in trunkprotected abstract void deleteDeletedProperty(NodeBuilder builder, org.apache.jackrabbit.oak.api.PropertyState before)
before was deleted in the branch but was
already deleted in the trunk.builder - parent builderbefore - deleted propertyprotected abstract void deleteChangedProperty(NodeBuilder builder, org.apache.jackrabbit.oak.api.PropertyState before)
before was deleted in the branch but was
already changed in the trunk.builder - parent builderbefore - deleted propertyprotected abstract void addExistingNode(NodeBuilder builder, String name, NodeState before, NodeState after)
after was added on the branch but the node
exists already in the trunk.builder - parent buildername - name of the added nodebefore - existing nodeafter - added addedprotected abstract void changeDeletedNode(NodeBuilder builder, String name, NodeState after, NodeState base)
after was changed on the branch but was
deleted already in the trunk.builder - parent buildername - name of the changed nodeafter - changed nodebase - base nodeprotected abstract void deleteDeletedNode(NodeBuilder builder, String name, NodeState before)
before was deleted in the branch but was
already deleted in the trunk.builder - parent builderbefore - deleted nodeprotected abstract void deleteChangedNode(NodeBuilder builder, String name, NodeState before)
before was deleted in the branch but was
already changed in the trunk.builder - parent builderbefore - deleted nodepublic boolean propertyAdded(org.apache.jackrabbit.oak.api.PropertyState after)
NodeStateDiffpropertyAdded in interface NodeStateDiffafter - property state after the changetrue to continue the comparison, false to abort.
Abort will stop comparing completely, that means sibling nodes
and sibling nodes of all parents are not further compared.public boolean propertyChanged(org.apache.jackrabbit.oak.api.PropertyState before, org.apache.jackrabbit.oak.api.PropertyState after)
NodeStateDiffpropertyChanged in interface NodeStateDiffbefore - property state before the changeafter - property state after the changetrue to continue the comparison, false to abort.
Abort will stop comparing completely, that means sibling nodes
and sibling nodes of all parents are not further compared.public boolean propertyDeleted(org.apache.jackrabbit.oak.api.PropertyState before)
NodeStateDiffpropertyDeleted in interface NodeStateDiffbefore - property state before the changetrue to continue the comparison, false to abort.
Abort will stop comparing completely, that means sibling nodes
and sibling nodes of all parents are not further compared.public boolean childNodeAdded(String name, NodeState after)
NodeStateDiffchildNodeAdded in interface NodeStateDiffname - name of the added child nodeafter - child node state after the changetrue to continue the comparison, false to abort.
Abort will stop comparing completely, that means sibling nodes
and sibling nodes of all parents are not further compared.public boolean childNodeChanged(String name, NodeState before, NodeState after)
NodeStateDiffchildNodeChanged in interface NodeStateDiffname - name of the changed child nodebefore - child node state before the changeafter - child node state after the changetrue to continue the comparison, false to abort.
Abort will stop comparing completely, that means sibling nodes
and sibling nodes of all parents are not further compared.public boolean childNodeDeleted(String name, NodeState before)
NodeStateDiffchildNodeDeleted in interface NodeStateDiffname - name of the deleted child nodebefore - child node state before the changetrue to continue the comparison, false to abort.
Abort will stop comparing completely, that means sibling nodes
and sibling nodes of all parents are not further compared.Copyright © 2012–2021 The Apache Software Foundation. All rights reserved.