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