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<Dependency>();
41
42 private List<Dependency> resolvedDependencies = new ArrayList<Dependency>();
43
44 private List<Dependency> unresolvedDependencies = new ArrayList<Dependency>();
45
46 private List<Exception> collectionErrors = new ArrayList<Exception>();
47
48 private Map<Dependency, List<Exception>> resolutionErrors = new IdentityHashMap<Dependency, List<Exception>>();
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<Exception>();
95 }
96 }
97
98 public List<Exception> getResolutionErrors( Dependency dependency )
99 {
100 List<Exception> errors = resolutionErrors.get( dependency );
101 return ( errors != null ) ? errors : Collections.<Exception> emptyList();
102 }
103
104 public void setResolutionErrors( Dependency dependency, List<Exception> errors )
105 {
106 dependencies.add( dependency );
107 unresolvedDependencies.add( dependency );
108 resolutionErrors.put( dependency, errors );
109 }
110
111 }