1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.batch;
17
18 import org.apache.log4j.Logger;
19 import org.kuali.rice.core.config.ConfigContext;
20 import org.kuali.rice.core.lifecycle.BaseLifecycle;
21
22
23
24
25
26
27
28
29
30 public class KEWXmlDataLoaderLifecycle extends BaseLifecycle {
31 private static final Logger LOG = Logger.getLogger(KEWXmlDataLoaderLifecycle.class);
32
33 private String filename;
34
35
36
37
38
39 public KEWXmlDataLoaderLifecycle() {
40 this("classpath:DefaultTestData.xml");
41 }
42
43
44
45
46
47 public KEWXmlDataLoaderLifecycle(String resource) {
48 this.filename = resource;
49 }
50
51 public void start() throws Exception {
52 String useKewXmlDataLoaderLifecycle = ConfigContext.getCurrentContextConfig().getProperty("use.kewXmlmlDataLoaderLifecycle");
53
54 if (useKewXmlDataLoaderLifecycle != null && !Boolean.valueOf(useKewXmlDataLoaderLifecycle)) {
55 LOG.debug("Skipping KEWXmlDataLoaderLifecycle due to property: use.kewXmlmlDataLoaderLifecycle=" + useKewXmlDataLoaderLifecycle);
56 return;
57 }
58
59 LOG.info("################################");
60 LOG.info("#");
61 LOG.info("# Begin Loading file '" + filename + "'");
62 LOG.info("#");
63 LOG.info("################################");
64 loadData();
65 super.start();
66 }
67
68
69
70
71
72 protected void loadData() throws Exception {
73 KEWXmlDataLoader.loadXmlResource(filename);
74 }
75 }