org.sonatype.aether.collection
Class CollectRequest

java.lang.Object
  extended by org.sonatype.aether.collection.CollectRequest

public class CollectRequest
extends java.lang.Object

A request to collect the transitive dependencies and to build a dependency graph from them. There are three ways to create a dependency graph. First, only the root dependency can be given. Second, a root dependency and direct dependencies can be specified in which case the specified direct dependencies are merged with the direct dependencies retrieved from the artifact descriptor of the root dependency. And last, only direct dependencies can be specified in which case the root node of the resulting graph has no associated dependency.

Author:
Benjamin Bentmann
See Also:
RepositorySystem.collectDependencies(RepositorySystemSession, CollectRequest)

Constructor Summary
CollectRequest()
          Creates an unitialized request.
CollectRequest(Dependency root, java.util.List<Dependency> dependencies, java.util.List<RemoteRepository> repositories)
          Creates a new request with the specified properties.
CollectRequest(Dependency root, java.util.List<RemoteRepository> repositories)
          Creates a request with the specified properties.
CollectRequest(java.util.List<Dependency> dependencies, java.util.List<Dependency> managedDependencies, java.util.List<RemoteRepository> repositories)
          Creates a new request with the specified properties.
 
Method Summary
 CollectRequest addDependency(Dependency dependency)
          Adds the specified direct dependency.
 CollectRequest addManagedDependency(Dependency managedDependency)
          Adds the specified managed dependency.
 CollectRequest addRepository(RemoteRepository repository)
          Adds the specified repository for collection.
 java.util.List<Dependency> getDependencies()
          Gets the direct dependencies.
 java.util.List<Dependency> getManagedDependencies()
          Gets the dependency management to apply to transitive dependencies.
 java.util.List<RemoteRepository> getRepositories()
          Gets the repositories to use for the collection.
 java.lang.String getRequestContext()
          Gets the context in which this request is made.
 Dependency getRoot()
          Gets the root dependency of the graph.
 CollectRequest setDependencies(java.util.List<Dependency> dependencies)
          Sets the direct dependencies.
 CollectRequest setManagedDependencies(java.util.List<Dependency> managedDependencies)
          Sets the dependency management to apply to transitive dependencies.
 CollectRequest setRepositories(java.util.List<RemoteRepository> repositories)
          Sets the repositories to use for the collection.
 CollectRequest setRequestContext(java.lang.String context)
          Sets the context in which this request is made.
 CollectRequest setRoot(Dependency root)
          Sets the root dependency of the graph.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectRequest

public CollectRequest()
Creates an unitialized request.


CollectRequest

public CollectRequest(Dependency root,
                      java.util.List<RemoteRepository> repositories)
Creates a request with the specified properties.

Parameters:
root - The root dependency whose transitive dependencies should be collected, may be null.
repositories - The repositories to use for the collection, may be null.

CollectRequest

public CollectRequest(Dependency root,
                      java.util.List<Dependency> dependencies,
                      java.util.List<RemoteRepository> repositories)
Creates a new request with the specified properties.

Parameters:
root - The root dependency whose transitive dependencies should be collected, may be null.
dependencies - The direct dependencies to merge with the direct dependencies from the root dependency's artifact descriptor.
repositories - The repositories to use for the collection, may be null.

CollectRequest

public CollectRequest(java.util.List<Dependency> dependencies,
                      java.util.List<Dependency> managedDependencies,
                      java.util.List<RemoteRepository> repositories)
Creates a new request with the specified properties.

Parameters:
dependencies - The direct dependencies of some imaginary root, may be null.
managedDependencies - The dependency management information to apply to the transitive dependencies, may be null.
repositories - The repositories to use for the collection, may be null.
Method Detail

getRoot

public Dependency getRoot()
Gets the root dependency of the graph.

Returns:
The root dependency of the graph or null if none.

setRoot

public CollectRequest setRoot(Dependency root)
Sets the root dependency of the graph.

Parameters:
root - The root dependency of the graph, may be null.
Returns:
This request for chaining, never null.

getDependencies

public java.util.List<Dependency> getDependencies()
Gets the direct dependencies.

Returns:
The direct dependencies, never null.

setDependencies

public CollectRequest setDependencies(java.util.List<Dependency> dependencies)
Sets the direct dependencies. If both a root dependency and direct dependencies are given in the request, the direct dependencies from the request will be merged with the direct dependencies from the root dependency's artifact descriptor, giving higher priority to the dependencies from the request.

Parameters:
dependencies - The direct dependencies, may be null.
Returns:
This request for chaining, never null.

addDependency

public CollectRequest addDependency(Dependency dependency)
Adds the specified direct dependency.

Parameters:
dependency - The dependency to add, may be null.
Returns:
This request for chaining, never null.

getManagedDependencies

public java.util.List<Dependency> getManagedDependencies()
Gets the dependency management to apply to transitive dependencies.

Returns:
The dependency management to apply to transitive dependencies, never null.

setManagedDependencies

public CollectRequest setManagedDependencies(java.util.List<Dependency> managedDependencies)
Sets the dependency management to apply to transitive dependencies. To clarify, this management does not apply to the direct dependencies of the root node.

Parameters:
managedDependencies - The dependency management, may be null.
Returns:
This request for chaining, never null.

addManagedDependency

public CollectRequest addManagedDependency(Dependency managedDependency)
Adds the specified managed dependency.

Parameters:
managedDependency - The managed dependency to add, may be null.
Returns:
This request for chaining, never null.

getRepositories

public java.util.List<RemoteRepository> getRepositories()
Gets the repositories to use for the collection.

Returns:
The repositories to use for the collection, never null.

setRepositories

public CollectRequest setRepositories(java.util.List<RemoteRepository> repositories)
Sets the repositories to use for the collection.

Parameters:
repositories - The repositories to use for the collection, may be null.
Returns:
This request for chaining, never null.

addRepository

public CollectRequest addRepository(RemoteRepository repository)
Adds the specified repository for collection.

Parameters:
repository - The repository to collect dependency information from, may be null.
Returns:
This request for chaining, never null.

getRequestContext

public java.lang.String getRequestContext()
Gets the context in which this request is made.

Returns:
The context, never null.

setRequestContext

public CollectRequest setRequestContext(java.lang.String context)
Sets the context in which this request is made.

Parameters:
context - The context, may be null.
Returns:
This request for chaining, never null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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