1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.impex.spring;
17
18 import org.kuali.common.impex.database.DumpDatabaseExecutable;
19 import org.kuali.common.jdbc.spring.JdbcDataSourceConfig;
20 import org.kuali.common.util.execute.Executable;
21 import org.kuali.common.util.spring.SpringUtils;
22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.context.annotation.Bean;
24 import org.springframework.context.annotation.Configuration;
25 import org.springframework.context.annotation.Import;
26 import org.springframework.core.env.Environment;
27
28
29
30
31 @Configuration
32 @Import({ JdbcDataSourceConfig.class, ExtractSchemaConfig.class, DumpSchemaConfig.class, DumpDataConfig.class })
33 public class DumpDatabaseConfig {
34
35 private static final String SKIP_KEY = "impex.dump.skip";
36 private static final boolean DEFAULT_SKIP_VALUE = false;
37
38 @Autowired
39 Environment env;
40
41 @Autowired
42 JdbcDataSourceConfig dataSourceConfig;
43
44 @Autowired
45 ExtractSchemaConfig extractSchemaConfig;
46
47 @Autowired
48 DumpSchemaConfig dumpSchemaConfig;
49
50 @Autowired
51 DumpDataConfig dumpDataConfig;
52
53 @Bean
54 public Executable dumpDatabaseExecutable() {
55
56
57 DumpDatabaseExecutable exec = new DumpDatabaseExecutable();
58
59
60 exec.setSkip(SpringUtils.getBoolean(env, SKIP_KEY, DEFAULT_SKIP_VALUE));
61
62
63 exec.setShowConfigExecutable(dataSourceConfig.jdbcShowConfigExecutable());
64
65
66 exec.setExtractSchemaExecutable(extractSchemaConfig.extractSchemaExecutable());
67
68
69 exec.setDumpSchemaExecutable(dumpSchemaConfig.dumpSchemaExecutable());
70
71
72 exec.setDumpDataExecutable(dumpDataConfig.dumpDataExecutable());
73
74
75 return exec;
76 }
77
78 }