1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.sys;
17
18 import java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.Collections;
21 import java.util.List;
22
23 import org.kuali.rice.core.api.config.module.RunMode;
24 import org.kuali.rice.core.api.config.property.ConfigContext;
25 import org.kuali.rice.core.framework.config.module.ModuleConfigurer;
26
27 public class KpmeModuleConfigurer extends ModuleConfigurer {
28
29 public KpmeModuleConfigurer() {
30 setValidRunModes(Arrays.asList(RunMode.LOCAL));
31 }
32
33 public KpmeModuleConfigurer(String moduleName) {
34 setModuleName(moduleName);
35 setValidRunModes(Arrays.asList(RunMode.LOCAL));
36 }
37
38 @Override
39 public List<String> getAdditionalSpringFiles() {
40 final String files = ConfigContext.getCurrentContextConfig().getProperty("kpme." + getModuleName() + ".additionalSpringFiles");
41 return files == null ? Collections.<String>emptyList() : parseFileList(files);
42 }
43
44 @Override
45 public RunMode getRunMode() {
46 return RunMode.LOCAL;
47 }
48
49 protected String getDefaultConfigPackagePath() {
50 return "classpath:org/kuali/kpme/" + getModuleName().toLowerCase() + "/config/";
51 }
52
53 private List<String> parseFileList(String files) {
54 final List<String> parsedFiles = new ArrayList<String>();
55 for (String file : Arrays.asList(files.split(","))) {
56 final String trimmedFile = file.trim();
57 if (!trimmedFile.isEmpty()) {
58 parsedFiles.add(trimmedFile);
59 }
60 }
61
62 return parsedFiles;
63 }
64 }