View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.shared.filtering;
20  
21  import java.io.File;
22  import java.util.List;
23  
24  import org.apache.maven.execution.MavenSession;
25  import org.apache.maven.project.MavenProject;
26  
27  /**
28   * @author Olivier Lamy
29   */
30  public interface MavenFileFilter extends DefaultFilterInfo {
31  
32      /**
33       * Will copy a file with some filtering using defaultFilterWrappers.
34       *
35       * @param from file to copy/filter
36       * @param to destination file
37       * @param filtering enable or not filtering
38       * @param mavenProject {@link MavenProject}
39       * @param mavenSession {@link MavenSession}
40       * @param escapedBackslashesInFilePath escape backslashes in file path.
41       * @param filters {@link List} of String which are path to a Property file
42       * @param encoding The encoding which is used during the filtering process.
43       * @throws MavenFilteringException in case of failure.
44       * @see DefaultFilterInfo#getDefaultFilterWrappers(MavenProject, List, boolean,MavenSession, MavenResourcesExecution)
45       */
46      void copyFile(
47              File from,
48              File to,
49              boolean filtering,
50              MavenProject mavenProject,
51              List<String> filters,
52              boolean escapedBackslashesInFilePath,
53              String encoding,
54              MavenSession mavenSession)
55              throws MavenFilteringException;
56  
57      /**
58       * @param mavenFileFilterRequest the request
59       * @throws MavenFilteringException in case of failure.
60       * @since 1.0-beta-3
61       */
62      void copyFile(MavenFileFilterRequest mavenFileFilterRequest) throws MavenFilteringException;
63  
64      /**
65       * @param from The source file
66       * @param to The target file
67       * @param filtering true to apply filtering
68       * @param filterWrappers {@link List} of FileUtils.FilterWrapper
69       * @param encoding The encoding used during the filtering.
70       * @throws MavenFilteringException In case of an error.
71       */
72      void copyFile(File from, File to, boolean filtering, List<FilterWrapper> filterWrappers, String encoding)
73              throws MavenFilteringException;
74  
75      /**
76       * @param from The source file
77       * @param to The destination file
78       * @param filtering true to apply filtering
79       * @param filterWrappers The filters to be applied.
80       * @param encoding The encoding to use
81       * @param overwrite unused
82       * @throws MavenFilteringException In case of an error.
83       * @since 1.0-beta-2
84       * @deprecated use {@link #copyFile(File, File, boolean, List, String)} instead
85       */
86      @Deprecated
87      void copyFile(
88              File from,
89              File to,
90              boolean filtering,
91              List<FilterWrapper> filterWrappers,
92              String encoding,
93              boolean overwrite)
94              throws MavenFilteringException;
95  }