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