1 |
|
package org.apache.torque.mojo; |
2 |
|
|
3 |
|
import java.util.Properties; |
4 |
|
|
5 |
|
import org.apache.commons.lang.StringUtils; |
6 |
|
import org.apache.maven.plugin.MojoExecutionException; |
7 |
|
import org.apache.maven.plugin.descriptor.PluginDescriptor; |
8 |
|
import org.apache.torque.util.JdbcConfigurer; |
9 |
|
import org.kuali.core.db.torque.DumpTask; |
10 |
|
import org.kuali.core.db.torque.PropertyHandlingException; |
11 |
|
import org.kuali.core.db.torque.StringFilter; |
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
|
|
| 0% |
Uncovered Elements: 82 (82) |
Complexity: 32 |
Complexity Density: 0.67 |
|
16 |
|
public abstract class ExportMojo extends AntTaskMojo { |
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
private Properties driverProperties; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
private boolean antCompatibilityMode; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
private String artifactId; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
private boolean includeVersionInComment; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
private String comment; |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
private String includes; |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
private String excludes; |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
private String targetDatabase; |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
private String schema; |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
private String driver; |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
private String url; |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
private String username; |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
private String password; |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
138 |
0
|
public String getDriver() {... |
139 |
0
|
return driver; |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
@param |
146 |
|
|
147 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
0
|
public void setDriver(final String driver) {... |
149 |
0
|
this.driver = driver; |
150 |
|
} |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
@return |
156 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
157 |
0
|
public String getPassword() {... |
158 |
0
|
return password; |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
@param |
165 |
|
|
166 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
167 |
0
|
public void setPassword(final String password) {... |
168 |
0
|
this.password = password; |
169 |
|
} |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
@return |
175 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
176 |
0
|
public String getUrl() {... |
177 |
0
|
return url; |
178 |
|
} |
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
@param |
184 |
|
|
185 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
186 |
0
|
public void setUrl(final String url) {... |
187 |
0
|
this.url = url; |
188 |
|
} |
189 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
190 |
0
|
public String getUsername() {... |
191 |
0
|
return username; |
192 |
|
} |
193 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
194 |
0
|
public void setUsername(final String username) {... |
195 |
0
|
this.username = username; |
196 |
|
} |
197 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
198 |
0
|
public String getSchema() {... |
199 |
0
|
return schema; |
200 |
|
} |
201 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
202 |
0
|
public void setSchema(final String schema) {... |
203 |
0
|
this.schema = schema; |
204 |
|
} |
205 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
206 |
0
|
public String getTargetDatabase() {... |
207 |
0
|
return targetDatabase; |
208 |
|
} |
209 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
210 |
0
|
public void setTargetDatabase(final String targetDatabase) {... |
211 |
0
|
this.targetDatabase = targetDatabase; |
212 |
|
} |
213 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
214 |
0
|
public String getIncludes() {... |
215 |
0
|
return includes; |
216 |
|
} |
217 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
218 |
0
|
public void setIncludes(final String includePatterns) {... |
219 |
0
|
this.includes = includePatterns; |
220 |
|
} |
221 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
222 |
0
|
public String getExcludes() {... |
223 |
0
|
return excludes; |
224 |
|
} |
225 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
226 |
0
|
public void setExcludes(final String excludePatterns) {... |
227 |
0
|
this.excludes = excludePatterns; |
228 |
|
} |
229 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
230 |
0
|
public String getComment() {... |
231 |
0
|
return comment; |
232 |
|
} |
233 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
234 |
0
|
public void setComment(final String comment) {... |
235 |
0
|
this.comment = comment; |
236 |
|
} |
237 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
238 |
0
|
protected String getUpdatedComment() {... |
239 |
0
|
PluginDescriptor descriptor = (PluginDescriptor) this.getPluginContext().get("pluginDescriptor"); |
240 |
0
|
if (descriptor == null) { |
241 |
|
|
242 |
0
|
return " Auto-generated by the maven-impex-plugin " + getComment(); |
243 |
|
} |
244 |
0
|
String name = descriptor.getName(); |
245 |
0
|
String version = descriptor.getVersion(); |
246 |
0
|
String comment = " Auto-generated by the " + name; |
247 |
0
|
if (isIncludeVersionInComment()) { |
248 |
0
|
comment += " v" + version + " "; |
249 |
|
} |
250 |
0
|
if (!StringUtils.isEmpty(getComment())) { |
251 |
0
|
comment += getComment(); |
252 |
|
} |
253 |
0
|
return comment; |
254 |
|
} |
255 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.18 |
|
256 |
0
|
@Override... |
257 |
|
protected void configureTask() throws MojoExecutionException { |
258 |
0
|
setComment(getUpdatedComment()); |
259 |
0
|
try { |
260 |
0
|
JdbcConfigurer configurer = new JdbcConfigurer(); |
261 |
0
|
configurer.updateConfiguration(this); |
262 |
0
|
configurer.validateConfiguration(this); |
263 |
|
} catch (PropertyHandlingException e) { |
264 |
0
|
throw new MojoExecutionException("Error handling properties", e); |
265 |
|
} |
266 |
0
|
super.configureTask(); |
267 |
0
|
DumpTask task = (DumpTask) super.getAntTask(); |
268 |
0
|
task.setIncludePatterns(StringFilter.getListFromCSV(getIncludes())); |
269 |
0
|
task.setExcludePatterns(StringFilter.getListFromCSV(getExcludes())); |
270 |
0
|
task.setDriverProperties(driverProperties); |
271 |
|
} |
272 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
273 |
0
|
public String getArtifactId() {... |
274 |
0
|
return artifactId; |
275 |
|
} |
276 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
277 |
0
|
public void setArtifactId(final String artifactId) {... |
278 |
0
|
this.artifactId = artifactId; |
279 |
|
} |
280 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
281 |
0
|
public boolean isAntCompatibilityMode() {... |
282 |
0
|
return antCompatibilityMode; |
283 |
|
} |
284 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
285 |
0
|
public void setAntCompatibilityMode(final boolean antCompatibilityMode) {... |
286 |
0
|
this.antCompatibilityMode = antCompatibilityMode; |
287 |
|
} |
288 |
|
|
289 |
|
|
290 |
|
@return |
291 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
292 |
0
|
public boolean isIncludeVersionInComment() {... |
293 |
0
|
return includeVersionInComment; |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
@param |
298 |
|
|
299 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
300 |
0
|
public void setIncludeVersionInComment(final boolean includeVersionInComment) {... |
301 |
0
|
this.includeVersionInComment = includeVersionInComment; |
302 |
|
} |
303 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
304 |
0
|
public Properties getDriverProperties() {... |
305 |
0
|
return driverProperties; |
306 |
|
} |
307 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
308 |
0
|
public void setDriverProperties(Properties driverProperties) {... |
309 |
0
|
this.driverProperties = driverProperties; |
310 |
|
} |
311 |
|
} |