1 package org.apache.maven.project;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.IdentityHashMap;
25 import java.util.List;
26 import java.util.Map;
27
28 import org.eclipse.aether.graph.Dependency;
29 import org.eclipse.aether.graph.DependencyNode;
30
31
32
33
34 class DefaultDependencyResolutionResult
35 implements DependencyResolutionResult
36 {
37
38 private DependencyNode root;
39
40 private List<Dependency> dependencies = new ArrayList<>();
41
42 private List<Dependency> resolvedDependencies = new ArrayList<>();
43
44 private List<Dependency> unresolvedDependencies = new ArrayList<>();
45
46 private List<Exception> collectionErrors = new ArrayList<>();
47
48 private Map<Dependency, List<Exception>> resolutionErrors = new IdentityHashMap<>();
49
50 public DependencyNode getDependencyGraph()
51 {
52 return root;
53 }
54
55 public void setDependencyGraph( DependencyNode root )
56 {
57 this.root = root;
58 }
59
60 public List<Dependency> getDependencies()
61 {
62 return dependencies;
63 }
64
65 public List<Dependency> getResolvedDependencies()
66 {
67 return resolvedDependencies;
68 }
69
70 public void addResolvedDependency( Dependency dependency )
71 {
72 dependencies.add( dependency );
73 resolvedDependencies.add( dependency );
74 }
75
76 public List<Dependency> getUnresolvedDependencies()
77 {
78 return unresolvedDependencies;
79 }
80
81 public List<Exception> getCollectionErrors()
82 {
83 return collectionErrors;
84 }
85
86 public void setCollectionErrors( List<Exception> exceptions )
87 {
88 if ( exceptions != null )
89 {
90 this.collectionErrors = exceptions;
91 }
92 else
93 {
94 this.collectionErrors = new ArrayList<>();
95 }
96 }
97
98 public List<Exception> getResolutionErrors( Dependency dependency )
99 {
100 List<Exception> errors = resolutionErrors.get( dependency );
101 return ( errors != null )
102 ? Collections.unmodifiableList( errors )
103 : Collections.<Exception>emptyList();
104
105 }
106
107 public void setResolutionErrors( Dependency dependency, List<Exception> errors )
108 {
109 dependencies.add( dependency );
110 unresolvedDependencies.add( dependency );
111 resolutionErrors.put( dependency, errors );
112 }
113
114 }