org.codehaus.plexus.cdc.merge.support

Class AbstractMergeableElementList

public abstract class AbstractMergeableElementList extends AbstractMergeableElement

Base class that allows for handling merging two element lists.

TODO Refactor and make this extend AbstractMergeableElement which is what this actually is, but with added bits for merging child element lists.

Version: $Id: AbstractMergeableElementList.java 3522 2006-07-12 15:06:21Z brett $

Author: Rahul Thakur

Constructor Summary
AbstractMergeableElementList(Element element)
Method Summary
protected abstract ListgetElementNamesForConflictResolution(List defaultList)
protected abstract StringgetTagNameForRecurringMergeable()
Allows the sub classes to provided a tag name that they expect to recurr within them.
voidmerge(Mergeable me)
protected voidmerge(Element parent, Map dMap, Map rMap)
Identifies the conflicting elements in the dominant and recessive Map instance and merges as required.
protected MapparseRecurringMergeables(String tagName, List compositeKeyList, Mergeable parentElement)
Parses <component> elements and builds a map keyed basd on the list of composite keys specified.

Constructor Detail

AbstractMergeableElementList

public AbstractMergeableElementList(Element element)

Method Detail

getElementNamesForConflictResolution

protected abstract List getElementNamesForConflictResolution(List defaultList)

getTagNameForRecurringMergeable

protected abstract String getTagNameForRecurringMergeable()
Allows the sub classes to provided a tag name that they expect to recurr within them.

For instance:

Returns: tag name of the Mergeable element that occurs multiple times.

merge

public void merge(Mergeable me)

merge

protected void merge(Element parent, Map dMap, Map rMap)
Identifies the conflicting elements in the dominant and recessive Map instance and merges as required.

Parameters: parent Element that is parent for the children in the dominant Map instance. Merged content is added to this element. dMap Dominant Map keyed by the composite key obtained from getElementNamesForConflictResolution rMap Recessive Map keyed by the composite key obtained from getElementNamesForConflictResolution

Throws: Exception if there was an error merging both the maps.

parseRecurringMergeables

protected Map parseRecurringMergeables(String tagName, List compositeKeyList, Mergeable parentElement)
Parses <component> elements and builds a map keyed basd on the list of composite keys specified.

Parameters: tagName Name of the tag that appears multiple times compositeKeyList List of element/tag names to be used as composite keys to register recurring Mergeable instances.

Returns: Map of Mergeable instances keyed on the composite key obtained from getElementNamesForConflictResolution

Throws: Exception if there was an error parsing and registering Mergeable instances

Copyright © 2001-2010 Codehaus. All Rights Reserved.