View Javadoc

1   package org.apache.maven.plugin.war.packaging;
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 java.io.File;
23  import java.util.List;
24  
25  import org.apache.maven.archiver.MavenArchiveConfiguration;
26  import org.apache.maven.artifact.factory.ArtifactFactory;
27  import org.apache.maven.execution.MavenSession;
28  import org.apache.maven.plugin.logging.Log;
29  import org.apache.maven.plugin.war.util.WebappStructure;
30  import org.apache.maven.project.MavenProject;
31  import org.apache.maven.shared.filtering.MavenFileFilter;
32  import org.codehaus.plexus.archiver.jar.JarArchiver;
33  import org.codehaus.plexus.archiver.manager.ArchiverManager;
34  import org.codehaus.plexus.util.FileUtils.FilterWrapper;
35  
36  /**
37   * The packaging context.
38   *
39   * @author Stephane Nicoll
40   * @version $Id: WarPackagingContext.html 868453 2013-07-05 11:25:41Z olamy $
41   */
42  public interface WarPackagingContext
43  {
44      /**
45       * Returns the maven project.
46       *
47       * @return the project
48       */
49      MavenProject getProject();
50  
51      /**
52       * Returns the webapp directory. Packaging tasks should use this
53       * directory to generate the webapp.
54       *
55       * @return the webapp directory
56       */
57      File getWebappDirectory();
58  
59      /**
60       * Returns the main webapp source directory.
61       *
62       * @return the webapp source directory
63       */
64      File getWebappSourceDirectory();
65  
66      /**
67       * Returns the webapp source includes.
68       *
69       * @return the webapp source includes
70       */
71      String[] getWebappSourceIncludes();
72  
73      /**
74       * Returns {@code true} if empty directories should be includes, othewrwise {@code false}
75       *
76       * @return {@code true} if empty directories should be includes, othewrwise {@code false}
77       */
78      boolean isWebappSourceIncludeEmptyDirectories();
79  
80      /**
81       * Returns the webapp source excludes.
82       *
83       * @return the webapp source excludes
84       */
85      String[] getWebappSourceExcludes();
86  
87      /**
88       * Returns the directory holding generated classes.
89       *
90       * @return the classes directory
91       */
92      File getClassesDirectory();
93  
94      /**
95       * Specify whether the classes resources should be archived in
96       * the <tt>WEB-INF/lib</tt> of the generated web app.
97       *
98       * @return true if the classes should be archived, false otherwise
99       */
100     boolean archiveClasses();
101 
102     /**
103      * Returns the logger to use to output logging event.
104      *
105      * @return the logger
106      */
107     Log getLog();
108 
109     /**
110      * Returns the directory to unpack dependent WARs into if needed.
111      *
112      * @return the overlays work directory
113      */
114     File getOverlaysWorkDirectory();
115 
116     /**
117      * Returns the archiver manager to use.
118      *
119      * @return the archiver manager
120      */
121     ArchiverManager getArchiverManager();
122 
123     /**
124      * The maven archive configuration to use.
125      *
126      * @return the maven archive configuration
127      */
128     MavenArchiveConfiguration getArchive();
129 
130     /**
131      * Returns the Jar archiver needed for archiving classes directory into
132      * jar file under WEB-INF/lib.
133      *
134      * @return the jar archiver to user
135      */
136     JarArchiver getJarArchiver();
137 
138     /**
139      * Returns the output file name mapping to use, if any. Returns <tt>null</tt>
140      * if no file name mapping is set.
141      *
142      * @return the output file name mapping or <tt>null</tt>
143      */
144     String getOutputFileNameMapping();
145 
146     /**
147      * Returns the list of filter files to use.
148      *
149      * @return a list of filter files
150      */
151     List<String> getFilters();
152 
153     /**
154      * Returns the {@link WebappStructure}.
155      *
156      * @return the webapp structure
157      */
158     WebappStructure getWebappStructure();
159 
160     /**
161      * Returns the list of registered overlays for this session. This list might
162      * differ from the one returned by the cache; in this case, it means that the
163      * project's configuration has changed. The plugin will handle those cases nicely
164      * but it would be better in general to invoke the clean goal.
165      *
166      * @return the list of registered overlays, including the current project
167      */
168     List<String> getOwnerIds();
169     
170     /**
171      * Returns the {@link MavenFileFilter} instance to use.
172      *
173      * @return the maven file filter to use
174      * @since 2.1-alpha-2
175      */
176     MavenFileFilter getMavenFileFilter();
177     
178     /**
179      * @return {@link List} of {@link FilterWrapper}
180      * @since 2.1-alpha-2
181      */
182     List<FilterWrapper> getFilterWrappers();
183     
184     /**
185      * Specify if the given <tt>fileName</tt> belongs to the list of extensions
186      * that must not be filtered
187      *
188      * @param fileName the name of file
189      * @return <tt>true</tt> if it should not be filtered, <tt>false</tt> otherwise
190      * @since 2.1-alpha-2
191      */
192     boolean isNonFilteredExtension( String fileName );
193     
194     boolean isFilteringDeploymentDescriptors();
195     
196     ArtifactFactory getArtifactFactory();
197 
198     /**
199      * Returns the Maven session.
200      *
201      * @return the Maven session
202      * @since 2.2
203      */
204     MavenSession getSession();
205 
206     /**
207      * Returns the encoding to use for resources.
208      *
209      * @return the resource encoding
210      * @since 2.3
211      */
212     String getResourceEncoding();
213 
214     /**
215      *
216      * @return to use jvmChmod rather than forking chmod cli
217      * @since 2.4
218      */
219     boolean isUseJvmChmod();
220 }