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.ArrayList;
23 import java.util.Collections;
24 import java.util.IdentityHashMap;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.concurrent.CopyOnWriteArrayList;
28
29 import org.apache.maven.project.DependencyResolutionResult;
30 import org.apache.maven.project.MavenProject;
31
32
33 public class DefaultMavenExecutionResult
34 implements MavenExecutionResult
35 {
36 private MavenProject project;
37
38 private List<MavenProject> topologicallySortedProjects = Collections.emptyList();
39
40 private DependencyResolutionResult dependencyResolutionResult;
41
42 private List<Throwable> exceptions = new CopyOnWriteArrayList<Throwable>( );
43
44 private Map<MavenProject, BuildSummary> buildSummaries;
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 ? Collections.<MavenProject> emptyList() : topologicallySortedProjects;
68 }
69
70 public DependencyResolutionResult getDependencyResolutionResult()
71 {
72 return dependencyResolutionResult;
73 }
74
75 public MavenExecutionResult setDependencyResolutionResult( DependencyResolutionResult dependencyResolutionResult )
76 {
77 this.dependencyResolutionResult = dependencyResolutionResult;
78
79 return this;
80 }
81
82 public List<Throwable> getExceptions()
83 {
84 return exceptions == null ? Collections.<Throwable> emptyList() : exceptions;
85 }
86
87 public MavenExecutionResult addException( Throwable t )
88 {
89 exceptions.add( t );
90
91 return this;
92 }
93
94 public boolean hasExceptions()
95 {
96 return !getExceptions().isEmpty();
97 }
98
99 public BuildSummary getBuildSummary( MavenProject project )
100 {
101 return ( buildSummaries != null ) ? buildSummaries.get( project ) : null;
102 }
103
104 public void addBuildSummary( BuildSummary summary )
105 {
106 if ( buildSummaries == null )
107 {
108 buildSummaries = new IdentityHashMap<MavenProject, BuildSummary>();
109 }
110 buildSummaries.put( summary.getProject(), summary );
111 }
112
113 }