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.Reader;
23  import java.util.List;
24  
25  import javax.annotation.Nonnull;
26  import javax.annotation.Nullable;
27  
28  import org.apache.maven.execution.MavenSession;
29  import org.apache.maven.project.MavenProject;
30  import org.apache.maven.shared.utils.io.FileUtils;
31  
32  /**
33   * @author Olivier Lamy
34   * @author Kristian Rosenvold
35   * @since 1.3
36   */
37  public interface MavenReaderFilter
38      extends DefaultFilterInfo
39  {
40      /**
41       * Provides a new reader that applies filtering using defaultFilterWrappers.
42       *
43       * @param from the source reader
44       * @param filtering enable or not filtering
45       * @param mavenProject {@link MavenProject}
46       * @param mavenSession {@link MavenSession}
47       * @param filters {@link java.util.List} of String which are path to a Property file
48       * @param escapedBackslashesInFilePath escape backslashes in file path.
49       * @return an input stream that applies the filter
50       * @throws org.apache.maven.shared.filtering.MavenFilteringException in case of failure.
51       * @see #getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List, boolean,
52       *      org.apache.maven.execution.MavenSession)
53       */
54      @Nonnull
55      Reader filter( @Nonnull Reader from, boolean filtering, @Nullable MavenProject mavenProject, List<String> filters,
56                     boolean escapedBackslashesInFilePath, MavenSession mavenSession )
57                         throws MavenFilteringException;
58  
59      /**
60       * Provides a new reader that applies filtering using defaultFilterWrappers.
61       *
62       * @param mavenFileFilterRequest The filter request
63       * @throws org.apache.maven.shared.filtering.MavenFilteringException in case of failure.
64       * @return an input stream that applies the filter
65       * @since 1.0-beta-3
66       */
67      @Nonnull
68      Reader filter( @Nonnull MavenReaderFilterRequest mavenFileFilterRequest )
69          throws MavenFilteringException;
70  
71      /**
72       * Provides a new reader that applies filtering using defaultFilterWrappers.
73       *
74       * @param from the source reader
75       * @param filtering true to apply filtering
76       * @param filterWrappers {@link java.util.List} of FileUtils.FilterWrapper
77       * @return an input stream that applies the filter
78       */
79      @Nonnull
80      Reader filter( @Nonnull Reader from, boolean filtering, @Nonnull List<FileUtils.FilterWrapper> filterWrappers );
81  }