Interface IMergeStrategy

public interface IMergeStrategy

Interface for IMergeProvider merge strategies.

Every implementation needs to provide a no-argument constructor.

Implementations of this interface are treated as Singletons. An instance of each strategy will be generated at startup and will then be reused whenever needed.

See Also:
IMergeProvider, IMergeTask, IMergeResult

Nested Class Summary
static class IMergeStrategy.Status
          Return status indicator for merge(IReadableMergeTask, IWriteableMergeResult, IMergeContext).
Method Summary
 IMergeStrategy.Status merge(IReadableMergeTask mergeTask, IWriteableMergeResult mergeResult, IMergeContext mergeContext)
          Tries to merge the pendingLocalClones and pendingRemoteClones according to the data given in the mergeTask.

Method Detail


IMergeStrategy.Status merge(IReadableMergeTask mergeTask,
                            IWriteableMergeResult mergeResult,
                            IMergeContext mergeContext)
                            throws MergeException
Tries to merge the pendingLocalClones and pendingRemoteClones according to the data given in the mergeTask.

May additionally processes pendingBaseClones in case of 3-way-merges.
See also: IReadableMergeTask.isThreeWayMerge().

The pending base clones list does not need to be completely processed. The pending local and remote clone lists should be empty once all strategies have been executed.
Usually the last ("fallback") strategy will mark all remaining, pending local and remote clones as lost clones.

The pendingLocalClones, pendingRemoteClones and pendingBaseClones as well as some support functions like a ICloneObjectExtensionMerger are available via the provided IMergeContext.

mergeTask - read-only description of the merge task at hand, the contents must not be modified in any way, never null.
mergeResult - a writable result wrapper which is used to incrementally build up the final merge result, never null. An IMergeStrategy may freely modify this object. However, care must be taken that a clone is not added multiple times to the same list. All clones which are added to the result need to be removed from both pending clones lists.
mergeContext - a collection of progress/status information about the current merge as well as some utility functions, never null. The context can be used to get access to lists of the still pending local/remote/base clones and to a merger for clone extensions.
the IMergeResult.Status result status for this strategy, never null.
MergeException - to be thrown when a serious error is detected. An exception should not be thrown if it can be expected that some other strategy might be able to handle this situation. All in all an exception should only be thrown in very extreme cases.