1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.impex.util;
17
18 import java.util.List;
19 import java.util.Properties;
20
21 import org.kuali.common.impex.config.DumpConfigConstants;
22 import org.kuali.common.impex.spring.DumpDatabaseExecutableConfig;
23 import org.kuali.common.util.CollectionUtils;
24 import org.kuali.common.util.PropertyUtils;
25 import org.kuali.common.util.config.service.DefaultConfigService;
26 import org.kuali.common.util.config.supplier.ConfigPropertiesSupplier;
27 import org.kuali.common.util.config.supplier.PropertiesSupplier;
28 import org.kuali.common.util.execute.SpringExecutable;
29 import org.kuali.common.util.spring.SpringUtils;
30
31 public class SchemaExportUtility {
32
33 public static void main(String[] args) {
34
35 String propertiesLocation = getPropertiesLocation(args);
36
37 if (propertiesLocation == null) {
38 printHelpAndExit();
39 }
40
41 try {
42 List<Class<?>> annotatedClasses = CollectionUtils.asList(DumpDatabaseExecutableConfig.class);
43 Properties overrides = PropertyUtils.load(propertiesLocation);
44 PropertiesSupplier supplier = new ConfigPropertiesSupplier(DumpConfigConstants.CONFIG_IDS, new DefaultConfigService(), overrides);
45 SpringExecutable executable = SpringUtils.getSpringExecutable(supplier, annotatedClasses);
46 executable.execute();
47 } catch (Exception e) {
48 e.printStackTrace();
49 }
50
51 }
52
53 protected static String getPropertiesLocation(String[] args) {
54 if (args == null || args.length < 1) {
55 return null;
56 } else {
57 return args[0];
58 }
59 }
60
61 private static void printHelpAndExit() {
62 System.out.println("Expects exactly one argument, a property file location.");
63 System.exit(1);
64 }
65
66 }