View Javadoc
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 java.io.File;
23  import java.util.List;
24  
25  import org.apache.maven.execution.MavenSession;
26  import org.apache.maven.project.MavenProject;
27  import org.apache.maven.shared.utils.io.FileUtils;
28  
29  /**
30   * @author Olivier Lamy
31   */
32  public interface MavenFileFilter
33      extends DefaultFilterInfo
34  {
35  
36      /**
37       * Will copy a file with some filtering using defaultFilterWrappers.
38       *
39       * @param from file to copy/filter
40       * @param to destination file
41       * @param filtering enable or not filtering
42       * @param mavenProject {@link MavenProject}
43       * @param mavenSession {@link MavenSession}
44       * @param escapedBackslashesInFilePath escape backslashes in file path.
45       * @param filters {@link List} of String which are path to a Property file
46       * @param encoding The encoding which is used during the filtering process.
47       * @throws MavenFilteringException in case of failure.
48       * @see #getDefaultFilterWrappers(MavenProject, List, boolean, MavenSession)
49       */
50      void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List<String> filters,
51                     boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession )
52                         throws MavenFilteringException;
53  
54      /**
55       * @param mavenFileFilterRequest the request
56       * @throws MavenFilteringException in case of failure.
57       * @since 1.0-beta-3
58       */
59      void copyFile( MavenFileFilterRequest mavenFileFilterRequest )
60          throws MavenFilteringException;
61  
62      /**
63       * @param from The source file
64       * @param to The target file
65       * @param filtering true to apply filtering
66       * @param filterWrappers {@link List} of FileUtils.FilterWrapper
67       * @param encoding The encoding used during the filtering.
68       * @throws MavenFilteringException In case of an error.
69       */
70      void copyFile( File from, final File to, boolean filtering, List<FileUtils.FilterWrapper> filterWrappers,
71                     String encoding )
72                         throws MavenFilteringException;
73  
74      /**
75       * @param from The source file
76       * @param to The destination file
77       * @param filtering true to apply filtering
78       * @param filterWrappers The filters to be applied.
79       * @param encoding The encoding to use
80       * @param overwrite Overwrite to file ?
81       * @throws MavenFilteringException In case of an error.
82       * @since 1.0-beta-2
83       */
84      void copyFile( File from, final File to, boolean filtering, List<FileUtils.FilterWrapper> filterWrappers,
85                     String encoding, boolean overwrite )
86                         throws MavenFilteringException;
87  }