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
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.
-
Field Summary
Fields inherited from class org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
element -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ListgetElementNamesForConflictResolution(List defaultList) Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.protected abstract StringAllows the sub classes to provided a tag name that they expect to recurr within them.private booleanisMergeRequired(Set dKeySet, Set rKeySet) Determines if a merge operation is required for the two sets (dominant and recessive) specified.private DescriptorTaglookupTagInstanceByName(String name, DescriptorTag[] values) Looks up and returns anDescriptorTaginstance for the specified tag name.voidMerges an element of same type.protected voidIdentifies 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, mergeableElementComesFromRecessiveMethods 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, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codehaus.plexus.metadata.merge.support.Mergeable
getAllowedTags
-
Constructor Details
-
AbstractMergeableElementList
public AbstractMergeableElementList(org.jdom2.Element element)
-
-
Method Details
-
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
-
lookupTagInstanceByName
Looks up and returns anDescriptorTaginstance for the specified tag name.- Parameters:
name- key to look up theDescriptorTaginstance on.- Returns:
DescriptorTaginstance whose name matches the name specified. Returnsnullif no match is found.
-
merge
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
Identifies 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.
-
isMergeRequired
Determines if a merge operation is required for the two sets (dominant and recessive) specified.- Parameters:
dKeySet- the dominant set of elements.rKeySet- the recessive set of elements.- Returns:
trueif a merge operation was required.
-
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
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.
-