Package org.apache.ivy.core.resolve
Class VisitNode
- java.lang.Object
-
- org.apache.ivy.core.resolve.VisitNode
-
public class VisitNode extends java.lang.ObjectA visit node is an object used to represent one visit from one parent on anIvyNodeof the dependency graph. During dependency resolution, theResolveEnginevisits nodes of the dependency graph following the dependencies, thus the same node can be visited several times, if it is requested from several module. In this case you will have one VisitNode per parent and per root module configuration. Thus VisitNode stores data specific to the visit:- parent
- the node from which the visit is occurring
- parentConf
- the configuration of the parent in which this node is visited
- rootModuleConf
- the configuration of the root module which is currently resolved
-
-
Field Summary
Fields Modifier and Type Field Description private ResolveDatadataShared ResolveData instance, which can be used to get info on the current resolve processprivate java.lang.BooleanisCircularBoolean.TRUE if a node with a same module id as the one visited has already been visited in the current path.private IvyNodenodeThe node which is currently visitedprivate VisitNodeparentRepresents the current parent of the node during ivy visit of dependency graph.private java.lang.StringparentConfThe configuration of the parent module in the current visitprivate java.util.Collection<VisitNode>pathDirect path from root to this node.private java.lang.StringrequestedConfThe configuration requested by the parent Note that this is the actual conf requested by the parent, not a configuration extended by the requested conf which actually trigger the node visitprivate VisitNoderootThe root node of the current visit It is null until it is required, see getRootprivate java.lang.StringrootModuleConfThe root configuration which is currently visitedprivate IvyNodeUsageusageIvyNode usage information to update when visiting the underlying IvyNode.
-
Constructor Summary
Constructors Constructor Description VisitNode(ResolveData data, IvyNode node, VisitNode parent, java.lang.String rootModuleConf, java.lang.String parentConf)VisitNode(ResolveData data, IvyNode node, VisitNode parent, java.lang.String rootModuleConf, java.lang.String parentConf, IvyNodeUsage usage)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.Collection<VisitNode>computePath()private VisitNodecomputeRoot()ConfigurationgetConfiguration(java.lang.String conf)java.lang.String[]getConfsToFetch()java.util.Collection<VisitNode>getDependencies(java.lang.String conf)DependencyDescriptorgetDependencyDescriptor()ModuleDescriptorgetDescriptor()IvyNodeEviction.EvictionDatagetEvictedData()java.util.Collection<ModuleRevisionId>getEvictedRevisions(ModuleId moduleId)IvyNodeEviction.EvictionDatagetEvictionDataInRoot(java.lang.String rootModuleConf, VisitNode ancestor)ModuleRevisionIdgetId()ModuleIdgetModuleId()IvyNodegetNode()VisitNodegetParent()java.lang.StringgetParentConf()private IvyNodegetParentNode()java.util.Collection<VisitNode>getPath()Get an ordered collection with the nodes from the root to this nodejava.lang.String[]getRealConfs(java.lang.String conf)IvyNodegetRealNode()Returns the 'real' node currently visited.java.lang.StringgetRequestedConf()java.lang.String[]getRequiredConfigurations()java.lang.String[]getRequiredConfigurations(VisitNode in, java.lang.String inConf)ModuleRevisionIdgetResolvedId()java.util.Collection<ModuleRevisionId>getResolvedRevisions(ModuleId mid)VisitNodegetRoot()static VisitNodegetRoot(VisitNode parent)java.lang.StringgetRootModuleConf()private IvyNodeUsagegetUsage()(package private) VisitNodegotoNode(IvyNode node)Returns a VisitNode for the given node.booleanhasProblem()booleanisCircular()Returns true if this node can already be found in the pathbooleanisConfRequiredByMergedUsageOnly(java.lang.String conf)booleanisEvicted()protected booleanisParentConfTransitive()Checks if the current node's parent configuration is transitive.booleanisTransitive()Returns true if the current dependency descriptor is transitive and the parent configuration is transitive.booleanloadData(java.lang.String conf, boolean shouldBePublic)voidmarkEvicted(IvyNodeEviction.EvictionData evictionData)voidmarkEvicted(VisitNode parent, ConflictManager conflictMgr, java.util.Collection<IvyNode> selected)Marks the current node as evicted by the the given selected IvyNodes, in the given parent and root module configuration, with the givenConflictManagervoidsetParentConf(java.lang.String parentConf)voidsetRequestedConf(java.lang.String requestedConf)private ModuleRevisionId[]toMrids(java.util.Collection<VisitNode> path, ModuleRevisionId last)java.lang.StringtoString()private VisitNodetraverse(VisitNode parent, java.lang.String parentConf, IvyNode node, IvyNodeUsage usage)private VisitNodetraverseChild(java.lang.String parentConf, IvyNode child)voidupdateConfsToFetch(java.util.Collection<java.lang.String> confs)voiduseRealNode()Ask to the current visited node to use a real node only, if one exist.
-
-
-
Field Detail
-
node
private IvyNode node
The node which is currently visited
-
parent
private VisitNode parent
Represents the current parent of the node during ivy visit of dependency graph.
-
root
private VisitNode root
The root node of the current visit It is null until it is required, see getRoot
-
path
private java.util.Collection<VisitNode> path
Direct path from root to this node. Note that the collection is ordered but is not a list implementation This collection is null until it is required, see getPath
-
parentConf
private java.lang.String parentConf
The configuration of the parent module in the current visit
-
requestedConf
private java.lang.String requestedConf
The configuration requested by the parent Note that this is the actual conf requested by the parent, not a configuration extended by the requested conf which actually trigger the node visit
-
rootModuleConf
private java.lang.String rootModuleConf
The root configuration which is currently visited
-
data
private ResolveData data
Shared ResolveData instance, which can be used to get info on the current resolve process
-
isCircular
private java.lang.Boolean isCircular
Boolean.TRUE if a node with a same module id as the one visited has already been visited in the current path. null if not computed yet Boolean.FALSE otherwise
-
usage
private IvyNodeUsage usage
IvyNode usage information to update when visiting the underlying IvyNode. This is usually the main IvyNodeUsage of the underlying node, except when we are visiting it coming from an evicted node replaced by the other one.
-
-
Constructor Detail
-
VisitNode
public VisitNode(ResolveData data, IvyNode node, VisitNode parent, java.lang.String rootModuleConf, java.lang.String parentConf)
-
VisitNode
public VisitNode(ResolveData data, IvyNode node, VisitNode parent, java.lang.String rootModuleConf, java.lang.String parentConf, IvyNodeUsage usage)
-
-
Method Detail
-
getNode
public IvyNode getNode()
-
getRequestedConf
public java.lang.String getRequestedConf()
- Returns:
- Returns the configuration requested by the parent
-
setRequestedConf
public void setRequestedConf(java.lang.String requestedConf)
-
getParent
public VisitNode getParent()
-
getRoot
public VisitNode getRoot()
-
getPath
public java.util.Collection<VisitNode> getPath()
Get an ordered collection with the nodes from the root to this node- Returns:
- Collection<VisitNode>
-
computePath
private java.util.Collection<VisitNode> computePath()
-
computeRoot
private VisitNode computeRoot()
-
getParentConf
public java.lang.String getParentConf()
-
setParentConf
public void setParentConf(java.lang.String parentConf)
-
getRootModuleConf
public java.lang.String getRootModuleConf()
-
isTransitive
public boolean isTransitive()
Returns true if the current dependency descriptor is transitive and the parent configuration is transitive. Otherwise returns false.- Returns:
- true if current node is transitive and the parent configuration is transitive.
-
isParentConfTransitive
protected boolean isParentConfTransitive()
Checks if the current node's parent configuration is transitive.- Returns:
- true if the node's parent configuration is transitive
-
getRealNode
public IvyNode getRealNode()
Returns the 'real' node currently visited. 'Real' means that if we are visiting a node created originally with only a version constraint, and if this version constraint has been resolved to an existing node in the graph, we will return the existing node, and not the one originally used which is about to be discarded, since it's not possible to have in the graph two nodes for the same ModuleRevisionId- Returns:
- the 'real' node currently visited.
-
useRealNode
public void useRealNode()
Ask to the current visited node to use a real node only, if one exist. See getRealNode for details about what a 'real' node is.
-
loadData
public boolean loadData(java.lang.String conf, boolean shouldBePublic)
-
getDependencies
public java.util.Collection<VisitNode> getDependencies(java.lang.String conf)
-
gotoNode
VisitNode gotoNode(IvyNode node)
Returns a VisitNode for the given node. The given node must be a representation of the same module (usually in another revision) as the one visited by this node.- Parameters:
node- the node to visit- Returns:
- a VisitNode for the given node
-
getUsage
private IvyNodeUsage getUsage()
-
traverse
private VisitNode traverse(VisitNode parent, java.lang.String parentConf, IvyNode node, IvyNodeUsage usage)
-
toMrids
private ModuleRevisionId[] toMrids(java.util.Collection<VisitNode> path, ModuleRevisionId last)
-
getResolvedId
public ModuleRevisionId getResolvedId()
-
updateConfsToFetch
public void updateConfsToFetch(java.util.Collection<java.lang.String> confs)
-
getId
public ModuleRevisionId getId()
-
isEvicted
public boolean isEvicted()
-
getRealConfs
public java.lang.String[] getRealConfs(java.lang.String conf)
-
hasProblem
public boolean hasProblem()
-
getConfiguration
public Configuration getConfiguration(java.lang.String conf)
-
getEvictedData
public IvyNodeEviction.EvictionData getEvictedData()
-
getDependencyDescriptor
public DependencyDescriptor getDependencyDescriptor()
-
getParentNode
private IvyNode getParentNode()
-
isCircular
public boolean isCircular()
Returns true if this node can already be found in the path- Returns:
- boolean
-
getConfsToFetch
public java.lang.String[] getConfsToFetch()
-
getRequiredConfigurations
public java.lang.String[] getRequiredConfigurations(VisitNode in, java.lang.String inConf)
-
getModuleId
public ModuleId getModuleId()
-
getResolvedRevisions
public java.util.Collection<ModuleRevisionId> getResolvedRevisions(ModuleId mid)
-
markEvicted
public void markEvicted(IvyNodeEviction.EvictionData evictionData)
-
getRequiredConfigurations
public java.lang.String[] getRequiredConfigurations()
-
markEvicted
public void markEvicted(VisitNode parent, ConflictManager conflictMgr, java.util.Collection<IvyNode> selected)
Marks the current node as evicted by the the given selected IvyNodes, in the given parent and root module configuration, with the givenConflictManager- Parameters:
parent- the VisitNode in which eviction has been madeconflictMgr- the conflict manager responsible for the evictionselected- a Collection ofIvyNodewhich have been selected
-
getDescriptor
public ModuleDescriptor getDescriptor()
-
getEvictionDataInRoot
public IvyNodeEviction.EvictionData getEvictionDataInRoot(java.lang.String rootModuleConf, VisitNode ancestor)
-
getEvictedRevisions
public java.util.Collection<ModuleRevisionId> getEvictedRevisions(ModuleId moduleId)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isConfRequiredByMergedUsageOnly
public boolean isConfRequiredByMergedUsageOnly(java.lang.String conf)
-
-