1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.core.resourceloader;
17
18 import javax.xml.namespace.QName;
19
20 import org.kuali.rice.core.config.ConfigContext;
21 import org.kuali.rice.core.lifecycle.BaseLifecycle;
22 import org.kuali.rice.core.resourceloader.ResourceLoader;
23 import org.kuali.rice.core.util.RiceConstants;
24
25 public class RootResourceLoaderLifecycle extends BaseLifecycle {
26
27 private ResourceLoader rootResourceLoader;
28
29 public RootResourceLoaderLifecycle(ResourceLoader rootResourceLoader) {
30 this.rootResourceLoader = rootResourceLoader;
31 }
32
33 @Override
34 public void start() throws Exception {
35 ResourceLoaderContainer container = new ResourceLoaderContainer(new QName(getServiceNamespace(), RiceConstants.ROOT_RESOURCE_LOADER_CONTAINER_NAME));
36 if (this.rootResourceLoader == null) {
37 this.rootResourceLoader = new BaseResourceLoader(new QName(getServiceNamespace(), RiceConstants.DEFAULT_ROOT_RESOURCE_LOADER_NAME));
38 }
39 container.addResourceLoader(this.rootResourceLoader);
40 GlobalResourceLoader.addResourceLoader(container);
41 GlobalResourceLoader.start();
42 }
43
44 @Override
45 public void stop() throws Exception {
46 super.stop();
47 }
48
49 protected String getServiceNamespace() {
50 return ConfigContext.getCurrentContextConfig().getServiceNamespace();
51 }
52
53
54
55 }