1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.config;
17
18 import org.kuali.rice.core.config.ConfigurationException;
19 import org.kuali.rice.core.resourceloader.GlobalResourceLoader;
20 import org.springframework.beans.factory.FactoryBean;
21 import org.springframework.beans.factory.InitializingBean;
22
23
24
25
26
27
28
29 public class GlobalResourceLoaderServiceFactoryBean implements FactoryBean, InitializingBean {
30
31 private String serviceName;
32 private boolean singleton;
33
34 public Object getObject() throws Exception {
35 return GlobalResourceLoader.getService(this.getServiceName());
36 }
37
38 public Class getObjectType() {
39 return Object.class;
40 }
41
42 public boolean isSingleton() {
43 return singleton;
44 }
45
46 public String getServiceName() {
47 return serviceName;
48 }
49
50 public void setServiceName(String serviceName) {
51 this.serviceName = serviceName;
52 }
53
54 public void setSingleton(boolean singleton) {
55 this.singleton = singleton;
56 }
57
58 public void afterPropertiesSet() throws Exception {
59 if (this.getServiceName() == null) {
60 throw new ConfigurationException("No serviceName given.");
61 }
62 }
63
64 }