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 import java.util.Properties;
24
25 import org.apache.maven.execution.MavenSession;
26 import org.apache.maven.project.MavenProject;
27
28 /**
29 * @author Olivier Lamy
30 * @since 1.0-beta-3
31 */
32 public class MavenFileFilterRequest extends AbstractMavenFilteringRequest {
33
34 private File from;
35
36 private File to;
37
38 private boolean filtering;
39
40 private String encoding;
41
42 /**
43 * The constructor.
44 */
45 public MavenFileFilterRequest() {
46 // nothing
47 }
48
49 /**
50 * @param from The request from where.
51 * @param to The request to where
52 * @param filtering Filtering yes {@code true} or no {@code false}
53 * @param mavenProject The Maven Project.
54 * @param filters The list of given filters.
55 * @param escapedBackslashesInFilePath Escape back slashes in file path.
56 * @param encoding The used encoding during the filtering.
57 * @param mavenSession The Maven Session.
58 * @param additionalProperties Supplemental properties.
59 */
60 public MavenFileFilterRequest(
61 File from,
62 File to,
63 boolean filtering,
64 MavenProject mavenProject,
65 List<String> filters,
66 boolean escapedBackslashesInFilePath,
67 String encoding,
68 MavenSession mavenSession,
69 Properties additionalProperties) {
70 super(mavenProject, filters, mavenSession);
71 this.encoding = encoding;
72 this.from = from;
73 this.to = to;
74 this.filtering = filtering;
75 setAdditionalProperties(additionalProperties);
76 setEscapeWindowsPaths(escapedBackslashesInFilePath);
77 }
78
79 /**
80 * Return the encoding.
81 *
82 * @return Current encoding.
83 */
84 public String getEncoding() {
85 return encoding;
86 }
87
88 /**
89 * Set the value for encoding.
90 *
91 * @param encoding Give the new value for encoding.
92 */
93 public void setEncoding(String encoding) {
94 this.encoding = encoding;
95 }
96
97 /**
98 * @return to filter from.
99 */
100 public File getFrom() {
101 return from;
102 }
103
104 /**
105 * @param from set filter from.
106 */
107 public void setFrom(File from) {
108 this.from = from;
109 }
110
111 /**
112 * @return The filter to
113 */
114 public File getTo() {
115 return to;
116 }
117
118 /**
119 * @param to Set the target.
120 */
121 public void setTo(File to) {
122 this.to = to;
123 }
124
125 /**
126 * @return if we are filtering yes {@code true} no {@code false}
127 */
128 public boolean isFiltering() {
129 return filtering;
130 }
131
132 /**
133 * @param filtering set filtering yes / no.
134 */
135 public void setFiltering(boolean filtering) {
136 this.filtering = filtering;
137 }
138 }