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.java 1388368 2012-09-21 08:23:24Z dennisl $
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 the webapp source excludes.
75 *
76 * @return the webapp source excludes
77 */
78 String[] getWebappSourceExcludes();
79
80 /**
81 * Returns the directory holding generated classes.
82 *
83 * @return the classes directory
84 */
85 File getClassesDirectory();
86
87 /**
88 * Specify whether the classes resources should be archived in
89 * the <tt>WEB-INF/lib</tt> of the generated web app.
90 *
91 * @return true if the classes should be archived, false otherwise
92 */
93 boolean archiveClasses();
94
95 /**
96 * Returns the logger to use to output logging event.
97 *
98 * @return the logger
99 */
100 Log getLog();
101
102 /**
103 * Returns the directory to unpack dependent WARs into if needed.
104 *
105 * @return the overlays work directory
106 */
107 File getOverlaysWorkDirectory();
108
109 /**
110 * Returns the archiver manager to use.
111 *
112 * @return the archiver manager
113 */
114 ArchiverManager getArchiverManager();
115
116 /**
117 * The maven archive configuration to use.
118 *
119 * @return the maven archive configuration
120 */
121 MavenArchiveConfiguration getArchive();
122
123 /**
124 * Returns the Jar archiver needed for archiving classes directory into
125 * jar file under WEB-INF/lib.
126 *
127 * @return the jar archiver to user
128 */
129 JarArchiver getJarArchiver();
130
131 /**
132 * Returns the output file name mapping to use, if any. Returns <tt>null</tt>
133 * if no file name mapping is set.
134 *
135 * @return the output file name mapping or <tt>null</tt>
136 */
137 String getOutputFileNameMapping();
138
139 /**
140 * Returns the list of filter files to use.
141 *
142 * @return a list of filter files
143 */
144 List getFilters();
145
146 /**
147 * Returns the {@link WebappStructure}.
148 *
149 * @return the webapp structure
150 */
151 WebappStructure getWebappStructure();
152
153 /**
154 * Returns the list of registered overlays for this session. This list might
155 * differ from the one returned by the cache; in this case, it means that the
156 * project's configuration has changed. The plugin will handle thos cases nicely
157 * but it would be better in general to invoke the clean goal.
158 *
159 * @return the list of registered overlays, including the current project
160 */
161 List getOwnerIds();
162
163 /**
164 * Returns the {@link MavenFileFilter} instance to use.
165 *
166 * @return the maven file filter to use
167 * @since 2.1-alpha-2
168 */
169 MavenFileFilter getMavenFileFilter();
170
171 /**
172 * @return {@link List} of {@link FilterWrapper}
173 * @since 2.1-alpha-2
174 */
175 List getFilterWrappers();
176
177 /**
178 * Specify if the given <tt>fileName</tt> belongs to the list of extensions
179 * that must not be filtered
180 *
181 * @param fileName the name of file
182 * @return <tt>true</tt> if it should not be filtered, <tt>false</tt> otherwise
183 * @since 2.1-alpha-2
184 */
185 boolean isNonFilteredExtension( String fileName );
186
187 boolean isFilteringDeploymentDescriptors();
188
189 ArtifactFactory getArtifactFactory();
190
191 /**
192 * Returns the Maven session.
193 *
194 * @return the Maven session
195 * @since 2.2
196 */
197 MavenSession getSession();
198
199 /**
200 * Returns the encoding to use for resources.
201 *
202 * @return the resource encoding
203 * @since 2.3
204 */
205 String getResourceEncoding();
206 }