1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.maven.spring;
17
18 import java.util.Properties;
19
20 import org.apache.maven.project.MavenProject;
21 import org.kuali.common.util.MavenConstants;
22 import org.kuali.common.util.execute.Executable;
23 import org.kuali.common.util.execute.SetSourceDbSchemaNameExecutable;
24 import org.kuali.common.util.spring.SpringUtils;
25 import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.beans.factory.annotation.Qualifier;
27 import org.springframework.context.annotation.Bean;
28 import org.springframework.context.annotation.Configuration;
29 import org.springframework.core.env.Environment;
30
31 @Configuration
32 public class SetSourceDbSchemaNameConfig {
33
34 @Autowired
35 Environment env;
36
37 @Autowired
38 @Qualifier(MavenConstants.MAVEN_PROJECT_BEAN_NAME)
39 MavenProject mavenProject;
40
41 @Bean(initMethod = "execute")
42 public Executable setSourceDbSchemaNameExecutable() {
43 boolean skip = SpringUtils.getBoolean(env, "jdbc.source.db.setSchemaName.skip", false);
44 String baseSourceDbSchemaName = SpringUtils.getProperty(env, "jdbc.source.db.base");
45 Properties mavenProperties = mavenProject.getProperties();
46 String version = mavenProject.getVersion();
47
48 SetSourceDbSchemaNameExecutable executable = new SetSourceDbSchemaNameExecutable();
49 executable.setBaseSourceDbSchemaName(baseSourceDbSchemaName);
50 executable.setMavenProperties(mavenProperties);
51 executable.setSkip(skip);
52 executable.setVersion(version);
53 return executable;
54 }
55
56 }