]>
git.argeo.org Git - gpl/argeo-slc.git/blob - cms/org.argeo.slc.repo/src/org/eclipse/aether/collection/CollectResult.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2013 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.collection
;
13 import java
.util
.ArrayList
;
14 import java
.util
.Collections
;
15 import java
.util
.List
;
17 import org
.eclipse
.aether
.RepositorySystem
;
18 import org
.eclipse
.aether
.RepositorySystemSession
;
19 import org
.eclipse
.aether
.graph
.DependencyCycle
;
20 import org
.eclipse
.aether
.graph
.DependencyNode
;
23 * The result of a dependency collection request.
25 * @see RepositorySystem#collectDependencies(RepositorySystemSession, CollectRequest)
27 public final class CollectResult
30 private final CollectRequest request
;
32 private List
<Exception
> exceptions
;
34 private List
<DependencyCycle
> cycles
;
36 private DependencyNode root
;
39 * Creates a new result for the specified request.
41 * @param request The resolution request, must not be {@code null}.
43 public CollectResult( CollectRequest request
)
45 if ( request
== null )
47 throw new IllegalArgumentException( "dependency collection request has not been specified" );
49 this.request
= request
;
50 exceptions
= Collections
.emptyList();
51 cycles
= Collections
.emptyList();
55 * Gets the collection request that was made.
57 * @return The collection request, never {@code null}.
59 public CollectRequest
getRequest()
65 * Gets the exceptions that occurred while building the dependency graph.
67 * @return The exceptions that occurred, never {@code null}.
69 public List
<Exception
> getExceptions()
75 * Records the specified exception while building the dependency graph.
77 * @param exception The exception to record, may be {@code null}.
78 * @return This result for chaining, never {@code null}.
80 public CollectResult
addException( Exception exception
)
82 if ( exception
!= null )
84 if ( exceptions
.isEmpty() )
86 exceptions
= new ArrayList
<Exception
>();
88 exceptions
.add( exception
);
94 * Gets the dependency cycles that were encountered while building the dependency graph.
96 * @return The dependency cycles in the (raw) graph, never {@code null}.
98 public List
<DependencyCycle
> getCycles()
104 * Records the specified dependency cycle.
106 * @param cycle The dependency cycle to record, may be {@code null}.
107 * @return This result for chaining, never {@code null}.
109 public CollectResult
addCycle( DependencyCycle cycle
)
113 if ( cycles
.isEmpty() )
115 cycles
= new ArrayList
<DependencyCycle
>();
123 * Gets the root node of the dependency graph.
125 * @return The root node of the dependency graph or {@code null} if none.
127 public DependencyNode
getRoot()
133 * Sets the root node of the dependency graph.
135 * @param root The root node of the dependency graph, may be {@code null}.
136 * @return This result for chaining, never {@code null}.
138 public CollectResult
setRoot( DependencyNode root
)
145 public String
toString()
147 return String
.valueOf( getRoot() );