All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kuali.common.impex.util.SchemaExportUtility Maven / Gradle / Ivy

There is a newer version: 3.0.3
Show newest version
/**
 * Copyright 2011 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.common.impex.util;

import java.util.List;

import org.kuali.common.impex.util.spring.SchemaExportExecutionConfig;
import org.kuali.common.jdbc.JdbcProjectContext;
import org.kuali.common.util.CollectionUtils;
import org.kuali.common.util.ProjectContext;
import org.kuali.common.util.execute.SpringExecutable;
import org.kuali.common.util.spring.SpringUtils;

public class SchemaExportUtility {

	public static void main(String[] args) {

		String propertiesLocation = getPropertiesLocation(args);

		if (propertiesLocation == null) {
			printHelpAndExit();
		}

		try {
			ProjectContext project = new JdbcProjectContext();
			List> annotatedClasses = CollectionUtils.asList(SchemaExportExecutionConfig.class);
			SpringExecutable executable = SpringUtils.getSpringExecutable(project, propertiesLocation, annotatedClasses);
			executable.execute();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	protected static String getPropertiesLocation(String[] args) {
		if (args == null || args.length < 1) {
			return null;
		} else {
			return args[0];
		}
	}

	private static void printHelpAndExit() {
		System.out.println("Expects exactly one argument, a property file location.");
		System.exit(1);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy