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 public class DefaultMavenExecutionResult implements MavenExecutionResult {
31 private MavenProject project;
32
33 private List<MavenProject> topologicallySortedProjects = Collections.emptyList();
34
35 private DependencyResolutionResult dependencyResolutionResult;
36
37 private final List<Throwable> exceptions = new CopyOnWriteArrayList<>();
38
39 private final Map<MavenProject, BuildSummary> buildSummaries = Collections.synchronizedMap(new IdentityHashMap<>());
40
41 private boolean canResume = false;
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.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
97 @Override
98 public boolean canResume() {
99 return canResume;
100 }
101
102 @Override
103 public void setCanResume(boolean canResume) {
104 this.canResume = canResume;
105 }
106 }