1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.execution;
20
21 import java.util.Collections;
22 import java.util.IdentityHashMap;
23 import java.util.List;
24 import java.util.Map;
25 import java.util.concurrent.CopyOnWriteArrayList;
26
27 import org.apache.maven.project.DependencyResolutionResult;
28 import org.apache.maven.project.MavenProject;
29
30
31 public class DefaultMavenExecutionResult implements MavenExecutionResult {
32 private MavenProject project;
33
34 private List<MavenProject> topologicallySortedProjects = Collections.emptyList();
35
36 private DependencyResolutionResult dependencyResolutionResult;
37
38 private final List<Throwable> exceptions = new CopyOnWriteArrayList<>();
39
40 private final Map<MavenProject, BuildSummary> buildSummaries =
41 Collections.synchronizedMap(new IdentityHashMap<MavenProject, BuildSummary>());
42
43 public MavenExecutionResult setProject(MavenProject project) {
44 this.project = project;
45
46 return this;
47 }
48
49 public MavenProject getProject() {
50 return project;
51 }
52
53 public MavenExecutionResult setTopologicallySortedProjects(List<MavenProject> topologicallySortedProjects) {
54 this.topologicallySortedProjects = topologicallySortedProjects;
55
56 return this;
57 }
58
59 public List<MavenProject> getTopologicallySortedProjects() {
60 return null == topologicallySortedProjects
61 ? Collections.<MavenProject>emptyList()
62 : Collections.unmodifiableList(topologicallySortedProjects);
63 }
64
65 public DependencyResolutionResult getDependencyResolutionResult() {
66 return dependencyResolutionResult;
67 }
68
69 public MavenExecutionResult setDependencyResolutionResult(DependencyResolutionResult dependencyResolutionResult) {
70 this.dependencyResolutionResult = dependencyResolutionResult;
71
72 return this;
73 }
74
75 public List<Throwable> getExceptions() {
76 return exceptions;
77 }
78
79 public MavenExecutionResult addException(Throwable t) {
80 exceptions.add(t);
81
82 return this;
83 }
84
85 public boolean hasExceptions() {
86 return !getExceptions().isEmpty();
87 }
88
89 public BuildSummary getBuildSummary(MavenProject project) {
90 return buildSummaries.get(project);
91 }
92
93 public void addBuildSummary(BuildSummary summary) {
94 buildSummaries.put(summary.getProject(), summary);
95 }
96 }