Class CompositeConflictHandler
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.commit.CompositeConflictHandler
-
- All Implemented Interfaces:
ThreeWayConflictHandler
public class CompositeConflictHandler extends java.lang.Object implements ThreeWayConflictHandler
ACompositeConflictHandlerdelegates conflict handling to multiple backing handlers. The backing handlers are invoked in the inverse order they have been installed until a handler returning a valid resolution (i.e. notIGNORED)is found. If for a certain conflict none of the backing handlers returns a valid resolution this implementation throws anIllegalStateException.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.spi.commit.ThreeWayConflictHandler
ThreeWayConflictHandler.Resolution
-
-
Constructor Summary
Constructors Constructor Description CompositeConflictHandler()Create a newCompositeConflictHandlerwith no backing handlers.CompositeConflictHandler(@NotNull java.lang.Iterable<ThreeWayConflictHandler> handlers)Create a newCompositeConflictHandlerwith an initial set of backing handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ThreeWayConflictHandler.ResolutionaddExistingNode(@NotNull NodeBuilder parent, @NotNull java.lang.String name, @NotNull NodeState ours, @NotNull NodeState theirs)The nodeourshas been added toparentwhich conflicts with nodetheirswhich has been added in the persistence store.@NotNull ThreeWayConflictHandler.ResolutionaddExistingProperty(@NotNull NodeBuilder parent, @NotNull PropertyState ours, @NotNull PropertyState theirs)The propertyourshas been added toparentwhich conflicts with propertytheirswhich has been added in the persistence store.CompositeConflictHandleraddHandler(@NotNull ThreeWayConflictHandler handler)Add a new backing conflict handler.@NotNull ThreeWayConflictHandler.ResolutionchangeChangedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState ours, @NotNull PropertyState theirs, @NotNull PropertyState base)The propertyourshas been changed inparentwhile it was also changed to a different value (theirs) in the persistence store.@NotNull ThreeWayConflictHandler.ResolutionchangeDeletedNode(@NotNull NodeBuilder parent, @NotNull java.lang.String name, @NotNull NodeState ours, @NotNull NodeState base)The nodeourshas been changed inparentwhile it was removed in the persistence store.@NotNull ThreeWayConflictHandler.ResolutionchangeDeletedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState ours, @NotNull PropertyState base)The propertyourshas been changed inparentwhile it was removed in the persistence store.@NotNull ThreeWayConflictHandler.ResolutiondeleteChangedNode(@NotNull NodeBuilder parent, @NotNull java.lang.String name, @NotNull NodeState theirs, @NotNull NodeState base)The nodetheirschanged in the persistence store while it has been deleted locally.@NotNull ThreeWayConflictHandler.ResolutiondeleteChangedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState theirs, @NotNull PropertyState base)The propertytheirschanged in the persistence store while it has been deleted locally.@NotNull ThreeWayConflictHandler.ResolutiondeleteDeletedNode(@NotNull NodeBuilder parent, @NotNull java.lang.String name, @NotNull NodeState base)The nodenamehas been removed inparentwhile it was also removed in the persistence store.@NotNull ThreeWayConflictHandler.ResolutiondeleteDeletedProperty(@NotNull NodeBuilder parent, @NotNull PropertyState base)The propertyourshas been removed inparentwhile it was also removed in the persistence store.
-
-
-
Constructor Detail
-
CompositeConflictHandler
public CompositeConflictHandler(@NotNull @NotNull java.lang.Iterable<ThreeWayConflictHandler> handlers)Create a newCompositeConflictHandlerwith an initial set of backing handler. UseaddHandler(ThreeWayConflictHandler)to add additional handlers.- Parameters:
handlers- the backing handlers
-
CompositeConflictHandler
public CompositeConflictHandler()
Create a newCompositeConflictHandlerwith no backing handlers. backing handler. UseaddHandler(ThreeWayConflictHandler)to add handlers.
-
-
Method Detail
-
addHandler
public CompositeConflictHandler addHandler(@NotNull @NotNull ThreeWayConflictHandler handler)
Add a new backing conflict handler. The new handler takes precedence over all currently installed handlers.- Parameters:
handler-- Returns:
- this
-
addExistingProperty
@NotNull public @NotNull ThreeWayConflictHandler.Resolution addExistingProperty(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull PropertyState ours, @NotNull @NotNull PropertyState theirs)
Description copied from interface:ThreeWayConflictHandlerThe propertyourshas been added toparentwhich conflicts with propertytheirswhich has been added in the persistence store.- Specified by:
addExistingPropertyin interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictours- our version of the propertytheirs- their version of the property- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
changeDeletedProperty
@NotNull public @NotNull ThreeWayConflictHandler.Resolution changeDeletedProperty(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull PropertyState ours, @NotNull @NotNull PropertyState base)
Description copied from interface:ThreeWayConflictHandlerThe propertyourshas been changed inparentwhile it was removed in the persistence store.- Specified by:
changeDeletedPropertyin interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictours- our version of the propertybase- the base version of the property- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
changeChangedProperty
@NotNull public @NotNull ThreeWayConflictHandler.Resolution changeChangedProperty(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull PropertyState ours, @NotNull @NotNull PropertyState theirs, @NotNull @NotNull PropertyState base)
Description copied from interface:ThreeWayConflictHandlerThe propertyourshas been changed inparentwhile it was also changed to a different value (theirs) in the persistence store.- Specified by:
changeChangedPropertyin interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictours- our version of the propertytheirs- their version of the propertybase- the base version of the property- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
deleteDeletedProperty
@NotNull public @NotNull ThreeWayConflictHandler.Resolution deleteDeletedProperty(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull PropertyState base)
Description copied from interface:ThreeWayConflictHandlerThe propertyourshas been removed inparentwhile it was also removed in the persistence store.- Specified by:
deleteDeletedPropertyin interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictbase- the base version of the property- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
deleteChangedProperty
@NotNull public @NotNull ThreeWayConflictHandler.Resolution deleteChangedProperty(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull PropertyState theirs, @NotNull @NotNull PropertyState base)
Description copied from interface:ThreeWayConflictHandlerThe propertytheirschanged in the persistence store while it has been deleted locally.- Specified by:
deleteChangedPropertyin interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflicttheirs- their version of the propertybase- the base version of the property- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
addExistingNode
@NotNull public @NotNull ThreeWayConflictHandler.Resolution addExistingNode(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull java.lang.String name, @NotNull @NotNull NodeState ours, @NotNull @NotNull NodeState theirs)
Description copied from interface:ThreeWayConflictHandlerThe nodeourshas been added toparentwhich conflicts with nodetheirswhich has been added in the persistence store.- Specified by:
addExistingNodein interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictname- name of the nodeours- our version of the nodetheirs- their version of the node- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
changeDeletedNode
@NotNull public @NotNull ThreeWayConflictHandler.Resolution changeDeletedNode(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull java.lang.String name, @NotNull @NotNull NodeState ours, @NotNull @NotNull NodeState base)
Description copied from interface:ThreeWayConflictHandlerThe nodeourshas been changed inparentwhile it was removed in the persistence store.- Specified by:
changeDeletedNodein interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictname- name of the nodeours- our version of the nodebase- the base version of the node- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
deleteChangedNode
@NotNull public @NotNull ThreeWayConflictHandler.Resolution deleteChangedNode(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull java.lang.String name, @NotNull @NotNull NodeState theirs, @NotNull @NotNull NodeState base)
Description copied from interface:ThreeWayConflictHandlerThe nodetheirschanged in the persistence store while it has been deleted locally.- Specified by:
deleteChangedNodein interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictname- name of the nodetheirs- their version of the nodebase- the base version of the node- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
deleteDeletedNode
@NotNull public @NotNull ThreeWayConflictHandler.Resolution deleteDeletedNode(@NotNull @NotNull NodeBuilder parent, @NotNull @NotNull java.lang.String name, @NotNull @NotNull NodeState base)
Description copied from interface:ThreeWayConflictHandlerThe nodenamehas been removed inparentwhile it was also removed in the persistence store.- Specified by:
deleteDeletedNodein interfaceThreeWayConflictHandler- Parameters:
parent- root of the conflictname- name of the nodebase- the base version of the node- Returns:
ThreeWayConflictHandler.Resolutionof the conflict
-
-