Class AbstractMergeableElementList
- java.lang.Object
-
- org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
-
- org.codehaus.plexus.metadata.merge.support.AbstractMergeableElement
-
- org.codehaus.plexus.metadata.merge.support.AbstractMergeableElementList
-
- All Implemented Interfaces:
Mergeable
- Direct Known Subclasses:
ComponentsElement,RequirementsElement
public abstract class AbstractMergeableElementList extends AbstractMergeableElement
Base class that allows for handling merging two element lists.TODO Refactor and make this extend
AbstractMergeableElementwhich is what this actually is, but with added bits for merging child element lists.- Author:
- Rahul Thakur
-
-
Field Summary
-
Fields inherited from class org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
element
-
-
Constructor Summary
Constructors Constructor Description AbstractMergeableElementList(org.jdom2.Element element)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ListgetElementNamesForConflictResolution(List defaultList)Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.protected abstract StringgetTagNameForRecurringMergeable()Allows the sub classes to provided a tag name that they expect to recurr within them.voidmerge(Mergeable me)Merges an element of same type.protected voidmerge(org.jdom2.Element parent, Map dMap, Map rMap)Identifies the conflicting elements in the dominant and recessiveMapinstance 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.-
Methods inherited from class org.codehaus.plexus.metadata.merge.support.AbstractMergeableElement
isRecessiveElementInConflict, isRecessiveElementInConflict, merge, mergeableElementComesFromRecessive
-
Methods inherited from class org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
addContent, addContent, addContent, addContent, addContent, addNamespaceDeclaration, clone, cloneContent, detach, equals, getAdditionalNamespaces, getAttribute, getAttribute, getAttributes, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValue, getChild, getChild, getChildren, getChildren, getChildren, getChildText, getChildText, getChildTextNormalize, getChildTextNormalize, getChildTextTrim, getChildTextTrim, getContent, getContent, getContent, getContentSize, getDefaultMergeStrategy, getDescendants, getDescendants, getDocument, getElement, getName, getNamespace, getNamespace, getNamespacePrefix, getNamespaceURI, getParent, getParentElement, getQualifiedName, getText, getTextNormalize, getTextTrim, getValue, hashCode, indexOf, isAncestor, isExpectedElementType, isRootElement, removeAttribute, removeAttribute, removeAttribute, removeChild, removeChild, removeChildren, removeChildren, removeContent, removeContent, removeContent, removeContent, removeNamespaceDeclaration, setAttribute, setAttribute, setAttribute, setAttributes, setContent, setContent, setContent, setContent, setName, setNamespace, setText, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.codehaus.plexus.metadata.merge.support.Mergeable
getAllowedTags
-
-
-
-
Method Detail
-
parseRecurringMergeables
protected Map parseRecurringMergeables(String tagName, List compositeKeyList, Mergeable parentElement) throws Exception
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 timescompositeKeyList- List of element/tag names to be used as composite keys to register recurringMergeableinstances.parentElement-Mergeable.- Returns:
- Map of
Mergeableinstances keyed on the composite key obtained fromgetElementNamesForConflictResolution(java.util.List) - Throws:
Exception- if there was an error parsing and registeringMergeableinstances
-
merge
public void merge(Mergeable me) throws MergeException
Description copied from class:AbstractMergeableSupportMerges an element of same type.- Specified by:
mergein interfaceMergeable- Overrides:
mergein classAbstractMergeableElement- Parameters:
me- Another entity that is mergeable.- Throws:
MergeException- if there was an error merging the mergeables.
-
merge
protected void merge(org.jdom2.Element parent, Map dMap, Map rMap) throws ExceptionIdentifies the conflicting elements in the dominant and recessiveMapinstance and merges as required.- Parameters:
parent-Elementthat 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 fromgetElementNamesForConflictResolution(List)rMap- Recessive Map keyed by the composite key obtained fromgetElementNamesForConflictResolution(List)- Throws:
Exception- if there was an error merging both the maps.
-
getTagNameForRecurringMergeable
protected abstract String getTagNameForRecurringMergeable()
Allows the sub classes to provided a tag name that they expect to recurr within them. For instance:- <components> expects <component> to recurr within itself.
- <requirements> expects <requirement> to recurr within itself.
- Returns:
- tag name of the
Mergeableelement that occurs multiple times.
-
getElementNamesForConflictResolution
protected abstract List getElementNamesForConflictResolution(List defaultList)
Description copied from class:AbstractMergeableSupportSub classes should override if they wish to provide a different combination of composite keys for determining conflicts.- Overrides:
getElementNamesForConflictResolutionin classAbstractMergeableSupport- Parameters:
defaultList- the default list.- Returns:
- the default list.
-
-