1 |
|
package org.codehaus.mojo.sql; |
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
import java.io.BufferedOutputStream; |
23 |
|
import java.io.BufferedReader; |
24 |
|
import java.io.File; |
25 |
|
import java.io.FileInputStream; |
26 |
|
import java.io.FileOutputStream; |
27 |
|
import java.io.FileReader; |
28 |
|
import java.io.IOException; |
29 |
|
import java.io.InputStream; |
30 |
|
import java.io.InputStreamReader; |
31 |
|
import java.io.OutputStream; |
32 |
|
import java.io.PrintStream; |
33 |
|
import java.io.Reader; |
34 |
|
import java.io.StringReader; |
35 |
|
import java.sql.Connection; |
36 |
|
import java.sql.Driver; |
37 |
|
import java.sql.ResultSet; |
38 |
|
import java.sql.ResultSetMetaData; |
39 |
|
import java.sql.SQLException; |
40 |
|
import java.sql.SQLWarning; |
41 |
|
import java.sql.Statement; |
42 |
|
import java.util.ArrayList; |
43 |
|
import java.util.Collections; |
44 |
|
import java.util.Enumeration; |
45 |
|
import java.util.List; |
46 |
|
import java.util.Properties; |
47 |
|
import java.util.StringTokenizer; |
48 |
|
import java.util.Vector; |
49 |
|
|
50 |
|
import org.apache.commons.io.IOUtils; |
51 |
|
import org.apache.commons.lang.StringEscapeUtils; |
52 |
|
import org.apache.maven.execution.MavenSession; |
53 |
|
import org.apache.maven.plugin.AbstractMojo; |
54 |
|
import org.apache.maven.plugin.MojoExecutionException; |
55 |
|
import org.apache.maven.project.MavenProject; |
56 |
|
import org.apache.maven.settings.Server; |
57 |
|
import org.apache.maven.settings.Settings; |
58 |
|
import org.apache.maven.shared.filtering.MavenFileFilter; |
59 |
|
import org.apache.maven.shared.filtering.MavenFileFilterRequest; |
60 |
|
import org.apache.maven.shared.filtering.MavenFilteringException; |
61 |
|
import org.codehaus.plexus.util.FileUtils; |
62 |
|
import org.codehaus.plexus.util.IOUtil; |
63 |
|
import org.codehaus.plexus.util.StringUtils; |
64 |
|
import org.springframework.core.io.DefaultResourceLoader; |
65 |
|
import org.springframework.core.io.Resource; |
66 |
|
import org.springframework.core.io.ResourceLoader; |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
|
|
| 0% |
Uncovered Elements: 530 (530) |
Complexity: 159 |
Complexity Density: 0.5 |
|
73 |
|
public class SqlExecMojo extends AbstractMojo { |
74 |
|
|
75 |
|
|
76 |
|
@link |
77 |
|
|
78 |
|
|
79 |
|
public static final String ON_ERROR_ABORT = "abort"; |
80 |
|
|
81 |
|
|
82 |
|
@link |
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
public static final String ON_ERROR_ABORT_AFTER = "abortAfter"; |
87 |
|
|
88 |
|
|
89 |
|
@link |
90 |
|
|
91 |
|
|
92 |
|
public static final String ON_ERROR_CONTINUE = "continue"; |
93 |
|
|
94 |
|
|
95 |
|
@link |
96 |
|
|
97 |
|
|
98 |
|
public static final String FILE_SORTING_ASC = "ascending"; |
99 |
|
|
100 |
|
|
101 |
|
@link |
102 |
|
|
103 |
|
|
104 |
|
public static final String FILE_SORTING_DSC = "descending"; |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
@since |
114 |
|
|
115 |
|
|
116 |
|
private String username; |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
@since |
124 |
|
|
125 |
|
|
126 |
|
private String password; |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
@since |
134 |
|
|
135 |
|
|
136 |
|
private boolean enableAnonymousPassword; |
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
@since |
143 |
|
|
144 |
|
|
145 |
|
private String driverProperties; |
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
@since |
151 |
|
|
152 |
|
|
153 |
|
private Settings settings; |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
@since |
160 |
|
|
161 |
|
|
162 |
|
private String settingsKey; |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
@since |
170 |
|
|
171 |
|
|
172 |
|
private boolean skipOnConnectionError; |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
private boolean forceMojoExecution; |
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
protected MavenProject project; |
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
private MavenSession mavenSession; |
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
@since |
205 |
|
|
206 |
|
|
207 |
|
private String sqlCommand = ""; |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
@since |
213 |
|
|
214 |
|
|
215 |
|
private File[] srcFiles; |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@since |
221 |
|
|
222 |
|
|
223 |
|
private String[] resourceLocations; |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
@since |
229 |
|
|
230 |
|
|
231 |
|
private Fileset fileset; |
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
@since |
237 |
|
|
238 |
|
|
239 |
|
private boolean skip; |
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|
@since |
248 |
|
|
249 |
|
private String url; |
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
@since |
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
private String driver; |
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
@since |
265 |
|
|
266 |
|
|
267 |
|
private boolean autocommit; |
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
|
273 |
|
@since |
274 |
|
|
275 |
|
|
276 |
|
private String onError = ON_ERROR_ABORT; |
277 |
|
|
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
@since |
284 |
|
|
285 |
|
|
286 |
|
private String delimiter = ";"; |
287 |
|
|
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
@since |
301 |
|
|
302 |
|
|
303 |
|
private String delimiterType = DelimiterType.NORMAL; |
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
|
|
310 |
|
@since |
311 |
|
|
312 |
|
|
313 |
|
private String orderFile = null; |
314 |
|
|
315 |
|
|
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
@deprecated |
322 |
|
@since |
323 |
|
|
324 |
|
|
325 |
|
|
326 |
|
private boolean enableBlockMode = false; |
327 |
|
|
328 |
|
|
329 |
|
|
330 |
|
|
331 |
|
@since |
332 |
|
|
333 |
|
|
334 |
|
private boolean keepFormat = false; |
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
|
|
341 |
|
@since |
342 |
|
|
343 |
|
private boolean printResultSet = false; |
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
|
348 |
|
private boolean showheaders = true; |
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
|
@since |
355 |
|
|
356 |
|
private File outputFile; |
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
@since |
361 |
|
|
362 |
|
private String outputDelimiter; |
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
@since |
370 |
|
|
371 |
|
private String encoding = ""; |
372 |
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
private boolean append = false; |
377 |
|
|
378 |
|
|
379 |
|
|
380 |
|
|
381 |
|
|
382 |
|
@since |
383 |
|
|
384 |
|
|
385 |
|
private boolean escapeProcessing = true; |
386 |
|
|
387 |
|
|
388 |
|
|
389 |
|
|
390 |
|
|
391 |
|
|
392 |
|
|
393 |
|
private int successfulStatements = 0; |
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
|
398 |
|
private int totalStatements = 0; |
399 |
|
|
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
private Connection conn = null; |
404 |
|
|
405 |
|
|
406 |
|
|
407 |
|
|
408 |
|
private Statement statement = null; |
409 |
|
|
410 |
|
|
411 |
|
|
412 |
|
|
413 |
|
private Vector<Transaction> transactions = new Vector<Transaction>(); |
414 |
|
|
415 |
|
|
416 |
|
|
417 |
|
@since |
418 |
|
|
419 |
|
private MavenFileFilter fileFilter; |
420 |
|
|
421 |
|
|
422 |
|
|
423 |
|
|
424 |
|
|
425 |
|
|
426 |
|
@since |
427 |
|
|
428 |
|
private boolean enableFiltering; |
429 |
|
|
430 |
|
|
431 |
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
|
437 |
|
|
438 |
|
|
439 |
|
@return |
440 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
441 |
0
|
public Transaction createTransaction() {... |
442 |
0
|
Transaction t = new Transaction(); |
443 |
0
|
transactions.addElement(t); |
444 |
0
|
return t; |
445 |
|
} |
446 |
|
|
447 |
|
|
448 |
|
|
449 |
|
|
450 |
|
|
451 |
|
@param |
452 |
|
|
453 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
454 |
0
|
public void addText(String sql) {... |
455 |
0
|
this.sqlCommand += sql; |
456 |
|
} |
457 |
|
|
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
@param |
462 |
|
|
463 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
464 |
0
|
public void setEncoding(String encoding) {... |
465 |
0
|
this.encoding = encoding; |
466 |
|
} |
467 |
|
|
468 |
|
|
469 |
|
|
470 |
|
|
471 |
|
|
472 |
|
@param |
473 |
|
|
474 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
475 |
0
|
public void setDelimiter(String delimiter) {... |
476 |
0
|
this.delimiter = delimiter; |
477 |
|
} |
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
|
@param |
483 |
|
|
484 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
485 |
0
|
public void setDelimiterType(String delimiterType) {... |
486 |
0
|
this.delimiterType = delimiterType; |
487 |
|
} |
488 |
|
|
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
@param |
493 |
|
|
494 |
|
|
495 |
|
@deprecated |
496 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
497 |
0
|
public void setPrintResutlSet(boolean print) {... |
498 |
0
|
setPrintResultSet(print); |
499 |
|
} |
500 |
|
|
501 |
|
|
502 |
|
|
503 |
|
|
504 |
|
@param |
505 |
|
|
506 |
|
|
507 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
508 |
0
|
public void setPrintResultSet(boolean print) {... |
509 |
0
|
this.printResultSet = print; |
510 |
|
} |
511 |
|
|
512 |
|
|
513 |
|
|
514 |
|
|
515 |
|
|
516 |
|
@param |
517 |
|
|
518 |
|
|
519 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
520 |
0
|
public void setShowheaders(boolean showheaders) {... |
521 |
0
|
this.showheaders = showheaders; |
522 |
|
} |
523 |
|
|
524 |
|
|
525 |
|
|
526 |
|
|
527 |
|
@param |
528 |
|
|
529 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
530 |
0
|
public void setOutputFile(File output) {... |
531 |
0
|
this.outputFile = output; |
532 |
|
} |
533 |
|
|
534 |
|
|
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
@param |
539 |
|
|
540 |
|
|
541 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
542 |
0
|
public void setAppend(boolean append) {... |
543 |
0
|
this.append = append; |
544 |
|
} |
545 |
|
|
546 |
|
|
547 |
|
|
548 |
|
|
549 |
|
@param |
550 |
|
|
551 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
552 |
0
|
public void setKeepFormat(boolean keepformat) {... |
553 |
0
|
this.keepFormat = keepformat; |
554 |
|
} |
555 |
|
|
556 |
|
|
557 |
|
|
558 |
|
|
559 |
|
@param |
560 |
|
|
561 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
562 |
0
|
public void setEscapeProcessing(boolean enable) {... |
563 |
0
|
escapeProcessing = enable; |
564 |
|
} |
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
@link |
573 |
|
|
574 |
|
@link |
575 |
|
|
576 |
|
|
577 |
|
@return |
578 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 5 |
Complexity Density: 0.71 |
|
579 |
0
|
protected boolean skipMojo() {... |
580 |
0
|
if (skip) { |
581 |
0
|
getLog().info("Skip sql execution"); |
582 |
0
|
return true; |
583 |
|
} |
584 |
|
|
585 |
0
|
if (!forceMojoExecution && project != null && "pom".equals(project.getPackaging())) { |
586 |
0
|
getLog().info("Skipping sql execution for project with packaging type 'pom'"); |
587 |
0
|
return true; |
588 |
|
} |
589 |
|
|
590 |
0
|
return false; |
591 |
|
} |
592 |
|
|
593 |
|
|
594 |
|
|
595 |
|
|
596 |
|
@throws |
597 |
|
|
|
|
| 0% |
Uncovered Elements: 64 (64) |
Complexity: 20 |
Complexity Density: 0.45 |
|
598 |
0
|
public void execute() throws MojoExecutionException {... |
599 |
|
|
600 |
0
|
if (skipMojo()) { |
601 |
0
|
return; |
602 |
|
} |
603 |
|
|
604 |
0
|
successfulStatements = 0; |
605 |
|
|
606 |
0
|
totalStatements = 0; |
607 |
|
|
608 |
0
|
loadUserInfoFromSettings(); |
609 |
|
|
610 |
0
|
addCommandToTransactions(); |
611 |
|
|
612 |
0
|
addFilesToTransactions(); |
613 |
|
|
614 |
0
|
addFileSetToTransactions(); |
615 |
|
|
616 |
0
|
addResourcesToTransactions(); |
617 |
|
|
618 |
0
|
sortTransactions(); |
619 |
|
|
620 |
0
|
try { |
621 |
0
|
conn = getConnection(); |
622 |
|
} catch (SQLException e) { |
623 |
0
|
if (!this.skipOnConnectionError) { |
624 |
0
|
throw new MojoExecutionException(e.getMessage(), e); |
625 |
|
} else { |
626 |
|
|
627 |
0
|
return; |
628 |
|
} |
629 |
|
} |
630 |
|
|
631 |
0
|
try { |
632 |
0
|
statement = conn.createStatement(); |
633 |
0
|
statement.setEscapeProcessing(escapeProcessing); |
634 |
|
|
635 |
0
|
PrintStream out = System.out; |
636 |
0
|
try { |
637 |
0
|
if (outputFile != null) { |
638 |
0
|
getLog().debug("Opening PrintStream to output file " + outputFile); |
639 |
0
|
out = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile.getAbsolutePath(), |
640 |
|
append))); |
641 |
|
} |
642 |
|
|
643 |
|
|
644 |
0
|
for (Enumeration<Transaction> e = transactions.elements(); e.hasMoreElements();) { |
645 |
0
|
Transaction t = e.nextElement(); |
646 |
|
|
647 |
0
|
t.runTransaction(out); |
648 |
|
|
649 |
0
|
if (!autocommit) { |
650 |
0
|
getLog().debug("Committing transaction"); |
651 |
0
|
conn.commit(); |
652 |
|
} |
653 |
|
} |
654 |
|
} finally { |
655 |
0
|
if (out != null && out != System.out) { |
656 |
0
|
out.close(); |
657 |
|
} |
658 |
|
} |
659 |
|
} catch (IOException e) { |
660 |
0
|
throw new MojoExecutionException(e.getMessage(), e); |
661 |
|
} catch (SQLException e) { |
662 |
0
|
if (!autocommit && conn != null && ON_ERROR_ABORT.equalsIgnoreCase(getOnError())) { |
663 |
0
|
try { |
664 |
0
|
conn.rollback(); |
665 |
|
} catch (SQLException ex) { |
666 |
|
|
667 |
|
} |
668 |
|
} |
669 |
0
|
throw new MojoExecutionException(e.getMessage(), e); |
670 |
|
} finally { |
671 |
0
|
try { |
672 |
0
|
if (statement != null) { |
673 |
0
|
statement.close(); |
674 |
|
} |
675 |
0
|
if (conn != null) { |
676 |
0
|
conn.close(); |
677 |
|
} |
678 |
|
} catch (SQLException ex) { |
679 |
|
|
680 |
|
} |
681 |
|
} |
682 |
|
|
683 |
0
|
getLog().info( |
684 |
|
getSuccessfulStatements() + " of " + getTotalStatements() + " SQL statements executed successfully"); |
685 |
|
|
686 |
0
|
if (ON_ERROR_ABORT_AFTER.equalsIgnoreCase(getOnError()) && totalStatements != successfulStatements) { |
687 |
0
|
throw new MojoExecutionException("Some SQL statements failed to execute"); |
688 |
|
} |
689 |
|
|
690 |
|
} |
691 |
|
|
692 |
|
|
693 |
|
|
694 |
|
|
695 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
696 |
0
|
private void addCommandToTransactions() {... |
697 |
0
|
createTransaction().addText(sqlCommand.trim()); |
698 |
|
} |
699 |
|
|
700 |
|
|
701 |
|
|
702 |
|
|
703 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
704 |
0
|
private void addFileSetToTransactions() {... |
705 |
0
|
String[] includedFiles; |
706 |
0
|
if (fileset != null) { |
707 |
0
|
fileset.scan(); |
708 |
0
|
includedFiles = fileset.getIncludedFiles(); |
709 |
|
} else { |
710 |
0
|
includedFiles = new String[0]; |
711 |
|
} |
712 |
|
|
713 |
0
|
for (int j = 0; j < includedFiles.length; j++) { |
714 |
0
|
createTransaction().setSrc(new File(fileset.getBasedir(), includedFiles[j])); |
715 |
|
} |
716 |
|
} |
717 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 6 |
Complexity Density: 0.46 |
|
718 |
0
|
protected Resource[] getResources(String[] locations) throws MojoExecutionException {... |
719 |
0
|
if (locations == null || locations.length == 0) { |
720 |
0
|
return new Resource[] {}; |
721 |
|
} |
722 |
0
|
ResourceLoader loader = new DefaultResourceLoader(); |
723 |
0
|
List<Resource> resources = new ArrayList<Resource>(); |
724 |
0
|
for (int i = 0; i < locations.length; i++) { |
725 |
0
|
String location = locations[i]; |
726 |
|
|
727 |
0
|
if (StringUtils.isEmpty(location)) { |
728 |
0
|
continue; |
729 |
|
} |
730 |
0
|
Resource resource = loader.getResource(location); |
731 |
0
|
if (!resource.exists()) { |
732 |
|
|
733 |
0
|
throw new MojoExecutionException("Resource " + location + " was not found"); |
734 |
|
} |
735 |
0
|
resources.add(resource); |
736 |
|
} |
737 |
0
|
return resources.toArray(new Resource[resources.size()]); |
738 |
|
} |
739 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
740 |
0
|
protected void copy(Resource resource, File file) throws IOException {... |
741 |
0
|
InputStream in = resource.getInputStream(); |
742 |
0
|
OutputStream out = new FileOutputStream(file); |
743 |
0
|
IOUtils.copyLarge(in, out); |
744 |
|
} |
745 |
|
|
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
@throws |
750 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 5 |
Complexity Density: 0.19 |
|
751 |
0
|
private void addResourcesToTransactions() throws MojoExecutionException {... |
752 |
0
|
String[] locations = getResourceLocations(); |
753 |
0
|
Resource[] resources = getResources(locations); |
754 |
|
|
755 |
0
|
MavenFileFilterRequest request = new MavenFileFilterRequest(); |
756 |
0
|
request.setEncoding(encoding); |
757 |
0
|
request.setMavenSession(mavenSession); |
758 |
0
|
request.setMavenProject(project); |
759 |
0
|
request.setFiltering(enableFiltering); |
760 |
0
|
for (int i = 0; i < resources.length; i++) { |
761 |
0
|
Resource resource = resources[i]; |
762 |
0
|
String filename = resource.getFilename(); |
763 |
0
|
String basename = FileUtils.basename(filename); |
764 |
0
|
String extension = FileUtils.extension(filename); |
765 |
0
|
File sourceFile = FileUtils.createTempFile(basename, extension, null); |
766 |
|
|
767 |
0
|
try { |
768 |
0
|
copy(resource, sourceFile); |
769 |
|
} catch (IOException e) { |
770 |
0
|
throw new MojoExecutionException("Error copying resource " + resource + "to a temp file", e); |
771 |
|
} |
772 |
|
|
773 |
0
|
File targetFile = FileUtils.createTempFile(basename, extension, null); |
774 |
0
|
if (!getLog().isDebugEnabled()) { |
775 |
0
|
targetFile.deleteOnExit(); |
776 |
0
|
sourceFile.deleteOnExit(); |
777 |
|
} |
778 |
|
|
779 |
0
|
request.setFrom(sourceFile); |
780 |
0
|
request.setTo(targetFile); |
781 |
|
|
782 |
0
|
try { |
783 |
0
|
fileFilter.copyFile(request); |
784 |
|
} catch (MavenFilteringException e) { |
785 |
0
|
throw new MojoExecutionException(e.getMessage()); |
786 |
|
} |
787 |
|
|
788 |
0
|
createTransaction().setSrc(targetFile); |
789 |
|
} |
790 |
|
} |
791 |
|
|
792 |
|
|
793 |
|
|
794 |
|
|
795 |
|
@throws |
796 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 7 |
Complexity Density: 0.33 |
|
797 |
0
|
private void addFilesToTransactions() throws MojoExecutionException {... |
798 |
0
|
File[] files = getSrcFiles(); |
799 |
|
|
800 |
0
|
MavenFileFilterRequest request = new MavenFileFilterRequest(); |
801 |
0
|
request.setEncoding(encoding); |
802 |
0
|
request.setMavenSession(mavenSession); |
803 |
0
|
request.setMavenProject(project); |
804 |
0
|
request.setFiltering(enableFiltering); |
805 |
0
|
for (int i = 0; files != null && i < files.length; ++i) { |
806 |
0
|
if (files[i] != null && !files[i].exists()) { |
807 |
0
|
throw new MojoExecutionException(files[i].getPath() + " not found."); |
808 |
|
} |
809 |
|
|
810 |
0
|
File sourceFile = files[i]; |
811 |
0
|
String basename = FileUtils.basename(sourceFile.getName()); |
812 |
0
|
String extension = FileUtils.extension(sourceFile.getName()); |
813 |
0
|
File targetFile = FileUtils.createTempFile(basename, extension, null); |
814 |
0
|
if (!getLog().isDebugEnabled()) { |
815 |
0
|
targetFile.deleteOnExit(); |
816 |
|
} |
817 |
|
|
818 |
0
|
request.setFrom(sourceFile); |
819 |
0
|
request.setTo(targetFile); |
820 |
|
|
821 |
0
|
try { |
822 |
0
|
fileFilter.copyFile(request); |
823 |
|
} catch (MavenFilteringException e) { |
824 |
0
|
throw new MojoExecutionException(e.getMessage()); |
825 |
|
} |
826 |
|
|
827 |
0
|
createTransaction().setSrc(targetFile); |
828 |
|
} |
829 |
|
} |
830 |
|
|
831 |
|
|
832 |
|
|
833 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
834 |
0
|
private void sortTransactions() {... |
835 |
0
|
if (FILE_SORTING_ASC.equalsIgnoreCase(this.orderFile)) { |
836 |
0
|
Collections.sort(transactions); |
837 |
0
|
} else if (FILE_SORTING_DSC.equalsIgnoreCase(this.orderFile)) { |
838 |
0
|
Collections.sort(transactions, Collections.reverseOrder()); |
839 |
|
} |
840 |
|
} |
841 |
|
|
842 |
|
|
843 |
|
|
844 |
|
|
845 |
|
|
846 |
|
@throws |
847 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 10 |
Complexity Density: 0.77 |
|
848 |
0
|
private void loadUserInfoFromSettings() throws MojoExecutionException {... |
849 |
0
|
if (this.settingsKey == null) { |
850 |
0
|
this.settingsKey = getUrl(); |
851 |
|
} |
852 |
|
|
853 |
0
|
if ((getUsername() == null || getPassword() == null) && (settings != null)) { |
854 |
0
|
Server server = this.settings.getServer(this.settingsKey); |
855 |
|
|
856 |
0
|
if (server != null) { |
857 |
0
|
if (getUsername() == null) { |
858 |
0
|
setUsername(server.getUsername()); |
859 |
|
} |
860 |
|
|
861 |
0
|
if (getPassword() == null) { |
862 |
0
|
setPassword(server.getPassword()); |
863 |
|
} |
864 |
|
} |
865 |
|
} |
866 |
|
|
867 |
0
|
if (getUsername() == null) { |
868 |
|
|
869 |
0
|
setUsername(""); |
870 |
|
} |
871 |
|
|
872 |
0
|
if (getPassword() == null) { |
873 |
|
|
874 |
0
|
setPassword(""); |
875 |
|
} |
876 |
|
} |
877 |
|
|
878 |
|
|
879 |
|
|
880 |
|
|
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
@return |
885 |
|
@throws |
886 |
|
|
887 |
|
|
888 |
|
@throws |
889 |
|
|
890 |
|
|
891 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 5 |
Complexity Density: 0.29 |
|
892 |
0
|
private Connection getConnection() throws MojoExecutionException, SQLException {... |
893 |
0
|
getLog().debug("connecting to " + getUrl()); |
894 |
0
|
Properties info = new Properties(); |
895 |
0
|
info.put("user", getUsername()); |
896 |
|
|
897 |
0
|
if (!enableAnonymousPassword) { |
898 |
0
|
info.put("password", getPassword()); |
899 |
|
} |
900 |
|
|
901 |
0
|
info.putAll(this.getDriverProperties()); |
902 |
|
|
903 |
0
|
Driver driverInstance = null; |
904 |
|
|
905 |
0
|
try { |
906 |
0
|
Class<?> dc = Class.forName(getDriver()); |
907 |
0
|
driverInstance = (Driver) dc.newInstance(); |
908 |
|
} catch (ClassNotFoundException e) { |
909 |
0
|
throw new MojoExecutionException("Driver class not found: " + getDriver(), e); |
910 |
|
} catch (Exception e) { |
911 |
0
|
throw new MojoExecutionException("Failure loading driver: " + getDriver(), e); |
912 |
|
} |
913 |
|
|
914 |
0
|
Connection conn = driverInstance.connect(getUrl(), info); |
915 |
|
|
916 |
0
|
if (conn == null) { |
917 |
|
|
918 |
0
|
throw new SQLException("No suitable Driver for " + getUrl()); |
919 |
|
} |
920 |
|
|
921 |
0
|
conn.setAutoCommit(autocommit); |
922 |
0
|
return conn; |
923 |
|
} |
924 |
|
|
925 |
|
|
926 |
|
|
927 |
|
|
928 |
|
@return |
929 |
|
@throws |
930 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
931 |
0
|
protected Properties getDriverProperties() throws MojoExecutionException {... |
932 |
0
|
Properties properties = new Properties(); |
933 |
|
|
934 |
0
|
if (!StringUtils.isEmpty(this.driverProperties)) { |
935 |
0
|
String[] tokens = StringUtils.split(this.driverProperties, ","); |
936 |
0
|
for (int i = 0; i < tokens.length; ++i) { |
937 |
0
|
String[] keyValueTokens = StringUtils.split(tokens[i].trim(), "="); |
938 |
0
|
if (keyValueTokens.length != 2) { |
939 |
0
|
throw new MojoExecutionException("Invalid JDBC Driver properties: " + this.driverProperties); |
940 |
|
} |
941 |
|
|
942 |
0
|
properties.setProperty(keyValueTokens[0], keyValueTokens[1]); |
943 |
|
|
944 |
|
} |
945 |
|
} |
946 |
|
|
947 |
0
|
return properties; |
948 |
|
} |
949 |
|
|
950 |
|
|
951 |
|
|
952 |
|
|
953 |
|
@param |
954 |
|
|
955 |
|
@param |
956 |
|
|
957 |
|
@throws |
958 |
|
@throws |
959 |
|
|
|
|
| 0% |
Uncovered Elements: 57 (57) |
Complexity: 17 |
Complexity Density: 0.55 |
|
960 |
0
|
private void runStatements(Reader reader, PrintStream out) throws SQLException, IOException {... |
961 |
0
|
String line; |
962 |
|
|
963 |
0
|
if (enableBlockMode) { |
964 |
|
|
965 |
|
|
966 |
0
|
line = IOUtil.toString(reader); |
967 |
0
|
execSQL(line, out); |
968 |
0
|
return; |
969 |
|
} |
970 |
|
|
971 |
0
|
StringBuffer sql = new StringBuffer(); |
972 |
|
|
973 |
0
|
BufferedReader in = new BufferedReader(reader); |
974 |
|
|
975 |
0
|
while ((line = in.readLine()) != null) { |
976 |
0
|
if (!keepFormat) { |
977 |
0
|
line = line.trim(); |
978 |
|
} |
979 |
|
|
980 |
0
|
if (!keepFormat) { |
981 |
0
|
if (line.startsWith("//")) { |
982 |
0
|
continue; |
983 |
|
} |
984 |
0
|
if (line.startsWith("--")) { |
985 |
0
|
continue; |
986 |
|
} |
987 |
0
|
StringTokenizer st = new StringTokenizer(line); |
988 |
0
|
if (st.hasMoreTokens()) { |
989 |
0
|
String token = st.nextToken(); |
990 |
0
|
if ("REM".equalsIgnoreCase(token)) { |
991 |
0
|
continue; |
992 |
|
} |
993 |
|
} |
994 |
|
} |
995 |
|
|
996 |
0
|
if (!keepFormat) { |
997 |
0
|
sql.append(" ").append(line); |
998 |
|
} else { |
999 |
0
|
sql.append("\n").append(line); |
1000 |
|
} |
1001 |
|
|
1002 |
|
|
1003 |
|
|
1004 |
|
|
1005 |
0
|
if (!keepFormat) { |
1006 |
0
|
if (SqlSplitter.containsSqlEnd(line, delimiter) == SqlSplitter.NO_END) { |
1007 |
0
|
sql.append("\n"); |
1008 |
|
} |
1009 |
|
} |
1010 |
|
|
1011 |
0
|
if ((delimiterType.equals(DelimiterType.NORMAL) && SqlSplitter.containsSqlEnd(line, delimiter) > 0) |
1012 |
|
|| (delimiterType.equals(DelimiterType.ROW) && line.trim().equals(delimiter))) { |
1013 |
0
|
execSQL(sql.substring(0, sql.length() - delimiter.length()), out); |
1014 |
0
|
sql.setLength(0); |
1015 |
|
} |
1016 |
|
} |
1017 |
|
|
1018 |
|
|
1019 |
0
|
if (!sql.toString().equals("")) { |
1020 |
0
|
execSQL(sql.toString(), out); |
1021 |
|
} |
1022 |
|
} |
1023 |
|
|
1024 |
|
|
1025 |
|
|
1026 |
|
|
1027 |
|
@param |
1028 |
|
|
1029 |
|
@param |
1030 |
|
|
1031 |
|
|
|
|
| 0% |
Uncovered Elements: 53 (53) |
Complexity: 11 |
Complexity Density: 0.31 |
|
1032 |
0
|
private void execSQL(String sql, PrintStream out) throws SQLException {... |
1033 |
|
|
1034 |
0
|
if ("".equals(sql.trim())) { |
1035 |
0
|
return; |
1036 |
|
} |
1037 |
|
|
1038 |
0
|
ResultSet resultSet = null; |
1039 |
0
|
try { |
1040 |
0
|
totalStatements++; |
1041 |
0
|
getLog().debug("SQL: " + sql); |
1042 |
|
|
1043 |
0
|
boolean ret; |
1044 |
0
|
int updateCountTotal = 0; |
1045 |
|
|
1046 |
0
|
ret = statement.execute(sql); |
1047 |
0
|
do { |
1048 |
0
|
if (!ret) { |
1049 |
0
|
int updateCount = statement.getUpdateCount(); |
1050 |
0
|
if (updateCount != -1) { |
1051 |
0
|
updateCountTotal += updateCount; |
1052 |
|
} |
1053 |
|
} else { |
1054 |
0
|
resultSet = statement.getResultSet(); |
1055 |
0
|
if (printResultSet) { |
1056 |
0
|
printResultSet(resultSet, out); |
1057 |
|
} |
1058 |
|
} |
1059 |
0
|
ret = statement.getMoreResults(); |
1060 |
0
|
} while (ret); |
1061 |
|
|
1062 |
0
|
getLog().debug(updateCountTotal + " rows affected"); |
1063 |
|
|
1064 |
0
|
if (printResultSet) { |
1065 |
0
|
StringBuffer line = new StringBuffer(); |
1066 |
0
|
line.append(updateCountTotal).append(" rows affected"); |
1067 |
0
|
out.println(line); |
1068 |
|
} |
1069 |
|
|
1070 |
0
|
SQLWarning warning = conn.getWarnings(); |
1071 |
0
|
while (warning != null) { |
1072 |
0
|
getLog().debug(warning + " sql warning"); |
1073 |
0
|
warning = warning.getNextWarning(); |
1074 |
|
} |
1075 |
0
|
conn.clearWarnings(); |
1076 |
0
|
successfulStatements++; |
1077 |
|
} catch (SQLException e) { |
1078 |
0
|
getLog().error("Failed to execute: " + sql); |
1079 |
0
|
if (ON_ERROR_ABORT.equalsIgnoreCase(getOnError())) { |
1080 |
0
|
throw e; |
1081 |
|
} |
1082 |
0
|
getLog().error(e.toString()); |
1083 |
|
} finally { |
1084 |
0
|
if (resultSet != null) { |
1085 |
0
|
resultSet.close(); |
1086 |
|
} |
1087 |
|
} |
1088 |
|
} |
1089 |
|
|
1090 |
|
|
1091 |
|
|
1092 |
|
|
1093 |
|
@param |
1094 |
|
|
1095 |
|
@param |
1096 |
|
|
1097 |
|
@throws |
1098 |
|
|
1099 |
|
|
|
|
| 0% |
Uncovered Elements: 56 (56) |
Complexity: 12 |
Complexity Density: 0.35 |
|
1100 |
0
|
private void printResultSet(ResultSet rs, PrintStream out) throws SQLException {... |
1101 |
0
|
if (rs != null) { |
1102 |
0
|
getLog().debug("Processing new result set."); |
1103 |
0
|
ResultSetMetaData md = rs.getMetaData(); |
1104 |
0
|
int columnCount = md.getColumnCount(); |
1105 |
0
|
StringBuffer line = new StringBuffer(); |
1106 |
0
|
if (showheaders) { |
1107 |
0
|
boolean first = true; |
1108 |
0
|
for (int col = 1; col <= columnCount; col++) { |
1109 |
0
|
String columnValue = md.getColumnName(col); |
1110 |
|
|
1111 |
0
|
if (columnValue != null) { |
1112 |
0
|
columnValue = columnValue.trim(); |
1113 |
|
|
1114 |
0
|
if (",".equals(outputDelimiter)) { |
1115 |
0
|
columnValue = StringEscapeUtils.escapeCsv(columnValue); |
1116 |
|
} |
1117 |
|
} |
1118 |
|
|
1119 |
0
|
if (first) { |
1120 |
0
|
first = false; |
1121 |
|
} else { |
1122 |
0
|
line.append(outputDelimiter); |
1123 |
|
} |
1124 |
0
|
line.append(columnValue); |
1125 |
|
} |
1126 |
0
|
out.println(line); |
1127 |
0
|
line = new StringBuffer(); |
1128 |
|
} |
1129 |
0
|
while (rs.next()) { |
1130 |
0
|
boolean first = true; |
1131 |
0
|
for (int col = 1; col <= columnCount; col++) { |
1132 |
0
|
String columnValue = rs.getString(col); |
1133 |
0
|
if (columnValue != null) { |
1134 |
0
|
columnValue = columnValue.trim(); |
1135 |
|
|
1136 |
0
|
if (",".equals(outputDelimiter)) { |
1137 |
0
|
columnValue = StringEscapeUtils.escapeCsv(columnValue); |
1138 |
|
} |
1139 |
|
} |
1140 |
|
|
1141 |
0
|
if (first) { |
1142 |
0
|
first = false; |
1143 |
|
} else { |
1144 |
0
|
line.append(outputDelimiter); |
1145 |
|
} |
1146 |
0
|
line.append(columnValue); |
1147 |
|
} |
1148 |
0
|
out.println(line); |
1149 |
0
|
line = new StringBuffer(); |
1150 |
|
} |
1151 |
|
} |
1152 |
0
|
out.println(); |
1153 |
|
} |
1154 |
|
|
1155 |
|
|
1156 |
|
|
1157 |
|
|
1158 |
|
|
1159 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 10 |
Complexity Density: 0.48 |
|
1160 |
|
private class Transaction implements Comparable<Transaction> { |
1161 |
|
private File tSrcFile = null; |
1162 |
|
|
1163 |
|
private String tSqlCommand = ""; |
1164 |
|
|
1165 |
|
|
1166 |
|
|
1167 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1168 |
0
|
public void setSrc(File src) {... |
1169 |
0
|
this.tSrcFile = src; |
1170 |
|
} |
1171 |
|
|
1172 |
|
|
1173 |
|
|
1174 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1175 |
0
|
public void addText(String sql) {... |
1176 |
0
|
this.tSqlCommand += sql; |
1177 |
|
} |
1178 |
|
|
1179 |
|
|
1180 |
|
|
1181 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
1182 |
0
|
private void runTransaction(PrintStream out) throws IOException, SQLException {... |
1183 |
0
|
if (tSqlCommand.length() != 0) { |
1184 |
0
|
getLog().info("Executing commands"); |
1185 |
|
|
1186 |
0
|
runStatements(new StringReader(tSqlCommand), out); |
1187 |
|
} |
1188 |
|
|
1189 |
0
|
if (tSrcFile != null) { |
1190 |
0
|
getLog().info("Executing file: " + tSrcFile.getAbsolutePath()); |
1191 |
|
|
1192 |
0
|
Reader reader = null; |
1193 |
|
|
1194 |
0
|
if (StringUtils.isEmpty(encoding)) { |
1195 |
0
|
reader = new FileReader(tSrcFile); |
1196 |
|
} else { |
1197 |
0
|
reader = new InputStreamReader(new FileInputStream(tSrcFile), encoding); |
1198 |
|
} |
1199 |
|
|
1200 |
0
|
try { |
1201 |
0
|
runStatements(reader, out); |
1202 |
|
} finally { |
1203 |
0
|
reader.close(); |
1204 |
|
} |
1205 |
|
} |
1206 |
|
} |
1207 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
1208 |
0
|
public int compareTo(Transaction transaction) {... |
1209 |
|
|
1210 |
0
|
if (transaction.tSrcFile == null) { |
1211 |
0
|
if (this.tSrcFile == null) { |
1212 |
0
|
return 0; |
1213 |
|
} else { |
1214 |
0
|
return Integer.MAX_VALUE; |
1215 |
|
} |
1216 |
|
} else { |
1217 |
0
|
if (this.tSrcFile == null) { |
1218 |
0
|
return Integer.MIN_VALUE; |
1219 |
|
} else { |
1220 |
0
|
return this.tSrcFile.compareTo(transaction.tSrcFile); |
1221 |
|
} |
1222 |
|
} |
1223 |
|
} |
1224 |
|
} |
1225 |
|
|
1226 |
|
|
1227 |
|
|
1228 |
|
|
1229 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1230 |
0
|
public String getUsername() {... |
1231 |
0
|
return this.username; |
1232 |
|
} |
1233 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1234 |
0
|
public void setUsername(String username) {... |
1235 |
0
|
this.username = username; |
1236 |
|
} |
1237 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1238 |
0
|
public String getPassword() {... |
1239 |
0
|
return this.password; |
1240 |
|
} |
1241 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1242 |
0
|
public void setPassword(String password) {... |
1243 |
0
|
this.password = password; |
1244 |
|
} |
1245 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1246 |
0
|
public String getUrl() {... |
1247 |
0
|
return this.url; |
1248 |
|
} |
1249 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1250 |
0
|
public void setUrl(String url) {... |
1251 |
0
|
this.url = url; |
1252 |
|
} |
1253 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1254 |
0
|
public String getDriver() {... |
1255 |
0
|
return this.driver; |
1256 |
|
} |
1257 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1258 |
0
|
public void setDriver(String driver) {... |
1259 |
0
|
this.driver = driver; |
1260 |
|
} |
1261 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1262 |
0
|
void setAutocommit(boolean autocommit) {... |
1263 |
0
|
this.autocommit = autocommit; |
1264 |
|
} |
1265 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1266 |
0
|
void setFileset(Fileset fileset) {... |
1267 |
0
|
this.fileset = fileset; |
1268 |
|
} |
1269 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1270 |
0
|
public File[] getSrcFiles() {... |
1271 |
0
|
return this.srcFiles; |
1272 |
|
} |
1273 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1274 |
0
|
public void setSrcFiles(File[] files) {... |
1275 |
0
|
this.srcFiles = files; |
1276 |
|
} |
1277 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1278 |
0
|
public String getOrderFile() {... |
1279 |
0
|
return this.orderFile; |
1280 |
|
} |
1281 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1282 |
0
|
public void setOrderFile(String orderFile) {... |
1283 |
0
|
if (FILE_SORTING_ASC.equalsIgnoreCase(orderFile)) { |
1284 |
0
|
this.orderFile = FILE_SORTING_ASC; |
1285 |
0
|
} else if (FILE_SORTING_DSC.equalsIgnoreCase(orderFile)) { |
1286 |
0
|
this.orderFile = FILE_SORTING_DSC; |
1287 |
|
} else { |
1288 |
0
|
throw new IllegalArgumentException(orderFile + " is not a valid value for orderFile, only '" |
1289 |
|
+ FILE_SORTING_ASC + "' or '" + FILE_SORTING_DSC + "'."); |
1290 |
|
} |
1291 |
|
} |
1292 |
|
|
1293 |
|
|
1294 |
|
@deprecated@link |
1295 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1296 |
0
|
int getGoodSqls() {... |
1297 |
0
|
return this.getSuccessfulStatements(); |
1298 |
|
} |
1299 |
|
|
1300 |
|
|
1301 |
|
|
1302 |
|
|
1303 |
|
@return |
1304 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1305 |
0
|
public int getSuccessfulStatements() {... |
1306 |
0
|
return successfulStatements; |
1307 |
|
} |
1308 |
|
|
1309 |
|
|
1310 |
|
|
1311 |
|
|
1312 |
|
|
1313 |
|
@return |
1314 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1315 |
0
|
public int getTotalStatements() {... |
1316 |
0
|
return totalStatements; |
1317 |
|
} |
1318 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1319 |
0
|
public String getOnError() {... |
1320 |
0
|
return this.onError; |
1321 |
|
} |
1322 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
1323 |
0
|
public void setOnError(String action) {... |
1324 |
0
|
if (ON_ERROR_ABORT.equalsIgnoreCase(action)) { |
1325 |
0
|
this.onError = ON_ERROR_ABORT; |
1326 |
0
|
} else if (ON_ERROR_CONTINUE.equalsIgnoreCase(action)) { |
1327 |
0
|
this.onError = ON_ERROR_CONTINUE; |
1328 |
0
|
} else if (ON_ERROR_ABORT_AFTER.equalsIgnoreCase(action)) { |
1329 |
0
|
this.onError = ON_ERROR_ABORT_AFTER; |
1330 |
|
} else { |
1331 |
0
|
throw new IllegalArgumentException(action + " is not a valid value for onError, only '" + ON_ERROR_ABORT |
1332 |
|
+ "', '" + ON_ERROR_ABORT_AFTER + "', or '" + ON_ERROR_CONTINUE + "'."); |
1333 |
|
} |
1334 |
|
} |
1335 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1336 |
0
|
void setSettings(Settings settings) {... |
1337 |
0
|
this.settings = settings; |
1338 |
|
} |
1339 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1340 |
0
|
void setSettingsKey(String key) {... |
1341 |
0
|
this.settingsKey = key; |
1342 |
|
} |
1343 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1344 |
0
|
void setSkip(boolean skip) {... |
1345 |
0
|
this.skip = skip; |
1346 |
|
} |
1347 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1348 |
0
|
public void setDriverProperties(String driverProperties) {... |
1349 |
0
|
this.driverProperties = driverProperties; |
1350 |
|
} |
1351 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1352 |
0
|
public boolean isEnableBlockMode() {... |
1353 |
0
|
return enableBlockMode; |
1354 |
|
} |
1355 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1356 |
0
|
public void setEnableBlockMode(boolean enableBlockMode) {... |
1357 |
0
|
this.enableBlockMode = enableBlockMode; |
1358 |
|
} |
1359 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1360 |
0
|
public String getSqlCommand() {... |
1361 |
0
|
return sqlCommand; |
1362 |
|
} |
1363 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1364 |
0
|
public void setSqlCommand(String sqlCommand) {... |
1365 |
0
|
this.sqlCommand = sqlCommand; |
1366 |
|
} |
1367 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1368 |
0
|
public Vector<Transaction> getTransactions() {... |
1369 |
0
|
return transactions; |
1370 |
|
} |
1371 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1372 |
0
|
public void setTransactions(Vector<Transaction> transactions) {... |
1373 |
0
|
this.transactions = transactions; |
1374 |
|
} |
1375 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1376 |
0
|
public void setFileFilter(MavenFileFilter filter) {... |
1377 |
0
|
this.fileFilter = filter; |
1378 |
|
} |
1379 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1380 |
0
|
public String[] getResourceLocations() {... |
1381 |
0
|
return resourceLocations; |
1382 |
|
} |
1383 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1384 |
0
|
public void setResourceLocations(String[] resourceLocations) {... |
1385 |
0
|
this.resourceLocations = resourceLocations; |
1386 |
|
} |
1387 |
|
} |