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