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