1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.remote.impl.mojo;
17
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.apache.maven.plugin.MojoExecutionException;
24 import org.apache.maven.plugin.MojoFailureException;
25 import org.apache.maven.project.MavenProject;
26 import org.kuali.student.common.mojo.AbstractKSMojo;
27 import org.kuali.student.contract.model.ServiceContractModel;
28 import org.kuali.student.contract.model.impl.ServiceContractModelPescXsdLoader;
29 import org.kuali.student.contract.model.util.ServicesFilterByKeys;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
32
33
34
35
36
37
38
39
40
41 public class KSCreateRemoteImplMojo extends AbstractKSMojo {
42
43 private static Logger log = LoggerFactory.getLogger(KSCreateRemoteImplMojo.class);
44
45 public KSCreateRemoteImplMojo() {
46 }
47 public String targetDir;
48
49 public String getTargetDir() {
50 return targetDir;
51 }
52
53 public void setTargetDir(String targetDir) {
54 this.targetDir = targetDir;
55 }
56
57 @Override
58 public void execute() throws MojoExecutionException, MojoFailureException {
59
60 ServiceContractModel model = getModel();
61 validate(model);
62 if (targetDir == null) {
63 String targetDir = "target/generated-sources/remote-impl";
64 }
65 List<String> servKeys = new ArrayList<String>();
66 servKeys.add("AcademicCalendar");
67
68 servKeys.add("Appointment");
69
70
71 servKeys.add("Clu");
72 servKeys.add("Comment");
73 servKeys.add("CourseOffering");
74 servKeys.add("CourseOfferingSet");
75
76 servKeys.add("Course");
77
78
79 servKeys.add("Document");
80 servKeys.add("EnumerationManagement");
81 servKeys.add("Exemption");
82
83
84 servKeys.add("Hold");
85
86 servKeys.add("LearningObjective");
87
88
89 servKeys.add("Lpr");
90 servKeys.add("Lui");
91 servKeys.add("Message");
92 servKeys.add("Organization");
93 servKeys.add("Population");
94 servKeys.add("Process");
95 servKeys.add("Program");
96 servKeys.add("Proposal");
97 servKeys.add("Room");
98 servKeys.add("Scheduling");
99
100
101
102
103
104
105
106
107
108
109
110
111 ServicesFilterByKeys filter = new ServicesFilterByKeys(servKeys);
112 RemoteImplWriter instance =
113 new RemoteImplWriter(model,
114 targetDir,
115 RemoteImplWriter.DEFAULT_ROOT_PACKAGE,
116
117 filter);
118 instance.write();
119
120 }
121 private static final String CORE_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-core-api/src/main";
122
123 private static final String COMMON_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-common-api/src/main/java";
124 private static final String ENROLL_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-enroll-api/src/main/java";
125 private static final String LUM_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-lum-api/src/main/java";
126 private static final String RICE_CORE_API_DIRECTORY = "D:/svn/rice/rice-2.2.0-M3/core/api/src/main/java";
127 private static final String RICE_KIM_API_DIRECTORY = "D:/svn/rice/rice-2.2.0-M3/kim/kim-api/src/main/java";
128 private static final String TEST_SOURCE_DIRECTORY =
129 "src/test/java/org/kuali/student/contract/model/test/source";
130 private static final String TARGET_GENERATED_SOURCES = "target/generated-sources";
131 private static final String STANDALONE_DIRECTORY = "D:/svn/ks/ks-standalone-admin-app/src";
132
133 public static void main(String[] args) {
134 log.info("execute");
135 List<String> srcDirs = new ArrayList<String>();
136 srcDirs.add(COMMON_DIRECTORY);
137 srcDirs.add(CORE_DIRECTORY);
138 srcDirs.add(LUM_DIRECTORY);
139 srcDirs.add(ENROLL_DIRECTORY);
140 srcDirs.add(RICE_KIM_API_DIRECTORY);
141
142 KSCreateRemoteImplMojo instance = new KSCreateRemoteImplMojo();
143 Map pluginContext = new HashMap();
144 MavenProject project = new MavenProject();
145 pluginContext.put("project", project);
146 instance.setPluginContext(pluginContext);
147 instance.setSourceDirs(srcDirs);
148 instance.setTargetDir(STANDALONE_DIRECTORY);
149 try {
150 instance.execute();
151 } catch (MojoExecutionException ex) {
152 throw new RuntimeException(ex);
153 } catch (MojoFailureException ex) {
154 throw new RuntimeException(ex);
155 }
156 }
157 }