Class AbstractDependencyManager
- All Implemented Interfaces:
DependencyManager
- Direct Known Subclasses:
ClassicDependencyManager
,DefaultDependencyManager
,TransitiveDependencyManager
This implementation is Maven specific, as it works hand-in-hand along with Maven ModelBuilder. While model builder handles dependency management in the context of single POM (inheritance, imports, etc.), this implementation carries in-lineage modifications based on previously recorded dependency management rules sourced from ascendants while building the dependency graph. Root sourced management rules are special, in a way they are always applied, while en-route collected ones are carefully applied to proper descendants only, to not override work done by model builder already.
Details: Model builder handles version, scope from own dependency management (think "effective POM"). On the other hand it does not handle optional for example. System paths are aligned across whole graph, making sure there is same system path used by same dependency. Finally, exclusions (exclusions are additional information not effective or applied in same POM) are always applied. This implementation makes sure, that version and scope are not applied onto same node that actually provided the rules, to no override work that ModelBuilder did. It achieves this goal by tracking "depth" for each collected rule and ignoring rules coming from same depth as processed dependency node is.
- Since:
- 2.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected final int
protected final int
protected final int
protected final Map
<Object, Collection<AbstractDependencyManager.Holder<Collection<Exclusion>>>> protected final Map
<Object, AbstractDependencyManager.Holder<String>> protected final Map
<Object, AbstractDependencyManager.Holder<Boolean>> protected final Map
<Object, AbstractDependencyManager.Holder<String>> protected final Map
<Object, AbstractDependencyManager.Holder<String>> protected final SystemDependencyScope
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractDependencyManager
(int depth, int deriveUntil, int applyFrom, Map<Object, AbstractDependencyManager.Holder<String>> managedVersions, Map<Object, AbstractDependencyManager.Holder<String>> managedScopes, Map<Object, AbstractDependencyManager.Holder<Boolean>> managedOptionals, Map<Object, AbstractDependencyManager.Holder<String>> managedLocalPaths, Map<Object, Collection<AbstractDependencyManager.Holder<Collection<Exclusion>>>> managedExclusions, SystemDependencyScope systemDependencyScope) protected
AbstractDependencyManager
(int deriveUntil, int applyFrom, ScopeManager scopeManager) -
Method Summary
Modifier and TypeMethodDescriptionDerives a dependency manager for the specified collection context.boolean
int
hashCode()
protected boolean
isApplicable
(AbstractDependencyManager.Holder<?> holder) Returnstrue
if rule in holder is applicable at current depth.protected boolean
Returnstrue
if current dependency should be managed according to so far collected/derived rules.protected boolean
Returnstrue
if current context should be factored in (collected/derived).manageDependency
(Dependency dependency) Applies dependency management to the specified dependency.protected abstract DependencyManager
newInstance
(Map<Object, AbstractDependencyManager.Holder<String>> managedVersions, Map<Object, AbstractDependencyManager.Holder<String>> managedScopes, Map<Object, AbstractDependencyManager.Holder<Boolean>> managedOptionals, Map<Object, AbstractDependencyManager.Holder<String>> managedLocalPaths, Map<Object, Collection<AbstractDependencyManager.Holder<Collection<Exclusion>>>> managedExclusions)
-
Field Details
-
depth
-
deriveUntil
-
applyFrom
-
managedVersions
-
managedScopes
-
managedOptionals
-
managedLocalPaths
-
managedExclusions
protected final Map<Object,Collection<AbstractDependencyManager.Holder<Collection<Exclusion>>>> managedExclusions -
systemDependencyScope
-
-
Constructor Details
-
AbstractDependencyManager
-
AbstractDependencyManager
protected AbstractDependencyManager(int depth, int deriveUntil, int applyFrom, Map<Object, AbstractDependencyManager.Holder<String>> managedVersions, Map<Object, AbstractDependencyManager.Holder<String>> managedScopes, Map<Object, AbstractDependencyManager.Holder<Boolean>> managedOptionals, Map<Object, AbstractDependencyManager.Holder<String>> managedLocalPaths, Map<Object, Collection<AbstractDependencyManager.Holder<Collection<Exclusion>>>> managedExclusions, SystemDependencyScope systemDependencyScope)
-
-
Method Details
-
newInstance
protected abstract DependencyManager newInstance(Map<Object, AbstractDependencyManager.Holder<String>> managedVersions, Map<Object, AbstractDependencyManager.Holder<String>> managedScopes, Map<Object, AbstractDependencyManager.Holder<Boolean>> managedOptionals, Map<Object, AbstractDependencyManager.Holder<String>> managedLocalPaths, Map<Object, Collection<AbstractDependencyManager.Holder<Collection<Exclusion>>>> managedExclusions) -
deriveChildManager
Description copied from interface:DependencyManager
Derives a dependency manager for the specified collection context. When calculating the child manager, implementors are strongly advised to simply return the current instance if nothing changed to help save memory.- Specified by:
deriveChildManager
in interfaceDependencyManager
- Parameters:
context
- The dependency collection context, must not benull
.- Returns:
- The dependency manager for the dependencies of the target node or
null
if dependency management should no longer be applied.
-
manageDependency
Description copied from interface:DependencyManager
Applies dependency management to the specified dependency.- Specified by:
manageDependency
in interfaceDependencyManager
- Parameters:
dependency
- The dependency to manage, must not benull
.- Returns:
- The management update to apply to the dependency or
null
if the dependency is not managed at all.
-
isDerived
Returnstrue
if current context should be factored in (collected/derived). -
isApplied
Returnstrue
if current dependency should be managed according to so far collected/derived rules. -
isApplicable
Returnstrue
if rule in holder is applicable at current depth. -
equals
-
hashCode
-