org.sonatype.aether.graph
Interface DependencyNode

All Known Implementing Classes:
DefaultDependencyNode, TestDependencyNode

public interface DependencyNode

A node within a dependency graph. Note: When traversing a dirty graph, i.e. a graph which hasn't undergone conflict resolution, there can be multiple path leading to the same node instance.

Author:
Benjamin Bentmann

Method Summary
 boolean accept(DependencyVisitor visitor)
          Traverses this node and potentially its children using the specified visitor.
 java.util.Collection<Artifact> getAliases()
          Gets the known aliases for this dependency's artifact.
 java.util.List<DependencyNode> getChildren()
          Gets the child nodes of this node.
 java.util.Map<java.lang.Object,java.lang.Object> getData()
          Gets the custom data associated with this dependency node.
 Dependency getDependency()
          Gets the dependency associated with this node.
 java.lang.String getPremanagedScope()
          Gets the scope for the dependency before dependency management was applied (if any).
 java.lang.String getPremanagedVersion()
          Gets the version or version range for the dependency before dependency management was applied (if any).
 java.util.List<Artifact> getRelocations()
          Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.
 java.util.List<RemoteRepository> getRepositories()
          Gets the remote repositories from which this node's artifact shall be resolved.
 java.lang.String getRequestContext()
          Gets the request context in which this dependency node was created.
 Version getVersion()
          Gets the version that was selected for the dependency's target artifact.
 VersionConstraint getVersionConstraint()
          Gets the version constraint that was parsed from the dependency's version declaration.
 void setArtifact(Artifact artifact)
          Sets the artifact of the dependency.
 void setData(java.lang.Object key, java.lang.Object value)
          Associates the specified dependency node data with the given key.
 void setRequestContext(java.lang.String context)
          Sets the request context in which this dependency node was created.
 void setScope(java.lang.String scope)
          Sets the scope of the dependency.
 

Method Detail

getChildren

java.util.List<DependencyNode> getChildren()
Gets the child nodes of this node.

Returns:
The child nodes of this node, never null.

getDependency

Dependency getDependency()
Gets the dependency associated with this node. Note: For dependency graphs that have been constructed without a root dependency, the root node will not have a dependency associated with it.

Returns:
The dependency or null if none.

setArtifact

void setArtifact(Artifact artifact)
Sets the artifact of the dependency.

Parameters:
artifact - The artifact satisfying the dependency, must not be null.

getRelocations

java.util.List<Artifact> getRelocations()
Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.

Returns:
The (read-only) sequence of relocations, never null.

getAliases

java.util.Collection<Artifact> getAliases()
Gets the known aliases for this dependency's artifact. An alias can be used to mark a patched rebuild of some other artifact as such, thereby allowing conflict resolution to consider the patched and the original artifact as a conflict.

Returns:
The (read-only) set of known aliases, never null.

getVersionConstraint

VersionConstraint getVersionConstraint()
Gets the version constraint that was parsed from the dependency's version declaration.

Returns:
The version constraint for this node or null.

getVersion

Version getVersion()
Gets the version that was selected for the dependency's target artifact.

Returns:
The parsed version or null.

setScope

void setScope(java.lang.String scope)
Sets the scope of the dependency.

Parameters:
scope - The scope, may be null.

getPremanagedVersion

java.lang.String getPremanagedVersion()
Gets the version or version range for the dependency before dependency management was applied (if any).

Returns:
The dependency version before dependency management or null if the version was not managed.

getPremanagedScope

java.lang.String getPremanagedScope()
Gets the scope for the dependency before dependency management was applied (if any).

Returns:
The dependency scope before dependency management or null if the scope was not managed.

getRepositories

java.util.List<RemoteRepository> getRepositories()
Gets the remote repositories from which this node's artifact shall be resolved.

Returns:
The (read-only) list of remote repositories to use for artifact resolution, never null.

getRequestContext

java.lang.String getRequestContext()
Gets the request context in which this dependency node was created.

Returns:
The request context, never null.

setRequestContext

void setRequestContext(java.lang.String context)
Sets the request context in which this dependency node was created.

Parameters:
context - The context, may be null.

getData

java.util.Map<java.lang.Object,java.lang.Object> getData()
Gets the custom data associated with this dependency node. Clients of the repository system can use this data to annotate dependency nodes with domain-specific information.

Returns:
The (read-only) key-value mappings, never null.

setData

void setData(java.lang.Object key,
             java.lang.Object value)
Associates the specified dependency node data with the given key. Note: This method must not be called while getData() is being iterated.

Parameters:
key - The key under which to store the data, must not be null.
value - The data to associate with the key, may be null to remove the mapping.

accept

boolean accept(DependencyVisitor visitor)
Traverses this node and potentially its children using the specified visitor.

Parameters:
visitor - The visitor to call back, must not be null.
Returns:
true to visit siblings nodes of this node as well, false to skip siblings.


Copyright © 2010-2011 Sonatype, Inc.. All Rights Reserved.