API for implementing merging


This is a proposed patch that gives the basis of some classes that could be used to do merging of artefacts (such as War files) beyond the existing merging available in WebXmlMerger.

Basically it consists of an interface - IMergeProcessor - this allows merge processors to be passed artefacts to be merged, and then on performMerge() they would return their merged artefact. So for example a WarArchiveMerger would get passed (and return) WarArchives.

MergeSet is an abstract class that contains 3 sets -
things found just in the left hand side of a merge
things found just in the right hand side of a merge
things found in both sides of a merge (potential conflicts).

In order to perform a merge, a mergeset is passed a MergeStrategy, which is called back (as a visitor) to each node in order to perform the merging. Two examples (Preserve, Overwrite) cover the most common cases. Specific merge functionality can be provided by creating custom strategies and examining the items in question in order to determine what to do.

Two subtypes of MergeSet exist - one that is populated from collections of items (MergeNodeList - NodeLists), and the other from single elements (MergeElement - Elements).



grimsell grimsell


Nigel Magnay


Fix versions

Affects versions