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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 servKeys.add("Type");
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 private static final String BC_CONTRIB_REMOTE_DIRECTORY = "D:/svn/BCAll/BC-ENRL-Contributions/ks-remote-services-master/ks-remote-services-impl/src";
133
134 public static void main(String[] args) {
135 log.info("execute");
136 List<String> srcDirs = new ArrayList<String>();
137 srcDirs.add(COMMON_DIRECTORY);
138 srcDirs.add(CORE_DIRECTORY);
139 srcDirs.add(LUM_DIRECTORY);
140 srcDirs.add(ENROLL_DIRECTORY);
141
142
143 KSCreateRemoteImplMojo instance = new KSCreateRemoteImplMojo();
144 Map pluginContext = new HashMap();
145 MavenProject project = new MavenProject();
146 pluginContext.put("project", project);
147 instance.setPluginContext(pluginContext);
148 instance.setSourceDirs(srcDirs);
149 instance.setTargetDir(BC_CONTRIB_REMOTE_DIRECTORY);
150 try {
151 instance.execute();
152 } catch (MojoExecutionException ex) {
153 throw new RuntimeException(ex);
154 } catch (MojoFailureException ex) {
155 throw new RuntimeException(ex);
156 }
157 }
158 }