1 package org.apache.maven.shared.filtering;
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.execution.MavenSession;
23 import org.apache.maven.project.MavenProject;
24
25 import java.io.File;
26 import java.util.List;
27
28 /**
29 * @author <a href="mailto:olamy@apache.org">olamy</a>
30 * @version $Id: MavenFileFilter.java 1055687 2011-01-05 23:36:05Z dennisl $
31 */
32 public interface MavenFileFilter
33 {
34
35 /**
36 * Will copy a file with some filtering using defaultFilterWrappers.
37 *
38 * @see #getDefaultFilterWrappers(MavenProject, List, boolean, MavenSession)
39 * @param from file to copy/filter
40 * @param to destination file
41 * @param filtering enable or not filering
42 * @param mavenProject the mavenproject
43 * @param filters {@link List} of String which are path to a Property file
44 * @throws MavenFilteringException
45 */
46 void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List filters,
47 boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession )
48 throws MavenFilteringException;
49
50 /**
51 * @param mavenFileFilterRequest
52 * @throws MavenFilteringException
53 * @since 1.0-beta-3
54 */
55 void copyFile( MavenFileFilterRequest mavenFileFilterRequest )
56 throws MavenFilteringException;
57
58 /**
59 * @param from
60 * @param to
61 * @param filtering
62 * @param filterWrappers {@link List} of FileUtils.FilterWrapper
63 * @throws MavenFilteringException
64 */
65 void copyFile( File from, final File to, boolean filtering, List filterWrappers, String encoding )
66 throws MavenFilteringException;
67
68
69 /**
70 * @param from
71 * @param to
72 * @param filtering
73 * @param filterWrappers
74 * @param encoding
75 * @param overwrite
76 * @throws MavenFilteringException
77 * @since 1.0-beta-2
78 */
79 void copyFile( File from, final File to, boolean filtering, List filterWrappers, String encoding,
80 boolean overwrite )
81 throws MavenFilteringException;
82
83 /**
84 * Will return the default FileUtils.FilterWrappers.
85 *
86 * <ul>
87 * <li>interpolate with token ${} and values from sysProps, project.properties, filters and project filters.</li>
88 * <li>interpolate with token @ @ and values from sysProps, project.properties, filters and project filters.</li>
89 * <li>interpolate with token ${} and values from mavenProject interpolation.</li>
90 * <li>interpolation with token @ @ and values from mavenProject interpolation</li>
91 * </ul>
92 * <b>This method is now deprecated and no escape mechanism will be used.</b>
93 *
94 * @param mavenProject
95 * @param filters {@link List} of properties file
96 * @return {@link List} of FileUtils.FilterWrapper
97 * @deprecated use {@link #getDefaultFilterWrappers(MavenProject, List, boolean, MavenSession, MavenResourcesExecution)}
98 */
99 List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath,
100 MavenSession mavenSession )
101 throws MavenFilteringException;
102
103 /**
104 * @param mavenProject
105 * @param filters
106 * @param escapedBackslashesInFilePath
107 * @param mavenSession
108 * @param mavenResourcesExecution
109 * @return {@link List} of FileUtils.FilterWrapper
110 * @throws MavenFilteringException
111 * @since 1.0-beta-2
112 */
113 List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath,
114 MavenSession mavenSession, MavenResourcesExecution mavenResourcesExecution )
115 throws MavenFilteringException;
116
117 /**
118 * @param request
119 * @return {@link List} of FileUtils.FilterWrapper
120 * @throws MavenFilteringException
121 * @since 1.0-beta-3
122 */
123 List getDefaultFilterWrappers( AbstractMavenFilteringRequest request )
124 throws MavenFilteringException;
125
126 }