1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.torque.mojo;
17
18 import java.io.File;
19
20 import org.apache.maven.plugin.MojoExecutionException;
21 import org.apache.torque.mojo.morph.MorphRequest;
22 import org.apache.torque.mojo.morph.Morpher;
23 import org.apache.torque.mojo.morph.SchemaMorpher;
24
25
26
27
28
29
30
31 public class MorphSchemaMojo extends AbstractMorphSingleMojo {
32
33
34
35
36
37
38
39 private String antSchemaName;
40
41
42
43
44
45
46
47 private File newSchemaXMLFile;
48
49
50
51
52
53
54
55 private File oldSchemaXMLFile;
56
57 @Override
58 protected void beforeExecution() {
59 setNewFile(newSchemaXMLFile);
60 setOldFile(oldSchemaXMLFile);
61 }
62
63 @Override
64 protected void executeMojo() throws MojoExecutionException {
65 getLog().info("------------------------------------------------------------------------");
66 getLog().info("Converting schema XML file");
67 getLog().info("------------------------------------------------------------------------");
68 super.executeMojo();
69 }
70
71 @Override
72 protected Morpher getMorpher(final MorphRequest request, final String artifactId) {
73 SchemaMorpher morpher = new SchemaMorpher(request, artifactId);
74 morpher.setAntSchemaName(antSchemaName);
75 morpher.setAntSchemaToken("name=\"" + antSchemaName + "\"");
76 return morpher;
77 }
78
79 public File getNewSchemaXMLFile() {
80 return newSchemaXMLFile;
81 }
82
83 public void setNewSchemaXMLFile(final File newSchemaXMLFile) {
84 this.newSchemaXMLFile = newSchemaXMLFile;
85 }
86
87 public File getOldSchemaXMLFile() {
88 return oldSchemaXMLFile;
89 }
90
91 public void setOldSchemaXMLFile(final File oldSchemaXMLFile) {
92 this.oldSchemaXMLFile = oldSchemaXMLFile;
93 }
94
95 public String getAntSchemaName() {
96 return antSchemaName;
97 }
98
99 public void setAntSchemaName(String antSchemaName) {
100 this.antSchemaName = antSchemaName;
101 }
102 }