1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.spring;
17
18 import java.io.File;
19 import java.util.Arrays;
20 import java.util.List;
21
22 import org.kuali.common.util.CollectionUtils;
23 import org.kuali.common.util.execute.Executable;
24 import org.springframework.beans.factory.annotation.Autowired;
25 import org.springframework.context.annotation.Bean;
26 import org.springframework.context.annotation.Configuration;
27 import org.springframework.core.env.Environment;
28
29
30
31
32 @Deprecated
33 @Configuration
34 public class MetaInfMpxConfig {
35
36 private static final String DEFAULT_INCLUDE_PATTERN = "**/*.mpx";
37 private static final String DEFAULT_OUTPUT_FILE = "${project.build.outputDirectory}/META-INF/${project.groupId.base.path}/${project.artifactId}/data.resources";
38 private static final String INCLUDES_KEY = "impex.metainf.includes";
39 private static final String OUTPUT_FILE_KEY = "impex.metainf.includes";
40 private static final String BUILD_OUTPUT_DIR_KEY = "project.build.outputDirectory";
41
42 @Autowired
43 Environment env;
44
45 @Bean
46 public Executable mpxMetaInfExecutable() {
47
48
49 String csv = SpringUtils.getProperty(env, INCLUDES_KEY, DEFAULT_INCLUDE_PATTERN);
50 List<String> includes = CollectionUtils.getTrimmedListFromCSV(csv);
51
52
53 File buildOutputDir = new File(SpringUtils.getProperty(env, BUILD_OUTPUT_DIR_KEY));
54
55
56
57 File outputFile = new File(SpringUtils.getProperty(env, OUTPUT_FILE_KEY, DEFAULT_OUTPUT_FILE));
58
59
60 org.kuali.common.util.metainf.MetaInfContext context = new org.kuali.common.util.metainf.MetaInfContext();
61 context.setBaseDir(buildOutputDir);
62 context.setOutputFile(outputFile);
63 context.setIncludes(includes);
64
65
66 org.kuali.common.util.execute.MetaInfExecutable exec = new org.kuali.common.util.execute.MetaInfExecutable();
67 exec.setContexts(Arrays.asList(context));
68 return exec;
69 }
70
71 }