Package org.apache.ivy.core.resolve
Class IvyNode
java.lang.Object
org.apache.ivy.core.resolve.IvyNode
- All Implemented Interfaces:
Comparable<IvyNode>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IvyNodeCallers
private Collection<String>
private ResolveData
private Map<IvyNode,
DependencyDescriptor> private boolean
private IvyNodeEviction
private static final Pattern
private Collection<String>
private ModuleRevisionId
private Collection<String>
private ModuleDescriptor
private Map<ModuleRevisionId,
IvyNodeUsage> private ResolvedModuleRevision
private Exception
private IvyNode
private boolean
private ResolveEngineSettings
private IvyNodeUsage
-
Constructor Summary
ConstructorsConstructorDescriptionIvyNode
(ResolveData data, ModuleDescriptor md) IvyNode
(ResolveData data, IvyNode parent, DependencyDescriptor dd) -
Method Summary
Modifier and TypeMethodDescriptionprivate <T> void
addAllIfNotNull
(Collection<T> into, Collection<T> col) private void
addArtifactsFromMergedUsage
(String rootModuleConf, Set<Artifact> artifacts) private void
addArtifactsFromOwnUsage
(Set<Artifact> artifacts, Set<DependencyArtifactDescriptor> dependencyArtifacts) void
addCaller
(String rootModuleConf, IvyNode callerNode, String callerConf, String requestedConf, String[] dependencyConfs, DependencyDescriptor dd) private void
addDependencyDescriptor
(IvyNode parent, DependencyDescriptor dd) private void
addRootModuleConfigurations
(IvyNodeUsage usage, String rootModuleConf, String[] dependencyConfs) void
blacklist
(IvyNodeBlacklist bdata) Blacklists the current node, so that a new resolve process won't ever consider this node as available in the repository.(package private) boolean
canExclude
(String rootModuleConf) void
clean()
Clean data related to one root module configuration onlyprivate void
clearEvictionDataInAllCallers
(String rootModuleConf, Stack<IvyNode> callerStack) int
boolean
directlyExcludes
(ModuleDescriptor md, String[] moduleConfs, DependencyDescriptor dd, Artifact artifact) void
discardConf
(String rootModuleConf, String conf) Deprecated.boolean
doesCallersExclude
(String rootModuleConf, Artifact artifact, Deque<IvyNode> callersStack) boolean
doesCallersExclude
(String rootModuleConf, Artifact artifact, Stack<ModuleRevisionId> callersStack) Deprecated.(package private) Boolean
doesExclude
(ModuleDescriptor md, String rootModuleConf, String[] moduleConfs, DependencyDescriptor dd, Artifact artifact, Deque<IvyNode> callersStack) boolean
private static Collection<Artifact>
findArtifactsMatching
(IncludeRule rule, Map<ArtifactId, Artifact> allArtifacts) findNode
(ModuleRevisionId mrid) private Collection<IvyNode>
Finds and returns a path in callers from the given module id to the current nodeprivate Collection<IvyNode>
Artifact[]
Returns all the artifacts of this dependency required in all the root module configurationsprivate Collection<IvyNodeUsage>
Artifact[]
getArtifacts
(String rootModuleConf) Returns the artifacts of this dependency required in the configurations themselves required in the given root module configurationgetBlacklistData
(String rootModuleConf) Returns the blacklist data of this node in the given root module conf, ornull
if this node is not blacklisted in this root module conf.getCallers
(String rootModuleConf) getConfiguration
(String conf) String[]
getConfigurations
(String rootModuleConf) Returns the configurations of the dependency required in a given root module configuration.String[]
getData()
private String
getDefaultConf
(String conf) getDependencies
(String rootModuleConf, String[] confs, String requestedConf) getDependencies
(String rootModuleConf, String conf, String requestedConf) Load the dependencies of the current nodegetDependencyDescriptor
(IvyNode parent) private IvyNode
getDirectCallerFor
(ModuleId from) String[]
getEvictedData
(String rootModuleConf) getEvictedNodes
(ModuleId mid, String rootModuleConf) getEvictedRevisions
(ModuleId mid, String rootModuleConf) getEvictionDataInRoot
(String rootModuleConf, IvyNode ancestor) getId()
long
Returns the last modified timestamp of the module represented by this Node, or 0 if the last modified timestamp is currently unknown (module not loaded)private String
getMainConf
(String conf) getPendingConflicts
(String rootModuleConf, ModuleId mid) Returns a collection of Nodes in conflict for which conflict has been detected but conflict resolution hasn't been done yetlong
String[]
getRealConfs
(String conf) String[]
returns all the current required configurations of the nodeString[]
getRequiredConfigurations
(IvyNode in, String inConf) returns the required configurations from the given nodegetResolvedNodes
(ModuleId moduleId, String rootModuleConf) A copy of the set of resolved nodes (real nodes)getResolvedRevisions
(ModuleId moduleId, String rootModuleConf) getRoot()
String[]
Returns the root module configurations in which this dependency is requiredReturns the root module configurations in which this dependency is requiredArtifact[]
getSelectedArtifacts
(Filter<Artifact> artifactFilter) Returns all the artifacts of this dependency required in the root module configurations in which the node is not evicted nor blacklistedprivate boolean
handleConfiguration
(boolean loaded, String rootModuleConf, IvyNode parent, String parentConf, String conf, boolean shouldBePublic, IvyNodeUsage usage) boolean
hasAnyMergedUsageWithTransitiveDependency
(String rootModuleConf) Indicates if there is any of the merged usages of this node which has a depender with transitive dependency descriptor.boolean
int
hashCode()
boolean
private void
init
(ResolveData data) boolean
isBlacklisted
(String rootModuleConf) Indicates if this node has been blacklisted in the given root module conf.boolean
Indicates if this node has been blacklisted in all root module configurations.boolean
protected boolean
isConfRequiredByMergedUsageOnly
(String rootModuleConf, String conf) private boolean
isDependencyModuleExcluded
(DependencyDescriptor dd, String rootModuleConf, ModuleRevisionId dependencyRevisionId, String conf) boolean
boolean
boolean
boolean
isLoaded()
(package private) boolean
isRoot()
private boolean
isRootModuleConfLoaded
(String rootModuleConf) boolean
boolean
loadData
(String rootModuleConf, IvyNode parent, String parentConf, String conf, boolean shouldBePublic, IvyNodeUsage usage) After the call node may be discarded.void
markEvicted
(String rootModuleConf, IvyNode node, ConflictManager conflictManager, Collection<IvyNode> resolved) void
markEvicted
(IvyNodeEviction.EvictionData evictionData) private boolean
markRootModuleConfLoaded
(String rootModuleConf) private void
moveToRealNode
(String rootModuleConf, IvyNode parent, String parentConf, String conf, boolean shouldBePublic, IvyNode resolved) private String[]
resolveSpecialConfigurations
(String[] dependencyConfigurations) resolve the '*' special configurations if necessary and possiblevoid
setEvictedNodes
(ModuleId moduleId, String rootModuleConf, Collection<IvyNode> evicted) void
setPendingConflicts
(ModuleId moduleId, String rootModuleConf, Collection<IvyNode> conflicts) void
setResolvedNodes
(ModuleId moduleId, String rootModuleConf, Collection<IvyNode> resolved) private ModuleRevisionId[]
toMrids
(Collection<IvyNode> path, IvyNode depNode) toString()
void
updateConfsToFetch
(Collection<String> confs) private void
updateDataFrom
(IvyNode node, String rootModuleConf, boolean real) Update data in this node from data of the given node, for the given root module configuration.
-
Field Details
-
FALLBACK_CONF_PATTERN
-
data
-
settings
-
callers
-
eviction
-
root
-
id
-
dds
-
md
-
module
-
problem
-
downloaded
private boolean downloaded -
searched
private boolean searched -
confsToFetch
-
fetchedConfigurations
-
loadedRootModuleConfs
-
usage
-
mergedUsages
-
-
Constructor Details
-
IvyNode
-
IvyNode
-
-
Method Details
-
init
-
loadData
public boolean loadData(String rootModuleConf, IvyNode parent, String parentConf, String conf, boolean shouldBePublic, IvyNodeUsage usage) After the call node may be discarded. To avoid using discarded node, make sure to get the real node after the callIvyNode node = ... node.loadData(); node = node.getRealNode(); ...
- Parameters:
rootModuleConf
- Stringparent
- IvyNodeparentConf
- Stringconf
- StringshouldBePublic
- booleanusage
- IvyNodeUsage- Returns:
- boolean
-
moveToRealNode
-
getDependencies
public Collection<IvyNode> getDependencies(String rootModuleConf, String[] confs, String requestedConf) -
getDependencies
public Collection<IvyNode> getDependencies(String rootModuleConf, String conf, String requestedConf) Load the dependencies of the current nodeThe resulting collection of nodes may have some configuration to load
- Parameters:
rootModuleConf
- the requested configuration of the root moduleconf
- the configuration to load of this noderequestedConf
- the actual node conf requested, possibly extending theconf
one.- Returns:
Collection
ofIvyNode
-
addDependencyDescriptor
-
getDependencyDescriptor
-
isDependencyModuleExcluded
private boolean isDependencyModuleExcluded(DependencyDescriptor dd, String rootModuleConf, ModuleRevisionId dependencyRevisionId, String conf) -
doesExclude
Boolean doesExclude(ModuleDescriptor md, String rootModuleConf, String[] moduleConfs, DependencyDescriptor dd, Artifact artifact, Deque<IvyNode> callersStack) -
directlyExcludes
public boolean directlyExcludes(ModuleDescriptor md, String[] moduleConfs, DependencyDescriptor dd, Artifact artifact) -
hasConfigurationsToLoad
public boolean hasConfigurationsToLoad() -
markRootModuleConfLoaded
-
isRootModuleConfLoaded
-
handleConfiguration
private boolean handleConfiguration(boolean loaded, String rootModuleConf, IvyNode parent, String parentConf, String conf, boolean shouldBePublic, IvyNodeUsage usage) -
getDefaultConf
-
getMainConf
-
updateConfsToFetch
-
resolveSpecialConfigurations
resolve the '*' special configurations if necessary and possible -
getRequiredConfigurations
returns the required configurations from the given node- Parameters:
in
- IvyNodeinConf
- ditto- Returns:
- array of configuration names
-
addAllIfNotNull
-
getRequiredConfigurations
returns all the current required configurations of the node- Returns:
- array of configuration names
-
getConfiguration
-
getConfigurations
Returns the configurations of the dependency required in a given root module configuration.- Parameters:
rootModuleConf
- String- Returns:
- array of configuration names
-
isConfRequiredByMergedUsageOnly
-
discardConf
Deprecated. -
addRootModuleConfigurations
private void addRootModuleConfigurations(IvyNodeUsage usage, String rootModuleConf, String[] dependencyConfs) -
getRootModuleConfigurations
Returns the root module configurations in which this dependency is required- Returns:
- array of configuration names
-
getRootModuleConfigurationsSet
Returns the root module configurations in which this dependency is required- Returns:
Set
of configuration names
-
getConfsToFetch
-
getRealConfs
-
findPath
Finds and returns a path in callers from the given module id to the current node- Parameters:
from
- the module id to start the path from- Returns:
- a collection representing the path, starting with the from node, followed by the list of nodes being one path to the current node, excluded
-
findPath
-
updateDataFrom
Update data in this node from data of the given node, for the given root module configuration.- Parameters:
node
- the source node from which data should be copiedrootModuleConf
- the root module configuration for which data should be updatedreal
- true if the node to update from actually corresponds to the same real node (usually updated because of dynamic revision resolution), false if it's not the same real node (usually updated because of node eviction)
-
getAllUsages
-
getAllArtifacts
Returns all the artifacts of this dependency required in all the root module configurations- Returns:
- array of
Artifact
s
-
getSelectedArtifacts
Returns all the artifacts of this dependency required in the root module configurations in which the node is not evicted nor blacklisted- Parameters:
artifactFilter
- Filter- Returns:
- array of
Artifact
s
-
getArtifacts
Returns the artifacts of this dependency required in the configurations themselves required in the given root module configuration- Parameters:
rootModuleConf
- String- Returns:
- array of
Artifact
s
-
addArtifactsFromOwnUsage
private void addArtifactsFromOwnUsage(Set<Artifact> artifacts, Set<DependencyArtifactDescriptor> dependencyArtifacts) -
addArtifactsFromMergedUsage
-
findArtifactsMatching
private static Collection<Artifact> findArtifactsMatching(IncludeRule rule, Map<ArtifactId, Artifact> allArtifacts) -
hasProblem
public boolean hasProblem() -
getProblem
-
getProblemMessage
-
isDownloaded
public boolean isDownloaded() -
isSearched
public boolean isSearched() -
isLoaded
public boolean isLoaded() -
isFetched
-
findNode
-
isRoot
boolean isRoot() -
getRoot
-
getConflictManager
-
getRealNode
-
getId
-
getModuleId
-
getDescriptor
-
getData
-
getModuleRevision
-
getPublication
public long getPublication() -
getLastModified
public long getLastModified()Returns the last modified timestamp of the module represented by this Node, or 0 if the last modified timestamp is currently unknown (module not loaded)- Returns:
- the last modified timestamp of the module represented by this Node
-
getResolvedId
-
clean
public void clean()Clean data related to one root module configuration only -
canExclude
-
getDirectCallerFor
-
getCallers
-
getAllCallersModuleIds
-
getAllCallers
-
getAllRealCallers
-
addCaller
-
doesCallersExclude
-
doesCallersExclude
@Deprecated public boolean doesCallersExclude(String rootModuleConf, Artifact artifact, Stack<ModuleRevisionId> callersStack) Deprecated. -
toMrids
-
getResolvedNodes
A copy of the set of resolved nodes (real nodes)- Parameters:
moduleId
- dittorootModuleConf
- String- Returns:
- Set<IvyNode>
-
getResolvedRevisions
-
markEvicted
-
getAllEvictingConflictManagers
-
getAllEvictingNodes
-
getAllEvictingNodesDetails
-
getEvictedConfs
-
getEvictedData
-
getEvictedNodes
-
getEvictedRevisions
-
getEvictionDataInRoot
-
isCompletelyEvicted
public boolean isCompletelyEvicted() -
isEvicted
-
markEvicted
public void markEvicted(String rootModuleConf, IvyNode node, ConflictManager conflictManager, Collection<IvyNode> resolved) -
setEvictedNodes
-
setResolvedNodes
public void setResolvedNodes(ModuleId moduleId, String rootModuleConf, Collection<IvyNode> resolved) -
toString
-
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<IvyNode>
-
hashCode
public int hashCode() -
getPendingConflicts
Returns a collection of Nodes in conflict for which conflict has been detected but conflict resolution hasn't been done yet- Parameters:
rootModuleConf
- dittomid
- the module id for which pending conflicts should be found- Returns:
- a Collection of IvyNode in pending conflict
-
setPendingConflicts
public void setPendingConflicts(ModuleId moduleId, String rootModuleConf, Collection<IvyNode> conflicts) -
blacklist
Blacklists the current node, so that a new resolve process won't ever consider this node as available in the repository.This is useful in combination with
RestartResolveProcess
for conflict manager implementation which use a best effort strategy to find compatible dependency set, likeLatestCompatibleConflictManager
- Parameters:
bdata
- the root module configuration in which the node should be blacklisted
-
clearEvictionDataInAllCallers
-
isBlacklisted
Indicates if this node has been blacklisted in the given root module conf.A blacklisted node should be considered as if it doesn't even exist on the repository.
- Parameters:
rootModuleConf
- the root module conf for which we'd like to know if the node is blacklisted- Returns:
- true if this node is blacklisted int he given root module conf, false otherwise
- See Also:
-
isCompletelyBlacklisted
public boolean isCompletelyBlacklisted()Indicates if this node has been blacklisted in all root module configurations.- Returns:
- true if this node is blacklisted in all root module configurations, false otherwise
- See Also:
-
getBlacklistData
Returns the blacklist data of this node in the given root module conf, ornull
if this node is not blacklisted in this root module conf.- Parameters:
rootModuleConf
- the root module configuration to consider- Returns:
- the blacklist data if any
-
getMainUsage
-
hasAnyMergedUsageWithTransitiveDependency
Indicates if there is any of the merged usages of this node which has a depender with transitive dependency descriptor.If at there is at least one usage from the merged usages for which there is a depender in the given root module conf which has a dependency descriptor with transitive == true, then it returns true. Otherwise it returns false.
- Parameters:
rootModuleConf
- the root module configuration to consider- Returns:
- true if there is any merged usage with transitive dd, false otherwise.
-