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 org.apache.maven.artifact.repository.ArtifactRepository;
23 import org.apache.maven.monitor.event.EventDispatcher;
24 import org.apache.maven.plugin.descriptor.PluginDescriptor;
25 import org.apache.maven.project.MavenProject;
26 import org.apache.maven.settings.Settings;
27 import org.codehaus.plexus.PlexusContainer;
28 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
29
30 import java.util.Date;
31 import java.util.List;
32 import java.util.Map;
33 import java.util.Properties;
34
35
36
37
38
39 public class MavenSession
40 {
41 private PlexusContainer container;
42
43 private ArtifactRepository localRepository;
44
45 private List goals;
46
47 private EventDispatcher eventDispatcher;
48
49
50 private final Settings settings;
51
52 private ReactorManager reactorManager;
53
54 private final String executionRootDir;
55
56 private boolean usingPOMsFromFilesystem = true;
57
58 private final Properties executionProperties;
59
60 private final Date startTime;
61
62 private MavenProject currentProject;
63
64 public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
65 EventDispatcher eventDispatcher, ReactorManager reactorManager, List goals,
66 String executionRootDir, Properties executionProperties, Date startTime )
67 {
68 this.container = container;
69
70 this.settings = settings;
71
72 this.localRepository = localRepository;
73
74 this.eventDispatcher = eventDispatcher;
75
76 this.reactorManager = reactorManager;
77
78 this.goals = goals;
79
80 this.executionRootDir = executionRootDir;
81
82 this.executionProperties = executionProperties;
83
84 this.startTime = startTime;
85 }
86
87 public Map getPluginContext( PluginDescriptor pluginDescriptor, MavenProject project )
88 {
89 return reactorManager.getPluginContext( pluginDescriptor, project );
90 }
91
92 public PlexusContainer getContainer()
93 {
94 return container;
95 }
96
97 public ArtifactRepository getLocalRepository()
98 {
99 return localRepository;
100 }
101
102 public List getGoals()
103 {
104 return goals;
105 }
106
107 public Properties getExecutionProperties()
108 {
109 return executionProperties;
110 }
111
112
113
114
115
116 public Object lookup( String role )
117 throws ComponentLookupException
118 {
119 return container.lookup( role );
120 }
121
122 public Object lookup( String role, String roleHint )
123 throws ComponentLookupException
124 {
125 return container.lookup( role, roleHint );
126 }
127
128 public List lookupList( String role )
129 throws ComponentLookupException
130 {
131 return container.lookupList( role );
132 }
133
134 public Map lookupMap( String role )
135 throws ComponentLookupException
136 {
137 return container.lookupMap( role );
138 }
139
140 public EventDispatcher getEventDispatcher()
141 {
142 return eventDispatcher;
143 }
144
145 public Settings getSettings()
146 {
147 return settings;
148 }
149
150 public List getSortedProjects()
151 {
152 return reactorManager.getSortedProjects();
153 }
154
155 public String getExecutionRootDirectory()
156 {
157 return executionRootDir;
158 }
159
160 public void setUsingPOMsFromFilesystem( boolean usingPOMsFromFilesystem )
161 {
162 this.usingPOMsFromFilesystem = usingPOMsFromFilesystem;
163 }
164
165 public boolean isUsingPOMsFromFilesystem()
166 {
167 return usingPOMsFromFilesystem;
168 }
169
170 public Date getStartTime()
171 {
172 return startTime;
173 }
174
175 public void setCurrentProject( MavenProject currentProject )
176 {
177 this.currentProject = currentProject;
178 }
179
180
181
182
183 public MavenProject getCurrentProject()
184 {
185 return currentProject;
186 }
187
188 }