1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.datadictionary.mojo;
17
18 import java.io.File;
19 import java.util.Collection;
20 import java.util.List;
21
22 import org.apache.maven.plugin.AbstractMojo;
23 import org.apache.maven.plugin.MojoExecutionException;
24
25 import org.kuali.student.common.mojo.AbstractKSMojo;
26 import org.kuali.student.contract.model.ServiceContractModel;
27 import org.kuali.student.contract.model.impl.ServiceContractModelCache;
28 import org.kuali.student.contract.model.impl.ServiceContractModelQDoxLoader;
29 import org.kuali.student.contract.model.validation.ServiceContractModelValidator;
30 import org.kuali.student.contract.writer.service.EachMethodServiceWriter;
31
32
33
34
35
36
37
38 public class KSEachMethodServiceGeneratorrMojo extends AbstractKSMojo {
39
40
41
42
43 private File outputDirectory;
44
45 public File getOutputDirectory() {
46 return outputDirectory;
47 }
48
49
50 public void setOutputDirectory(File htmlDirectory) {
51 this.outputDirectory = htmlDirectory;
52 }
53
54
55
56
57 private String rootPackage;
58
59 public String getRootPackage() {
60 return rootPackage;
61 }
62
63 public void setRootPackage(String rootPackage) {
64 this.rootPackage = rootPackage;
65 }
66
67
68
69
70 @Override
71 public void execute() throws MojoExecutionException {
72 getLog().info("generating separate java interface files for each method in the service contracts");
73 ServiceContractModel model = this.getModel();
74 this.validate(model);
75 if (!outputDirectory.exists()) {
76 if (!outputDirectory.mkdirs()) {
77
78 throw new IllegalArgumentException("Could not create directory "
79 + this.outputDirectory.getPath());
80 }
81 }
82 String targetDirectory = this.outputDirectory.toString();
83 EachMethodServiceWriter instance =
84 new EachMethodServiceWriter(model,
85 targetDirectory,
86 rootPackage,
87 null);
88 instance.write();
89
90 }
91 }