View Javadoc

1   package org.apache.maven.execution;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.artifact.repository.ArtifactRepository;
23  import org.apache.maven.monitor.event.EventDispatcher;
24  import org.apache.maven.monitor.event.EventMonitor;
25  import org.apache.maven.profiles.ProfileManager;
26  import org.apache.maven.settings.Settings;
27  
28  import java.util.Date;
29  import java.util.List;
30  import java.util.Properties;
31  
32  /**
33   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
34   * @version $Id: DefaultMavenExecutionRequest.java 688884 2008-08-25 21:11:19Z jdcasey $
35   */
36  public class DefaultMavenExecutionRequest
37      implements MavenExecutionRequest
38  {
39      /**
40       * @todo [BP] is this required? This hands off to MavenSession, but could be passed through the handler.handle function (+ createSession).
41       */
42      private final ArtifactRepository localRepository;
43  
44      private final List goals;
45  
46      protected MavenSession session;
47  
48      private final EventDispatcher eventDispatcher;
49  
50      private final Settings settings;
51  
52      private final String baseDirectory;
53  
54      private boolean recursive = true;
55  
56      private boolean reactorActive;
57  
58      private String pomFilename;
59  
60      private String failureBehavior;
61  
62      private final ProfileManager globalProfileManager;
63  
64      private final Properties executionProperties;
65  
66      private final Properties userProperties;
67  
68      private final Date startTime;
69  
70      private final boolean showErrors;
71  
72      public DefaultMavenExecutionRequest( ArtifactRepository localRepository, Settings settings,
73                                           EventDispatcher eventDispatcher, List goals, String baseDirectory,
74                                           ProfileManager globalProfileManager, Properties executionProperties,
75                                           Properties userProperties,
76                                           boolean showErrors )
77      {
78          this.localRepository = localRepository;
79  
80          this.settings = settings;
81  
82          this.goals = goals;
83  
84          this.eventDispatcher = eventDispatcher;
85  
86          this.baseDirectory = baseDirectory;
87  
88          this.globalProfileManager = globalProfileManager;
89  
90          this.executionProperties = executionProperties;
91  
92          this.userProperties = userProperties;
93  
94          startTime = new Date();
95  
96          this.showErrors = showErrors;
97      }
98  
99      public Settings getSettings()
100     {
101         return settings;
102     }
103 
104     public String getBaseDirectory()
105     {
106         return baseDirectory;
107     }
108 
109     public boolean isRecursive()
110     {
111         return recursive;
112     }
113 
114     public void setRecursive( boolean recursive )
115     {
116         this.recursive = false;
117     }
118 
119     public ArtifactRepository getLocalRepository()
120     {
121         return localRepository;
122     }
123 
124     public List getGoals()
125     {
126         return goals;
127     }
128 
129     public Properties getExecutionProperties()
130     {
131         return executionProperties;
132     }
133 
134     // ----------------------------------------------------------------------
135     // Putting the session here but it can probably be folded right in here.
136     // ----------------------------------------------------------------------
137 
138     public MavenSession getSession()
139     {
140         return session;
141     }
142 
143     public void setSession( MavenSession session )
144     {
145         this.session = session;
146     }
147 
148     public void addEventMonitor( EventMonitor monitor )
149     {
150         eventDispatcher.addEventMonitor( monitor );
151     }
152 
153     public EventDispatcher getEventDispatcher()
154     {
155         return eventDispatcher;
156     }
157 
158     public void setReactorActive( boolean reactorActive )
159     {
160         this.reactorActive = reactorActive;
161     }
162 
163     public boolean isReactorActive()
164     {
165         return reactorActive;
166     }
167 
168     public void setPomFile( String pomFilename )
169     {
170         this.pomFilename = pomFilename;
171     }
172 
173     public String getPomFile()
174     {
175         return pomFilename;
176     }
177 
178     public void setFailureBehavior( String failureBehavior )
179     {
180         this.failureBehavior = failureBehavior;
181     }
182 
183     public String getFailureBehavior()
184     {
185         return failureBehavior;
186     }
187 
188     public ProfileManager getGlobalProfileManager()
189     {
190         return globalProfileManager;
191     }
192 
193     public Date getStartTime()
194     {
195         return startTime;
196     }
197 
198     public boolean isShowErrors()
199     {
200         return showErrors;
201     }
202 
203     public Properties getUserProperties()
204     {
205         return userProperties;
206     }
207 }