
org.kuali.student.remote.impl.mojo.KSCreateRemoteImplMojo Maven / Gradle / Ivy
/*
* Copyright 2009 The Kuali Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.osedu.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kuali.student.remote.impl.mojo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.kuali.student.common.mojo.AbstractKSMojo;
import org.kuali.student.contract.model.ServiceContractModel;
import org.kuali.student.contract.model.util.ServicesFilterByKeys;
/**
*
* @author nwright
*
* @goal kscreateremoteimpl
* @phase none
* @requiresProject true
*/
public class KSCreateRemoteImplMojo extends AbstractKSMojo {
public KSCreateRemoteImplMojo() {
}
public String targetDir;
public String getTargetDir() {
return targetDir;
}
public void setTargetDir(String targetDir) {
this.targetDir = targetDir;
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
ServiceContractModel model = getModel();
validate(model);
if (targetDir == null) {
String targetDir = "target/generated-sources/remote-impl";
}
List servKeys = new ArrayList();
servKeys.add("Atp");
servKeys.add("Type");
servKeys.add("State");
servKeys.add("LRC");
servKeys.add("RICE.Permission");
servKeys.add("RICE.Role");
ServicesFilterByKeys filter = new ServicesFilterByKeys(servKeys);
RemoteImplWriter instance =
new RemoteImplWriter(model,
targetDir,
RemoteImplWriter.DEFAULT_ROOT_PACKAGE,
// TODO: inject filters as part of the Mojo parameters
filter);
instance.write();
}
private static final String CORE_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-core-api/src/main";
// "C:/svn/maven-dictionary-generator/trunk/src/main/java/org/kuali/student/core";
private static final String COMMON_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-common-api/src/main/java";
private static final String ENROLL_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-enroll-api/src/main/java";
private static final String LUM_DIRECTORY = "D:/svn/ks/trunk/ks-api/ks-lum-api/src/main/java";
private static final String RICE_CORE_API_DIRECTORY = "D:/svn/rice/rice-2.2.0-M3/core/api/src/main/java";
private static final String RICE_KIM_API_DIRECTORY = "D:/svn/rice/rice-2.2.0-M3/kim/kim-api/src/main/java";
private static final String TEST_SOURCE_DIRECTORY =
"src/test/java/org/kuali/student/contract/model/test/source";
private static final String TARGET_GENERATED_SOURCES = "target/generated-sources";
private static final String STANDALONE_DIRECTORY = "D:/svn/ks/ks-standalone-admin-app/src";
public static void main(String[] args) {
System.out.println("execute");
List srcDirs = new ArrayList();
srcDirs.add(COMMON_DIRECTORY);
srcDirs.add(CORE_DIRECTORY);
srcDirs.add(LUM_DIRECTORY);
srcDirs.add(ENROLL_DIRECTORY);
srcDirs.add(RICE_KIM_API_DIRECTORY);
// srcDirs.add(RICE_CORE_API_DIRECTORY);
KSCreateRemoteImplMojo instance = new KSCreateRemoteImplMojo();
Map pluginContext = new HashMap();
MavenProject project = new MavenProject();
pluginContext.put("project", project);
instance.setPluginContext(pluginContext);
instance.setSourceDirs(srcDirs);
instance.setTargetDir(STANDALONE_DIRECTORY);
try {
instance.execute();
} catch (MojoExecutionException ex) {
throw new RuntimeException(ex);
} catch (MojoFailureException ex) {
throw new RuntimeException(ex);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy