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.config.ConfigurationException; |
22 | |
import org.kuali.rice.core.resourceloader.ResourceLoader; |
23 | |
import org.springframework.beans.BeansException; |
24 | |
import org.springframework.beans.factory.BeanFactory; |
25 | |
import org.springframework.beans.factory.BeanFactoryAware; |
26 | |
import org.springframework.beans.factory.InitializingBean; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 0 | public class RiceSpringResourceLoaderConfigurer implements BeanFactoryAware, InitializingBean { |
36 | |
|
37 | |
private QName name; |
38 | |
private String localServiceName; |
39 | |
private String serviceNameSpaceURI; |
40 | |
|
41 | |
private BeanFactory beanFactory; |
42 | |
|
43 | |
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { |
44 | 0 | this.beanFactory = beanFactory; |
45 | 0 | } |
46 | |
|
47 | |
public void afterPropertiesSet() throws Exception { |
48 | 0 | if (this.name == null) { |
49 | 0 | if (this.getServiceNameSpaceURI() == null) { |
50 | 0 | this.setServiceNameSpaceURI(ConfigContext.getCurrentContextConfig().getServiceNamespace()); |
51 | |
} |
52 | 0 | if (this.getLocalServiceName() == null) { |
53 | 0 | throw new ConfigurationException("Need to give " + this.getClass().getName() + " a LocalServiceName"); |
54 | |
} |
55 | |
} |
56 | |
|
57 | 0 | ResourceLoader beanFactoryRL = new BeanFactoryResourceLoader(getName(), this.beanFactory); |
58 | 0 | GlobalResourceLoader.addResourceLoaderFirst(beanFactoryRL); |
59 | 0 | } |
60 | |
|
61 | |
public QName getName() { |
62 | 0 | if (this.name == null) { |
63 | 0 | this.setName(new QName(this.getServiceNameSpaceURI(), this.getLocalServiceName())); |
64 | |
} |
65 | 0 | return name; |
66 | |
} |
67 | |
|
68 | |
public void setName(QName name) { |
69 | 0 | this.name = name; |
70 | 0 | } |
71 | |
|
72 | |
public String getLocalServiceName() { |
73 | 0 | return localServiceName; |
74 | |
} |
75 | |
|
76 | |
public void setLocalServiceName(String localServiceName) { |
77 | 0 | this.localServiceName = localServiceName; |
78 | 0 | } |
79 | |
|
80 | |
public String getServiceNameSpaceURI() { |
81 | 0 | return serviceNameSpaceURI; |
82 | |
} |
83 | |
|
84 | |
public void setServiceNameSpaceURI(String serviceNameSpaceURI) { |
85 | 0 | this.serviceNameSpaceURI = serviceNameSpaceURI; |
86 | 0 | } |
87 | |
|
88 | |
} |