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
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;
38
39 private DependencyResolutionResult dependencyResolutionResult;
40
41 private List<Throwable> exceptions;
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 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 if ( exceptions == null )
89 {
90 exceptions = new ArrayList<Throwable>();
91 }
92
93 exceptions.add( t );
94
95 return this;
96 }
97
98 public boolean hasExceptions()
99 {
100 return !getExceptions().isEmpty();
101 }
102
103 public BuildSummary getBuildSummary( MavenProject project )
104 {
105 return ( buildSummaries != null ) ? buildSummaries.get( project ) : null;
106 }
107
108 public void addBuildSummary( BuildSummary summary )
109 {
110 if ( buildSummaries == null )
111 {
112 buildSummaries = new IdentityHashMap<MavenProject, BuildSummary>();
113 }
114 buildSummaries.put( summary.getProject(), summary );
115 }
116
117 }