View Javadoc
1   package org.kuali.common.deploy.spring;
2   
3   import org.kuali.common.deploy.project.DeployProjectConstants;
4   import org.kuali.common.util.project.ProjectService;
5   import org.kuali.common.util.project.ProjectUtils;
6   import org.kuali.common.util.project.model.Project;
7   import org.kuali.common.util.project.spring.AutowiredProjectConfig;
8   import org.kuali.common.util.project.spring.ProjectServiceConfig;
9   import org.kuali.common.util.properties.Location;
10  import org.kuali.common.util.spring.env.EnvironmentService;
11  import org.springframework.beans.factory.annotation.Autowired;
12  import org.springframework.context.annotation.Bean;
13  import org.springframework.context.annotation.Configuration;
14  import org.springframework.context.annotation.Import;
15  
16  @Configuration
17  @Import({ AutowiredProjectConfig.class, ProjectServiceConfig.class })
18  public class BaseLocationsConfig {
19  
20  	@Autowired
21  	EnvironmentService env;
22  
23  	@Autowired
24  	ProjectService service;
25  
26  	@Autowired
27  	Project project;
28  
29  	@Bean
30  	public String kualiDeployEncoding() {
31  		Project project = service.getProject(DeployProjectConstants.ID);
32  		return ProjectUtils.getEncoding(project);
33  	}
34  
35  	@Bean
36  	public Location kualiDeployApplicationDefaults() {
37  		String path = kualiDeployGroupPrefix() + "/" + project.getArtifactId() + ".properties";
38  		return new Location(path, kualiDeployEncoding(), true);
39  	}
40  
41  	@Bean
42  	public String kualiDeployGroupPrefix() {
43  		return ProjectUtils.getClasspathPrefix(project.getGroupId());
44  	}
45  
46  	@Bean
47  	public Location kualiDeployGroupDefaults() {
48  		String path = kualiDeployGroupPrefix() + "/deploy.properties";
49  		return new Location(path, kualiDeployEncoding(), true);
50  	}
51  
52  	@Bean
53  	public Location kualiDeployDefaults() {
54  		String prefix = ProjectUtils.getClasspathPrefix(DeployProjectConstants.ID.getGroupId());
55  		String path = prefix + "/deploy/deploy.properties";
56  		return new Location(path, kualiDeployEncoding(), true);
57  	}
58  
59  }