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