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 = Collections.synchronizedMap(new IdentityHashMap<>());
41
42 private boolean canResume = false;
43
44 public MavenExecutionResult setProject(MavenProject project) {
45 this.project = project;
46
47 return this;
48 }
49
50 public MavenProject getProject() {
51 return project;
52 }
53
54 public MavenExecutionResult setTopologicallySortedProjects(List<MavenProject> topologicallySortedProjects) {
55 this.topologicallySortedProjects = topologicallySortedProjects;
56
57 return this;
58 }
59
60 public List<MavenProject> getTopologicallySortedProjects() {
61 return null == topologicallySortedProjects
62 ? Collections.emptyList()
63 : Collections.unmodifiableList(topologicallySortedProjects);
64 }
65
66 public DependencyResolutionResult getDependencyResolutionResult() {
67 return dependencyResolutionResult;
68 }
69
70 public MavenExecutionResult setDependencyResolutionResult(DependencyResolutionResult dependencyResolutionResult) {
71 this.dependencyResolutionResult = dependencyResolutionResult;
72
73 return this;
74 }
75
76 public List<Throwable> getExceptions() {
77 return exceptions;
78 }
79
80 public MavenExecutionResult addException(Throwable t) {
81 exceptions.add(t);
82
83 return this;
84 }
85
86 public boolean hasExceptions() {
87 return !getExceptions().isEmpty();
88 }
89
90 public BuildSummary getBuildSummary(MavenProject project) {
91 return buildSummaries.get(project);
92 }
93
94 public void addBuildSummary(BuildSummary summary) {
95 buildSummaries.put(summary.getProject(), summary);
96 }
97
98 @Override
99 public boolean canResume() {
100 return canResume;
101 }
102
103 @Override
104 public void setCanResume(boolean canResume) {
105 this.canResume = canResume;
106 }
107 }