1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.config.spring;
17
18 import java.util.Properties;
19
20 import org.kuali.common.util.maven.MavenConstants;
21 import org.kuali.common.util.maven.MavenUtils;
22 import org.kuali.common.util.maven.spring.AutowiredMavenProperties;
23 import org.kuali.common.util.maven.spring.NoAutowiredMavenProperties;
24 import org.kuali.common.util.project.ProjectService;
25 import org.kuali.common.util.project.model.Project;
26 import org.kuali.common.util.project.spring.ProjectServiceConfig;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.beans.factory.annotation.Qualifier;
29 import org.springframework.context.annotation.Bean;
30 import org.springframework.context.annotation.Configuration;
31 import org.springframework.context.annotation.Import;
32 import org.springframework.util.Assert;
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 @Configuration
50 @Deprecated
51 public class ProjectPropertySourceConfig extends BasicPropertySourceConfig {
52
53 private static final String PROJECT_BEAN_NAME = "project.immutable";
54 public static final String PROJECT_ID_BEAN_NAME = "project.id";
55
56 @Autowired
57 @Qualifier(PROJECT_BEAN_NAME)
58 Project project;
59
60 @Override
61 protected Properties getOverrides() {
62 return project.getProperties();
63 }
64
65
66
67
68 @Deprecated
69 @Configuration
70 @NoAutowiredMavenProperties
71 @Import({ ProjectServiceConfig.class })
72 static class RuntimeProjectConfig {
73
74
75
76 @Autowired
77 @Qualifier(PROJECT_ID_BEAN_NAME)
78 String projectId;
79
80 @Autowired
81 ProjectServiceConfig projectServiceConfig;
82
83 @Bean(name = PROJECT_BEAN_NAME)
84 public Project runtimeProjectConfigProject() {
85
86
87 Assert.hasText(projectId, "projectId is blank");
88
89
90 ProjectService service = projectServiceConfig.projectService();
91
92
93 return service.getProject("", "");
94 }
95 }
96
97
98
99
100 @Deprecated
101 @Configuration
102 @AutowiredMavenProperties
103 @Import({ ProjectServiceConfig.class })
104 static class BuildProjectConfig {
105
106
107 @Autowired
108 @Qualifier(MavenConstants.PROPERTIES_BEAN_NAME)
109 Properties mavenProperties;
110
111 @Autowired
112 ProjectServiceConfig projectServiceConfig;
113
114 @Bean(name = PROJECT_BEAN_NAME)
115 public Project buildProjectConfigProject() {
116
117 Assert.notNull(mavenProperties, "mavenProperties are null");
118
119
120 ProjectService service = projectServiceConfig.projectService();
121
122
123 MavenUtils.augmentProjectProperties(service, mavenProperties);
124
125
126 return service.getProject(mavenProperties);
127 }
128 }
129
130 }